repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/src/assets/lazy_theme_set.rs | src/assets/lazy_theme_set.rs | use super::*;
use std::collections::BTreeMap;
use std::convert::TryFrom;
use serde_derive::{Deserialize, Serialize};
use once_cell::unsync::OnceCell;
use syntect::highlighting::{Theme, ThemeSet};
/// Same structure as a [`syntect::highlighting::ThemeSet`] but with themes
/// stored in raw serialized form, and dese... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/src/assets/serialized_syntax_set.rs | src/assets/serialized_syntax_set.rs | use std::path::PathBuf;
use syntect::parsing::SyntaxSet;
use super::*;
/// A SyntaxSet in serialized form, i.e. bincoded and flate2 compressed.
/// We keep it in this format since we want to load it lazily.
#[derive(Debug)]
pub enum SerializedSyntaxSet {
/// The data comes from a user-generated cache file.
F... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/src/assets/assets_metadata.rs | src/assets/assets_metadata.rs | use std::fs::File;
use std::path::Path;
use std::time::SystemTime;
use semver::Version;
use serde_derive::{Deserialize, Serialize};
use crate::error::*;
#[derive(Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct AssetsMetadata {
bat_version: Option<String>,
creation_time: Option<SystemTime>,... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/src/assets/build_assets/acknowledgements.rs | src/assets/build_assets/acknowledgements.rs | use std::fmt::Write;
use std::fs::read_to_string;
use std::path::{Path, PathBuf};
use walkdir::DirEntry;
use crate::error::*;
struct PathAndStem {
path: PathBuf,
stem: String,
relative_path: String,
}
/// Looks for LICENSE and NOTICE files in `source_dir`, does some rudimentary
/// analysis, and compile... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/src/syntax_mapping/ignored_suffixes.rs | src/syntax_mapping/ignored_suffixes.rs | use std::ffi::OsStr;
use std::fmt::Debug;
use std::path::Path;
use crate::error::*;
#[derive(Debug, Clone)]
pub struct IgnoredSuffixes<'a> {
values: Vec<&'a str>,
}
impl Default for IgnoredSuffixes<'_> {
fn default() -> Self {
Self {
values: vec![
// Editor etc backups
... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/src/syntax_mapping/builtin.rs | src/syntax_mapping/builtin.rs | use std::env;
use globset::GlobMatcher;
use once_cell::sync::Lazy;
use crate::syntax_mapping::{make_glob_matcher, MappingTarget};
// Static syntax mappings generated from /src/syntax_mapping/builtins/ by the
// build script (/build/syntax_mapping.rs).
include!(concat!(
env!("OUT_DIR"),
"/codegen_static_synta... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/no_duplicate_extensions.rs | tests/no_duplicate_extensions.rs | use std::collections::HashSet;
use bat::assets::HighlightingAssets;
#[test]
fn no_duplicate_extensions() {
const KNOWN_EXCEPTIONS: &[&str] = &[
// The '.h' extension currently appears in multiple syntaxes: C, C++, Objective C,
// Objective C++
"h",
// In addition to the standard Ja... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/integration_tests.rs | tests/integration_tests.rs | use predicates::boolean::PredicateBooleanExt;
use predicates::{prelude::predicate, str::PredicateStrExt};
use serial_test::serial;
use std::path::Path;
use std::str::from_utf8;
use tempfile::tempdir;
#[cfg(unix)]
mod unix {
pub use std::fs::File;
pub use std::io::{self, Write};
pub use std::path::PathBuf;
... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | true |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/test_pretty_printer.rs | tests/test_pretty_printer.rs | use bat::PrettyPrinter;
#[test]
fn syntaxes() {
let printer = PrettyPrinter::new();
let syntaxes: Vec<String> = printer.syntaxes().map(|s| s.name).collect();
// Just do some sanity checking
assert!(syntaxes.contains(&"Rust".to_string()));
assert!(syntaxes.contains(&"Java".to_string()));
assert... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/github-actions.rs | tests/github-actions.rs | #[test]
fn all_jobs_not_missing_any_jobs() {
let yaml: serde_yaml::Value =
serde_yaml::from_reader(std::fs::File::open(".github/workflows/CICD.yml").unwrap())
.unwrap();
let jobs = yaml.get("jobs").unwrap();
// Get all jobs that all-jobs depends on:
//
// jobs:
// all-... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/assets.rs | tests/assets.rs | use bat::assets::HighlightingAssets;
/// This test ensures that we are not accidentally removing themes due to submodule updates.
/// It is 'ignore'd by default because it requires themes.bin to be up-to-date.
#[test]
#[ignore]
fn all_themes_are_present() {
let assets = HighlightingAssets::from_binary();
let ... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/system_wide_config.rs | tests/system_wide_config.rs | use predicates::{prelude::predicate, str::PredicateStrExt};
mod utils;
use utils::command::bat_with_config;
// This test is ignored, as it needs a special system wide config put into place.
// In order to run this tests, use `cargo test --test system_wide_config -- --ignored`
#[test]
#[ignore]
fn use_systemwide_confi... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/snapshot_tests.rs | tests/snapshot_tests.rs | #[cfg(feature = "git")]
mod tester;
macro_rules! snapshot_tests {
($($test_name: ident: $style: expr,)*) => {
$(
#[test]
#[cfg(feature = "git")]
fn $test_name() {
let bat_tester = tester::BatTester::default();
bat_tester.test_snapshot(stri... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/utils/command.rs | tests/utils/command.rs | #![allow(unused)] // Because indirectly included by e.g.integration_tests.rs, but not everything inside is used
use assert_cmd::cargo::CommandCargoExt;
use std::process::Command;
pub fn bat_raw_command_with_config() -> Command {
let mut cmd = Command::cargo_bin("bat").unwrap();
cmd.current_dir("tests/examples... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/utils/mod.rs | tests/utils/mod.rs | pub mod command;
pub mod mocked_pagers;
| rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/utils/mocked_pagers.rs | tests/utils/mocked_pagers.rs | #![allow(unused)] // Because indirectly included by e.g. system_wide_config.rs, but not used
use assert_cmd::Command;
use predicates::prelude::predicate;
use std::env;
use std::path::{Path, PathBuf};
/// For some tests we want mocked versions of some pagers
/// This fn returns the absolute path to the directory with ... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/syntax-tests/highlighted/Rust/output.rs | tests/syntax-tests/highlighted/Rust/output.rs | [38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;248;248;242mstd[0m[38;2;248;248;242m::[0m[38;2;248;248;242mio[0m[38;2;248;248;242m::[0m[38;2;248;248;242m{[0m[38;2;255;255;255mself[0m[38;2;248;248;242m,[0m[38;2;248;248;242m Write[0m[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
[38;2;248;248;24... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/syntax-tests/source/Rust/output.rs | tests/syntax-tests/source/Rust/output.rs | use std::io::{self, Write};
#[cfg(feature = "paging")]
use std::process::Child;
use crate::error::*;
#[cfg(feature = "paging")]
use crate::less::retrieve_less_version;
#[cfg(feature = "paging")]
use crate::paging::PagingMode;
#[derive(Debug)]
pub enum OutputType {
#[cfg(feature = "paging")]
Pager(Child),
... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/snapshots/sample.rs | tests/snapshots/sample.rs | struct Rectangle {
width: u32,
height: u32,
}
fn main() {
// width and height of a rectangle can be different
let rect1 = Rectangle { width: 30, height: 50 };
println!(
"The area of the rectangle is {} square pixels.",
area(&rect1)
);
}
fn area(rectangle: &Rectangle) -> u32 {
... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/tests/tester/mod.rs | tests/tester/mod.rs | use std::env;
use std::fs::{self, File};
use std::io::Read;
use std::path::{Path, PathBuf};
use std::process::Command;
use tempfile::TempDir;
use git2::build::CheckoutBuilder;
use git2::Repository;
use git2::Signature;
pub struct BatTester {
/// Temporary working directory
temp_dir: TempDir,
/// Path to... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/build/syntax_mapping.rs | build/syntax_mapping.rs | use std::{
convert::Infallible,
env, fs,
path::{Path, PathBuf},
str::FromStr,
};
use anyhow::{anyhow, bail};
use indexmap::IndexMap;
use itertools::Itertools;
use once_cell::sync::Lazy;
use proc_macro2::TokenStream;
use quote::{quote, ToTokens, TokenStreamExt};
use regex::Regex;
use serde_derive::Deser... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/build/application.rs | build/application.rs | use std::{env, fs, path::PathBuf};
use crate::util::render_template;
/// Generate manpage and shell completions for the bat application.
pub fn gen_man_and_comp() -> anyhow::Result<()> {
println!("cargo:rerun-if-changed=assets/manual/");
println!("cargo:rerun-if-changed=assets/completions/");
println!("c... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/build/util.rs | build/util.rs | #![allow(dead_code)]
use std::{collections::HashMap, fs, path::Path};
/// Generates a file from a template.
pub fn render_template(
variables: &HashMap<&str, String>,
in_file: &str,
out_file: impl AsRef<Path>,
) -> anyhow::Result<()> {
let mut content = fs::read_to_string(in_file)?;
for (variable... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/build/main.rs | build/main.rs | #[cfg(feature = "application")]
mod application;
mod syntax_mapping;
mod util;
fn main() -> anyhow::Result<()> {
// only watch manually-designated files
// see: https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed
println!("cargo:rerun-if-changed=build/");
syntax_mapping::buil... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/assets/theme_preview.rs | assets/theme_preview.rs | // Output the square of a number.
fn print_square(num: f64) {
let result = f64::powf(num, 2.0);
println!("The square of {num:.2} is {result:.2}.");
}
| rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/examples/inputs.rs | examples/inputs.rs | /// A small demonstration of the Input API.
/// This prints embedded bytes with a custom header and then reads from STDIN.
use bat::{Input, PrettyPrinter};
fn main() {
PrettyPrinter::new()
.header(true)
.grid(true)
.line_numbers(true)
.inputs(vec![
Input::from_bytes(b"ec... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/examples/advanced.rs | examples/advanced.rs | /// A program that prints its own source code using the bat library
use bat::{PagingMode, PrettyPrinter, WrappingMode};
fn main() {
PrettyPrinter::new()
.header(true)
.grid(true)
.line_numbers(true)
.use_italics(true)
// The following line will be highlighted in the output:
... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/examples/list_syntaxes_and_themes.rs | examples/list_syntaxes_and_themes.rs | /// A simple program that lists all supported syntaxes and themes.
use bat::PrettyPrinter;
fn main() {
let printer = PrettyPrinter::new();
println!("Syntaxes:");
for syntax in printer.syntaxes() {
println!("- {} ({})", syntax.name, syntax.file_extensions.join(", "));
}
println!();
pr... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/examples/simple.rs | examples/simple.rs | /// A simple program that prints its own source code using the bat library
use bat::PrettyPrinter;
fn main() {
PrettyPrinter::new().input_file(file!()).print().unwrap();
}
| rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/examples/yaml.rs | examples/yaml.rs | /// A program that serializes a Rust structure to YAML and pretty-prints the result
use bat::{Input, PrettyPrinter};
use serde::Serialize;
#[derive(Serialize)]
struct Person {
name: String,
height: f64,
adult: bool,
children: Vec<Person>,
}
fn main() {
let person = Person {
name: String::f... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/examples/buffer.rs | examples/buffer.rs | use bat::{
assets::HighlightingAssets, config::Config, controller::Controller, output::OutputHandle, Input,
};
fn main() {
let mut buffer = String::new();
let config = Config {
colored_output: true,
..Default::default()
};
let assets = HighlightingAssets::from_binary();
let cont... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
sharkdp/bat | https://github.com/sharkdp/bat/blob/4e84e838a32e3b326a3d1f9e2cd4c879597ad74d/examples/cat.rs | examples/cat.rs | /// A very simple colorized `cat` clone, using `bat` as a library.
/// See `src/bin/bat` for the full `bat` application.
use bat::PrettyPrinter;
fn main() {
PrettyPrinter::new()
.header(true)
.grid(true)
.line_numbers(true)
.input_files(std::env::args_os().skip(1))
.print()
... | rust | Apache-2.0 | 4e84e838a32e3b326a3d1f9e2cd4c879597ad74d | 2026-01-04T15:31:58.743241Z | false |
rust-unofficial/awesome-rust | https://github.com/rust-unofficial/awesome-rust/blob/87566de6df053370ed1fe6f0baa242a2b96311c8/src/main.rs | src/main.rs | #![deny(warnings)]
use anyhow::{format_err, Result};
use chrono::{DateTime, Duration, Local};
use diffy::create_patch;
use futures::future::{select_all, BoxFuture, FutureExt};
use lazy_static::lazy_static;
use log::{debug, info, warn};
use pulldown_cmark::{Event, Parser, Tag};
use regex::Regex;
use reqwest::{header, r... | rust | CC0-1.0 | 87566de6df053370ed1fe6f0baa242a2b96311c8 | 2026-01-04T15:31:59.375418Z | true |
rust-unofficial/awesome-rust | https://github.com/rust-unofficial/awesome-rust/blob/87566de6df053370ed1fe6f0baa242a2b96311c8/src/bin/hacktoberfest.rs | src/bin/hacktoberfest.rs | // Helper tool to dump all repos in awesome-rust that are tagged with "hacktoberfest"
use anyhow::{format_err, Result};
use chrono::{DateTime, Duration, Local};
use futures::future::{select_all, BoxFuture, FutureExt};
use lazy_static::lazy_static;
use log::{debug, warn};
use pulldown_cmark::{Event, Parser, Tag};
use r... | rust | CC0-1.0 | 87566de6df053370ed1fe6f0baa242a2b96311c8 | 2026-01-04T15:31:59.375418Z | false |
rust-unofficial/awesome-rust | https://github.com/rust-unofficial/awesome-rust/blob/87566de6df053370ed1fe6f0baa242a2b96311c8/src/bin/cleanup.rs | src/bin/cleanup.rs | // Cleans up `README.md`
// Usage: cargo run --bin cleanup
use std::fs;
use std::fs::File;
use std::io::Read;
fn fix_dashes(lines: Vec<String>) -> Vec<String> {
let mut fixed_lines: Vec<String> = Vec::with_capacity(lines.len());
let mut within_content = false;
for line in lines {
if within_conte... | rust | CC0-1.0 | 87566de6df053370ed1fe6f0baa242a2b96311c8 | 2026-01-04T15:31:59.375418Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/build.rs | build.rs | use std::fs::{self, File};
use std::io;
use std::io::Write;
use shadow_rs::SdResult;
fn main() -> SdResult<()> {
shadow_rs::ShadowBuilder::builder()
.hook(gen_presets_hook)
.build()?;
#[cfg(windows)]
{
let mut res = winres::WindowsResource::new();
res.set_manifest_file("st... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/config.rs | src/config.rs | use crate::configs::Palette;
use crate::context::Context;
use crate::serde_utils::{ValueDeserializer, ValueRef};
use crate::utils;
use nu_ansi_term::Color;
use serde::{
Deserialize, Deserializer, Serialize, de::Error as SerdeError, de::value::Error as ValueError,
};
use std::borrow::Cow;
use std::clone::Clone;
us... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | true |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/lib.rs | src/lib.rs | #![warn(clippy::disallowed_methods)]
#[macro_use]
extern crate shadow_rs;
use std::thread::available_parallelism;
shadow!(shadow);
// Lib is present to allow for benchmarking
pub mod bug_report;
pub mod config;
pub mod configs;
pub mod configure;
pub mod context;
pub mod context_env;
pub mod formatter;
pub mod init... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/logger.rs | src/logger.rs | use crate::utils;
use log::{Level, LevelFilter, Metadata, Record};
use nu_ansi_term::Color;
use std::sync::OnceLock;
use std::{
cmp,
collections::HashSet,
env,
fs::{self, File, OpenOptions},
io::Write,
path::{Path, PathBuf},
sync::{Mutex, RwLock},
};
pub struct StarshipLogger {
log_file... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/module.rs | src/module.rs | use crate::segment;
use crate::segment::{FillSegment, Segment};
use nu_ansi_term::{AnsiString, AnsiStrings, Style as AnsiStyle};
use std::fmt;
use std::time::Duration;
// List of all modules
// Default ordering is handled in configs/starship_root.rs
pub const ALL_MODULES: &[&str] = &[
"aws",
"azure",
#[cfg... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/bug_report.rs | src/bug_report.rs | use crate::shadow;
use crate::utils::{self, DEFAULT_COMMAND_TIMEOUT_MS, exec_cmd};
use nu_ansi_term::Style;
use std::fs;
use std::path::PathBuf;
use std::time::Duration;
pub fn create() {
println!("{}\n", shadow::VERSION.trim());
let os_info = os_info::get();
let environment = Environment {
os_ty... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/utils.rs | src/utils.rs | use process_control::{ChildExt, Control};
use std::ffi::OsStr;
use std::fmt::Debug;
use std::fs::read_to_string;
use std::io::{Error, ErrorKind, Result};
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::time::{Duration, Instant};
use crate::context::Context;
use crate::context::Shell;
/// ... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | true |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/context_env.rs | src/context_env.rs | #[cfg(test)]
use std::collections::HashMap;
#[cfg(not(test))]
use std::env;
use std::ffi::OsString;
#[derive(Default)]
pub struct Env<'a> {
/// A `HashMap` of environment variable mocks
#[cfg(test)]
pub env: HashMap<&'a str, String>,
#[cfg(not(test))]
_marker: std::marker::PhantomData<&'a ()>,
}
... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/main.rs | src/main.rs | #![warn(clippy::disallowed_methods)]
use clap::crate_authors;
use std::io;
use std::path::PathBuf;
use std::time::SystemTime;
use clap::{CommandFactory, Parser, Subcommand, ValueEnum};
use clap_complete::generate;
use rand::Rng;
use starship::context::{Context, Properties, Target};
use starship::module::ALL_MODULES;
... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/context.rs | src/context.rs | use crate::config::{ModuleConfig, StarshipConfig};
use crate::configs::StarshipRootConfig;
use crate::context_env::Env;
use crate::module::Module;
use crate::utils::{CommandOutput, PathExt, create_command, exec_timeout, read_file};
use crate::modules;
use crate::utils;
use clap::Parser;
use gix::{
Repository, Thre... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | true |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/configure.rs | src/configure.rs | use std::fmt::Write as _;
use std::process;
use std::process::Stdio;
use std::str::FromStr;
use crate::config::ModuleConfig;
use crate::config::StarshipConfig;
use crate::configs::PROMPT_ORDER;
use crate::context::Context;
use crate::utils;
use std::fs::File;
use std::io::Write;
use toml_edit::DocumentMut;
#[cfg(not(... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/segment.rs | src/segment.rs | use crate::{
config::Style,
print::{Grapheme, UnicodeWidthGraphemes},
};
use nu_ansi_term::{AnsiString, Style as AnsiStyle};
use unicode_segmentation::UnicodeSegmentation;
/// Type that holds text with an associated style
#[derive(Clone)]
pub struct TextSegment {
/// The segment's style. If None, will inhe... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/serde_utils.rs | src/serde_utils.rs | use crate::module::ALL_MODULES;
use serde::de::{
Deserializer, Error, IntoDeserializer, Visitor,
value::{Error as ValueError, MapDeserializer, SeqDeserializer},
};
use std::{cmp::Ordering, fmt};
use toml::Value;
/// A `toml::Value` that borrows its contents instead of owning them.
#[derive(Debug, Clone, Copy)]... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/print.rs | src/print.rs | use clap::{ValueEnum, builder::PossibleValue};
use nu_ansi_term::AnsiStrings;
use rayon::prelude::*;
use regex::Regex;
use std::collections::BTreeSet;
use std::fmt::{Debug, Write as FmtWrite};
use std::io::{self, Write};
use std::path::PathBuf;
use std::sync::OnceLock;
use std::time::Duration;
use terminal_size::termin... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/formatter/version.rs | src/formatter/version.rs | use super::StringFormatter;
use super::string_formatter::StringFormatterError;
use crate::segment;
use std::ops::Deref;
use std::sync::LazyLock;
use versions::Versioning;
pub struct VersionFormatter<'a> {
formatter: StringFormatter<'a>,
}
impl<'a> VersionFormatter<'a> {
/// Creates an instance of a `VersionFo... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/formatter/parser.rs | src/formatter/parser.rs | // Can't rename internal Pest names
#![allow(clippy::upper_case_acronyms)]
use pest::{Parser, error::Error, iterators::Pair};
use pest_derive::*;
use super::model::*;
#[derive(Parser)]
#[grammar = "formatter/spec.pest"]
struct IdentParser;
fn parse_value(value: Pair<Rule>) -> FormatElement {
match value.as_rule... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/formatter/model.rs | src/formatter/model.rs | use std::borrow::Cow;
use std::collections::BTreeSet;
/// Type that holds a number of variables of type `T`
pub trait VariableHolder<T> {
fn get_variables(&self) -> BTreeSet<T>;
}
/// Type that holds a number of style variables of type `T`
pub trait StyleVariableHolder<T> {
fn get_style_variables(&self) -> BT... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/formatter/mod.rs | src/formatter/mod.rs | pub mod model;
mod parser;
pub mod string_formatter;
mod version;
pub use model::{StyleVariableHolder, VariableHolder};
pub use string_formatter::StringFormatter;
pub use version::VersionFormatter;
| rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/formatter/string_formatter.rs | src/formatter/string_formatter.rs | use pest::error::Error as PestError;
use rayon::prelude::*;
use std::borrow::Cow;
use std::collections::{BTreeMap, BTreeSet};
use std::error::Error;
use std::fmt;
use crate::config::{Style, parse_style_string};
use crate::context::{Context, Shell};
use crate::segment::Segment;
use super::model::*;
use super::parser::... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/test/mod.rs | src/test/mod.rs | use crate::context::{Context, Properties, Shell, Target};
use crate::context_env::Env;
use crate::logger::StarshipLogger;
use crate::{
config::StarshipConfig,
utils::{CommandOutput, create_command},
};
use log::{Level, LevelFilter};
use std::fs;
use std::io;
use std::path::{Path, PathBuf};
use std::sync::LazyLo... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/nodejs.rs | src/modules/nodejs.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::nodejs::NodejsConfig;
use crate::formatter::{StringFormatter, VersionFormatter};
use regex::Regex;
use semver::Version;
use semver::VersionReq;
use serde_json as json;
use std::ops::Deref;
use std::sync::LazyLock;
/// Creates a module with the current N... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/golang.rs | src/modules/golang.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::go::GoConfig;
use crate::formatter::StringFormatter;
use crate::formatter::VersionFormatter;
use regex::Regex;
use semver::Version;
use semver::VersionReq;
use std::ops::Deref;
use std::sync::LazyLock;
/// Creates a module with the current Go version
pu... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/jobs.rs | src/modules/jobs.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::jobs::JobsConfig;
use crate::formatter::StringFormatter;
/// Creates a segment to show if there are any active jobs running
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("jobs");
let config = ... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/username.rs | src/modules/username.rs | use super::{Context, Detected, Module, ModuleConfig};
use crate::configs::username::UsernameConfig;
use crate::formatter::StringFormatter;
#[cfg(not(target_os = "windows"))]
const USERNAME_ENV_VAR: &str = "USER";
#[cfg(target_os = "windows")]
const USERNAME_ENV_VAR: &str = "USERNAME";
/// Creates a module with the ... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/perl.rs | src/modules/perl.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::perl::PerlConfig;
use crate::formatter::StringFormatter;
use crate::formatter::VersionFormatter;
/// Creates a module with the current perl version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("p... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/gradle.rs | src/modules/gradle.rs | use std::path::Path;
use crate::{
config::ModuleConfig,
configs::gradle::GradleConfig,
context::Context,
formatter::{StringFormatter, VersionFormatter},
module::Module,
utils,
};
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("gradle");
... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/ruby.rs | src/modules/ruby.rs | use regex::Regex;
use super::{Context, Module, ModuleConfig};
use crate::configs::ruby::RubyConfig;
use crate::formatter::{StringFormatter, VersionFormatter};
/// Creates a module with the current Ruby version
///
/// Will display the Ruby version if any of the following criteria are met:
/// - Current directory... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/rust.rs | src/modules/rust.rs | use std::fs;
use std::path::{Path, PathBuf};
use std::process::Output;
use serde::Deserialize;
use std::collections::HashMap;
use super::{Context, Module, ModuleConfig};
use crate::configs::rust::RustConfig;
use crate::formatter::{StringFormatter, VersionFormatter};
use crate::utils::create_command;
use home::rustup... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/aws.rs | src/modules/aws.rs | use std::cell::OnceCell;
use std::collections::HashMap;
use std::path::PathBuf;
use std::str::FromStr;
use chrono::DateTime;
use ini::Ini;
use serde_json as json;
use sha1::{Digest, Sha1};
use super::{Context, Module, ModuleConfig};
use crate::configs::aws::AwsConfig;
use crate::formatter::StringFormatter;
use crate... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | true |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/typst.rs | src/modules/typst.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::typst::TypstConfig;
use crate::formatter::{StringFormatter, VersionFormatter};
/// Creates a module with the current Typst version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("typst");
let c... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/sudo.rs | src/modules/sudo.rs | use std::env;
use super::{Context, Module, ModuleConfig};
use crate::configs::sudo::SudoConfig;
use crate::formatter::StringFormatter;
/// Creates a module with sudo credential cache status
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("sudo");
let config... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/fill.rs | src/modules/fill.rs | use super::{Context, Module};
use crate::config::{ModuleConfig, parse_style_string};
use crate::configs::fill::FillConfig;
use crate::segment::Segment;
/// Creates a module that fills the any extra space on the line.
///
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/cc.rs | src/modules/cc.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::c::{CConfig, CConfigMarker};
use crate::configs::cc::CcConfig;
use crate::configs::cpp::{CppConfig, CppConfigMarker};
use crate::formatter::StringFormatter;
use crate::formatter::VersionFormatter;
use crate::segment::Segment;
use semver::Version;
use st... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/guix_shell.rs | src/modules/guix_shell.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::guix_shell::GuixShellConfig;
use crate::formatter::StringFormatter;
/// Creates a module showing if inside a guix-shell
///
/// The module will use the `$GUIX_ENVIRONMENT` environment variable to determine if it's
/// inside a guix-shell and the name of ... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/localip.rs | src/modules/localip.rs | use super::{Context, Module};
use crate::config::ModuleConfig;
use crate::configs::localip::LocalipConfig;
use crate::formatter::StringFormatter;
use std::io::Error;
use std::net::UdpSocket;
fn get_local_ipv4() -> Result<String, Error> {
let socket = UdpSocket::bind("0.0.0.0:0")?;
socket.connect("192.0.2.0:8... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/nim.rs | src/modules/nim.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::nim::NimConfig;
use crate::formatter::StringFormatter;
use crate::formatter::VersionFormatter;
/// Creates a module with the current Nim version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("nim"... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/kotlin.rs | src/modules/kotlin.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::kotlin::KotlinConfig;
use crate::formatter::StringFormatter;
use crate::formatter::VersionFormatter;
use crate::utils::get_command_string_output;
use regex::Regex;
const KOTLIN_VERSION_PATTERN: &str = "(?P<version>[\\d\\.]+[\\d\\.]+[\\d\\.]+)";
/// Crea... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/daml.rs | src/modules/daml.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::daml::DamlConfig;
use crate::formatter::{StringFormatter, VersionFormatter};
const DAML_SDK_VERSION: &str = "sdk-version";
const DAML_SDK_VERSION_ENV: &str = "DAML_SDK_VERSION";
const DAML_YAML: &str = "daml.yaml";
/// Creates a module with the current D... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/cmd_duration.rs | src/modules/cmd_duration.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::cmd_duration::CmdDurationConfig;
use crate::formatter::StringFormatter;
use crate::utils::render_time;
/// Outputs the time it took the last command to execute
///
/// Will only print if last command took more than a certain amount of time to
/// execute... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/env_var.rs | src/modules/env_var.rs | use super::{Context, Module};
use std::borrow::Cow;
use crate::config::ModuleConfig;
use crate::configs::env_var::EnvVarConfig;
use crate::formatter::StringFormatter;
/// Creates a module with the value of the chosen environment variable
///
/// Will display the environment variable's value if all of the following cr... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/openstack.rs | src/modules/openstack.rs | use yaml_rust2::YamlLoader;
use super::{Context, Module, ModuleConfig};
use crate::configs::openstack::OspConfig;
use crate::formatter::StringFormatter;
use crate::utils;
type Cloud = String;
type Project = String;
fn get_osp_project_from_config(context: &Context, osp_cloud: &str) -> Option<Project> {
// Attemp... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/shlvl.rs | src/modules/shlvl.rs | use super::{Context, Module};
use crate::config::ModuleConfig;
use crate::configs::shlvl::ShLvlConfig;
use crate::formatter::StringFormatter;
use std::borrow::Cow;
use std::convert::TryInto;
const SHLVL_ENV_VAR: &str = "SHLVL";
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let props = &context.... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/direnv.rs | src/modules/direnv.rs | use std::borrow::Cow;
use std::path::PathBuf;
use std::str::FromStr;
use super::{Context, Module, ModuleConfig};
use crate::configs::direnv::DirenvConfig;
use crate::formatter::StringFormatter;
use serde::Deserialize;
/// Creates a module with the current direnv rc
pub fn module<'a>(context: &'a Context) -> Option<... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/mojo.rs | src/modules/mojo.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::mojo::MojoConfig;
use crate::formatter::StringFormatter;
use std::sync::LazyLock;
/// Creates a module with the current Mojo version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("mojo");
let... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/fennel.rs | src/modules/fennel.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::fennel::FennelConfig;
use crate::formatter::{StringFormatter, VersionFormatter};
use crate::utils::get_command_string_output;
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("fennel");
let confi... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/vagrant.rs | src/modules/vagrant.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::vagrant::VagrantConfig;
use crate::formatter::StringFormatter;
use crate::formatter::VersionFormatter;
/// Creates a module with the current Vagrant version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/line_break.rs | src/modules/line_break.rs | use super::{Context, Module};
use crate::segment::Segment;
/// Creates a module for the line break
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("line_break");
module.set_segments(vec![Segment::LineTerm]);
Some(module)
}
#[cfg(test)]
mod test {
u... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/git_status.rs | src/modules/git_status.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::git_status::GitStatusConfig;
use crate::formatter::StringFormatter;
use crate::segment::Segment;
use crate::{context, num_configured_starship_threads, num_rayon_threads};
use gix::bstr::ByteVec;
use gix::status::Submodule;
use regex::Regex;
use std::path::... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | true |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/elm.rs | src/modules/elm.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::elm::ElmConfig;
use crate::formatter::StringFormatter;
use crate::formatter::VersionFormatter;
/// Creates a module with the current Elm version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("elm"... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/dart.rs | src/modules/dart.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::dart::DartConfig;
use crate::formatter::StringFormatter;
use crate::formatter::VersionFormatter;
use crate::utils::get_command_string_output;
/// Creates a module with the current Dart version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>>... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/gleam.rs | src/modules/gleam.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::gleam::GleamConfig;
use crate::formatter::StringFormatter;
use crate::formatter::VersionFormatter;
/// Creates a module with the current Gleam version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/scala.rs | src/modules/scala.rs | use crate::configs::scala::ScalaConfig;
use crate::formatter::StringFormatter;
use super::{Context, Module, ModuleConfig};
use crate::formatter::VersionFormatter;
use crate::utils::get_command_string_output;
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("scala... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/julia.rs | src/modules/julia.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::julia::JuliaConfig;
use crate::formatter::StringFormatter;
use crate::formatter::VersionFormatter;
/// Creates a module with the current Julia version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/vlang.rs | src/modules/vlang.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::v::VConfig;
use crate::formatter::{StringFormatter, VersionFormatter};
/// Creates a module with the current V version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("vlang");
let config = VCon... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/purescript.rs | src/modules/purescript.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::purescript::PureScriptConfig;
use crate::formatter::StringFormatter;
use crate::formatter::VersionFormatter;
/// Creates a module with the current PureScript version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = con... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/vcsh.rs | src/modules/vcsh.rs | use super::{Context, Module};
use crate::config::ModuleConfig;
use crate::configs::vcsh::VcshConfig;
use crate::formatter::StringFormatter;
/// Creates a module that displays VCSH repository currently in use
///
/// Will display the name of the current VCSH repository if one is active.
pub fn module<'a>(context: &'a ... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/red.rs | src/modules/red.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::red::RedConfig;
use crate::formatter::{StringFormatter, VersionFormatter};
/// Creates a module with the current Red version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("red");
let config =... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/os.rs | src/modules/os.rs | use super::{Context, Module, ModuleConfig};
use crate::configs::os::OSConfig;
use crate::formatter::StringFormatter;
/// Creates a module with the current operating system
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("os");
let config: OSConfig = OSConfig... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/c.rs | src/modules/c.rs | use super::{Context, Module};
use crate::modules::cc::{Lang, module as cc_module};
/// Creates a module with the current C compiler and version
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
cc_module(context, Lang::C)
}
#[cfg(test)]
mod tests {
use crate::{test::ModuleRenderer, utils::Comman... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/container.rs | src/modules/container.rs | use super::{Context, Module};
#[cfg(not(target_os = "linux"))]
pub fn module<'a>(_context: &'a Context) -> Option<Module<'a>> {
None
}
#[cfg(target_os = "linux")]
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
use super::ModuleConfig;
use crate::configs::container::ContainerConfig;
us... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/azure.rs | src/modules/azure.rs | use serde::{Deserialize, Serialize};
use std::fs;
use std::path::PathBuf;
use super::{Context, Module, ModuleConfig};
use crate::configs::azure::AzureConfig;
use crate::formatter::StringFormatter;
#[derive(Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
struct AzureProfile {
installation_id: S... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/status.rs | src/modules/status.rs | use std::string::ToString;
use super::{Context, Module, ModuleConfig};
use crate::configs::status::StatusConfig;
use crate::formatter::{StringFormatter, string_formatter::StringFormatterError};
use crate::segment::Segment;
type ExitCode = i32;
type SignalNumber = u32;
#[derive(PartialEq)]
enum PipeStatusStatus<'a> {... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/hostname.rs | src/modules/hostname.rs | use super::{Context, Module};
use crate::config::ModuleConfig;
use crate::configs::hostname::HostnameConfig;
use crate::formatter::StringFormatter;
use whoami::hostname;
/// Creates a module with the system hostname
///
/// Will display the hostname if all of the following criteria are met:
/// - `hostname.disab... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/hg_state.rs | src/modules/hg_state.rs | use std::fs::File;
use std::io::{self, Read};
use std::path::Path;
use super::{Context, Module, ModuleConfig};
use crate::configs::hg_state::HgStateConfig;
use crate::formatter::StringFormatter;
/// Creates a module with the state of hg repository at the current directory
///
/// During a mercurial operation it will ... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
starship/starship | https://github.com/starship/starship/blob/8a69666084d248b8fd76b6c54f38aea12abce6e3/src/modules/time.rs | src/modules/time.rs | use chrono::{DateTime, FixedOffset, Local, NaiveTime, Utc};
use super::{Context, Module, ModuleConfig};
use crate::configs::time::TimeConfig;
use crate::formatter::StringFormatter;
/// Outputs the current time
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("tim... | rust | ISC | 8a69666084d248b8fd76b6c54f38aea12abce6e3 | 2026-01-04T15:31:59.388295Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.