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
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/parallel.rs
tests/parallel.rs
use super::*; #[test] #[ignore] fn prior_dependencies_run_in_parallel() { let start = Instant::now(); Test::new() .justfile( " [parallel] foo: a b c d e a: sleep 1 b: sleep 1 c: sleep 1 d: sleep 1 e: ...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/directories.rs
tests/directories.rs
use super::*; #[test] fn cache_directory() { Test::new() .justfile("x := cache_directory()") .args(["--evaluate", "x"]) .stdout(dirs::cache_dir().unwrap_or_default().to_string_lossy()) .run(); } #[test] fn config_directory() { Test::new() .justfile("x := config_directory()") .args(["--eval...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/newline_escape.rs
tests/newline_escape.rs
use super::*; #[test] fn newline_escape_deps() { Test::new() .justfile( " default: a \\ b \\ c a: echo a b: echo b c: echo c ", ) .stdout("a\nb\nc\n") .stderr("echo a\necho b\necho c\n") .run(); } #[test] fn ...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/changelog.rs
tests/changelog.rs
use super::*; #[test] fn print_changelog() { Test::new() .args(["--changelog"]) .stdout(fs::read_to_string("CHANGELOG.md").unwrap()) .run(); }
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/scope.rs
tests/scope.rs
use super::*; #[test] fn dependencies_in_submodules_run_with_submodule_scope() { Test::new() .write("bar.just", "x := 'X'\nbar a=x:\n echo {{ a }} {{ x }}") .justfile( " mod bar foo: bar::bar ", ) .stdout("X X\n") .stderr("echo X X\n") .run(); } #[test] fn aliase...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/undefined_variables.rs
tests/undefined_variables.rs
use super::*; #[test] fn parameter_default_unknown_variable_in_expression() { Test::new() .justfile("foo a=(b+''):") .stderr( " error: Variable `b` not defined ——▶ justfile:1:8 │ 1 │ foo a=(b+''): │ ^ ", ) .status(EXIT_FAILURE) .run(); } #[test...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/summary.rs
tests/summary.rs
use super::*; #[test] fn summary() { Test::new() .arg("--summary") .justfile( "b: a a: d: c c: b _z: _y _y: ", ) .stdout("a b c d\n") .run(); } #[test] fn summary_sorted() { Test::new() .arg("--summary") .justfile( " b: c: a: ", ) .stdout("a b c\n") .run(); } #...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/shell_expansion.rs
tests/shell_expansion.rs
use super::*; #[test] fn strings_are_shell_expanded() { Test::new() .justfile( " x := x'$JUST_TEST_VARIABLE' ", ) .env("JUST_TEST_VARIABLE", "FOO") .args(["--evaluate", "x"]) .stdout("FOO") .run(); } #[test] fn shell_expanded_strings_must_not_have_whitespace() { Test::n...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/windows.rs
tests/windows.rs
use super::*; #[test] fn bare_bash_in_shebang() { Test::new() .justfile( " default: #!bash echo FOO ", ) .stdout("FOO\n") .run(); }
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/options.rs
tests/options.rs
use super::*; #[test] fn long_options_may_not_be_empty() { Test::new() .justfile( " [arg('bar', long='')] @foo bar: echo bar={{bar}} ", ) .stderr( " error: Option name for parameter `bar` is empty ——▶ justfile:1:18 │ 1 │ [arg(...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/format.rs
tests/format.rs
use super::*; #[test] fn unstable_not_passed() { Test::new() .arg("--fmt") .justfile("") .stderr_regex("error: The `--fmt` command is currently unstable..*") .status(EXIT_FAILURE) .run(); } #[test] fn check_without_fmt() { Test::new() .arg("--check") .justfile("") .stderr_regex( ...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/run.rs
tests/run.rs
use super::*; #[test] fn dont_run_duplicate_recipes() { Test::new() .justfile( " @foo: echo foo ", ) .args(["foo", "foo"]) .stdout("foo\n") .run(); } #[test] fn one_flag_only_allows_one_invocation() { Test::new() .justfile( " @foo: echo...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/alias.rs
tests/alias.rs
use super::*; #[test] fn alias_nested_module() { Test::new() .write("foo.just", "mod bar\nbaz: \n @echo FOO") .write("bar.just", "baz:\n @echo BAZ") .justfile( " mod foo alias b := foo::bar::baz baz: @echo 'HERE' ", ) .arg("b") .stdout("BAZ\n") .run...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/init.rs
tests/init.rs
use {super::*, just::INIT_JUSTFILE}; #[test] fn current_dir() { let tmp = tempdir(); let output = Command::new(executable_path("just")) .current_dir(tmp.path()) .arg("--init") .output() .unwrap(); assert!(output.status.success()); assert_eq!( fs::read_to_string(tmp.path().join("justfile"...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/completions.rs
tests/completions.rs
use super::*; #[test] #[cfg(target_os = "linux")] fn bash() { let output = Command::new(executable_path("just")) .args(["--completions", "bash"]) .output() .unwrap(); assert!(output.status.success()); let script = str::from_utf8(&output.stdout).unwrap(); let tempdir = tempdir(); let path = te...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/shebang.rs
tests/shebang.rs
use super::*; #[cfg(windows)] #[test] fn powershell() { Test::new() .justfile( r#" default: #!powershell Write-Host Hello-World "#, ) .stdout("Hello-World\n") .run(); } #[cfg(windows)] #[test] fn powershell_exe() { Test::new() .justfile( r#" default: #!powershell.exe Write...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/attributes.rs
tests/attributes.rs
use super::*; #[test] fn all() { Test::new() .justfile( " [macos] [linux] [openbsd] [unix] [windows] [no-exit-message] foo: exit 1 ", ) .stderr("exit 1\n") .status(1) .run(); } #[test] fn duplicate_attributes_are_disallowed() { Test::...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/arg_attribute.rs
tests/arg_attribute.rs
use super::*; #[test] fn pattern_match() { Test::new() .justfile( " [arg('bar', pattern='BAR')] foo bar: ", ) .args(["foo", "BAR"]) .run(); } #[test] fn pattern_mismatch() { Test::new() .justfile( " [arg('bar', pattern='BAR')] foo bar: ",...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/groups.rs
tests/groups.rs
use super::*; #[test] fn list_with_groups() { Test::new() .justfile( " [group('alpha')] a: # Doc comment [group('alpha')] [group('beta')] b: c: [group('multi word group')] d: [group('alpha')] e: [group('beta')] ...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/show.rs
tests/show.rs
use super::*; #[test] fn show() { Test::new() .arg("--show") .arg("recipe") .justfile( r#"hello := "foo" bar := hello + hello recipe: echo {{hello + "bar" + bar}}"#, ) .stdout( r#" recipe: echo {{ hello + "bar" + bar }} "#, ) .run(); } #[test] fn alias_show() {...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/edit.rs
tests/edit.rs
use super::*; const JUSTFILE: &str = "Yooooooo, hopefully this never becomes valid syntax."; /// Test that --edit doesn't require a valid justfile #[test] fn invalid_justfile() { let tmp = temptree! { justfile: JUSTFILE, }; let output = Command::new(executable_path("just")) .current_dir(tmp.path()) ...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/tempdir.rs
tests/tempdir.rs
use super::*; pub(crate) fn tempdir() -> TempDir { let mut builder = tempfile::Builder::new(); builder.prefix("just-test-tempdir"); if let Some(runtime_dir) = dirs::runtime_dir() { let path = runtime_dir.join("just"); fs::create_dir_all(&path).unwrap(); builder.tempdir_in(path) } else { build...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/script.rs
tests/script.rs
use super::*; #[test] fn runs_with_command() { Test::new() .justfile( " [script('cat')] foo: FOO ", ) .stdout( " FOO ", ) .run(); } #[test] fn no_arguments() { Test::new() .justfile( " [script('sh')] foo: ...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/constants.rs
tests/constants.rs
use super::*; #[test] fn constants_are_defined() { assert_eval_eq("HEX", "0123456789abcdef"); } #[test] fn constants_can_have_different_values_on_windows() { assert_eval_eq("PATH_SEP", if cfg!(windows) { "\\" } else { "/" }); assert_eval_eq("PATH_VAR_SEP", if cfg!(windows) { ";" } else { ":" }); } #[test] fn c...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/line_prefixes.rs
tests/line_prefixes.rs
use super::*; #[test] fn infallible_after_quiet() { Test::new() .justfile( " foo: @-exit 1 ", ) .run(); } #[test] fn quiet_after_infallible() { Test::new() .justfile( " foo: -@exit 1 ", ) .run(); }
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/export.rs
tests/export.rs
use super::*; #[test] fn success() { Test::new() .justfile( r#" export FOO := "a" baz := "c" export BAR := "b" export ABC := FOO + BAR + baz wut: echo $FOO $BAR $ABC "#, ) .stdout("a b abc\n") .stderr("echo $FOO $BAR $ABC\n") .run(); } #[test] fn parameter() { Test::new() .justfil...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/request.rs
tests/request.rs
use super::*; #[test] fn environment_variable_set() { Test::new() .justfile( r#" export BAR := 'baz' @foo: '{{just_executable()}}' --request '{"environment-variable": "BAR"}' "#, ) .response(Response::EnvironmentVariable(Some("baz".into()))) .run(); } #[test] fn enviro...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/conditional.rs
tests/conditional.rs
use super::*; #[test] fn then_branch_unevaluated() { Test::new() .justfile( " foo: echo {{ if 'a' == 'b' { `exit 1` } else { 'otherwise' } }} ", ) .stdout("otherwise\n") .stderr("echo otherwise\n") .run(); } #[test] fn otherwise_branch_unevaluated() { Test::new() .justfil...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/interpolation.rs
tests/interpolation.rs
use super::*; #[test] fn closing_curly_brace_can_abut_interpolation_close() { Test::new() .justfile( " foo: echo {{if 'a' == 'b' { 'c' } else { 'd' }}} ", ) .stderr("echo d\n") .stdout("d\n") .run(); } #[test] fn eol_with_continuation_in_interpolation() { Test::ne...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/quote.rs
tests/quote.rs
use super::*; #[test] fn single_quotes_are_prepended_and_appended() { Test::new() .justfile( " x := quote('abc') ", ) .args(["--evaluate", "x"]) .stdout("'abc'") .run(); } #[test] fn quotes_are_escaped() { Test::new() .justfile( r#" x := quote("'") "#, )...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/fallback.rs
tests/fallback.rs
use super::*; #[test] fn fallback_from_subdir_bugfix() { Test::new() .write( "sub/justfile", unindent( " set fallback @default: echo foo ", ), ) .args(["sub/default"]) .stdout("foo\n") .run(); } #[test] fn fallback_from_subdir_message() ...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/dependencies.rs
tests/dependencies.rs
use super::*; #[test] fn recipe_doubly_nested_module_dependencies() { Test::new() .write("foo.just", "mod bar\nbaz: \n @echo FOO") .write("bar.just", "baz:\n @echo BAZ") .justfile( " mod foo baz: foo::bar::baz ", ) .arg("baz") .stdout("BAZ\n") .run(); } #[test] f...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/working_directory.rs
tests/working_directory.rs
use super::*; const JUSTFILE: &str = r#" foo := `cat data` linewise bar=`cat data`: shebang echo expression: {{foo}} echo default: {{bar}} echo linewise: `cat data` shebang: #!/usr/bin/env sh echo "shebang:" `cat data` "#; const DATA: &str = "OK"; const WANT: &str = "shebang: OK\nexpression: OK\ndefault:...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/allow_missing.rs
tests/allow_missing.rs
use super::*; #[test] fn allow_missing_recipes_in_run_invocation() { Test::new() .arg("foo") .stderr("error: Justfile does not contain recipe `foo`\n") .status(EXIT_FAILURE) .run(); Test::new().args(["--allow-missing", "foo"]).run(); } #[test] fn allow_missing_modules_in_run_invocation() { Test...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/private.rs
tests/private.rs
use super::*; #[test] fn private_attribute_for_recipe() { Test::new() .justfile( " [private] foo: ", ) .args(["--list"]) .stdout( " Available recipes: ", ) .run(); } #[test] fn private_attribute_for_alias() { Test::new() .justfile( " ...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/confirm.rs
tests/confirm.rs
use super::*; #[test] fn confirm_recipe_arg() { Test::new() .arg("--yes") .justfile( " [confirm] requires_confirmation: echo confirmed ", ) .stderr("echo confirmed\n") .stdout("confirmed\n") .run(); } #[test] fn recipe_with_confirm_recipe_dependency_...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/recursion_limit.rs
tests/recursion_limit.rs
use super::*; #[test] fn bugfix() { let mut justfile = String::from("foo: (x "); for _ in 0..500 { justfile.push('('); } Test::new() .justfile(&justfile) .stderr(RECURSION_LIMIT_REACHED) .status(EXIT_FAILURE) .run(); } #[cfg(not(windows))] const RECURSION_LIMIT_REACHED: &str = " error: Par...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/assert_stdout.rs
tests/assert_stdout.rs
use super::*; pub(crate) fn assert_stdout(output: &std::process::Output, stdout: &str) { assert_success(output); assert_eq!(String::from_utf8_lossy(&output.stdout), stdout); }
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/logical_operators.rs
tests/logical_operators.rs
use super::*; #[track_caller] fn evaluate(expression: &str, expected: &str) { Test::new() .justfile(format!("x := {expression}")) .env("JUST_UNSTABLE", "1") .args(["--evaluate", "x"]) .stdout(expected) .run(); } #[test] fn logical_operators_are_unstable() { Test::new() .justfile("x := 'foo...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/assignment.rs
tests/assignment.rs
use super::*; #[test] fn set_export_parse_error() { Test::new() .justfile( " set export := fals ", ) .stderr( " error: Expected keyword `true` or `false` but found identifier `fals` ——▶ justfile:1:15 │ 1 │ set export := fals │ ^^^^ ", ) ....
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/assertions.rs
tests/assertions.rs
use super::*; #[test] fn assert_pass() { Test::new() .justfile( " foo: {{ assert('a' == 'a', 'error message') }} ", ) .run(); } #[test] fn assert_fail() { Test::new() .justfile( " foo: {{ assert('a' != 'a', 'error message') }} ", ) ...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/choose.rs
tests/choose.rs
use super::*; #[test] fn env() { Test::new() .arg("--choose") .env("JUST_CHOOSER", "head -n1") .justfile( " foo: echo foo bar: echo bar ", ) .stderr("echo bar\n") .stdout("bar\n") .run(); } #[test] fn chooser() { Test::new() .arg("--...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/timestamps.rs
tests/timestamps.rs
use super::*; #[test] fn print_timestamps() { Test::new() .justfile( " recipe: echo 'one' ", ) .arg("--timestamp") .stderr_regex(concat!(r"\[\d\d:\d\d:\d\d\] echo 'one'", "\n")) .stdout("one\n") .run(); } #[test] fn print_timestamps_with_format_string() { Test::new()...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/examples.rs
tests/examples.rs
use super::*; #[test] fn examples() { for result in fs::read_dir("examples").unwrap() { let entry = result.unwrap(); let path = entry.path(); println!("Parsing `{}`…", path.display()); let output = Command::new(executable_path("just")) .arg("--justfile") .arg(&path) .arg("--dump")...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/signals.rs
tests/signals.rs
use {super::*, nix::sys::signal::Signal, nix::unistd::Pid, std::process::Child}; fn kill(child: &Child, signal: Signal) { nix::sys::signal::kill(Pid::from_raw(child.id().try_into().unwrap()), signal).unwrap(); } fn interrupt_test(arguments: &[&str], justfile: &str) { let tmp = tempdir(); let mut justfile_path =...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/tests/usage.rs
tests/usage.rs
use super::*; #[test] fn usage() { Test::new() .justfile("mod bar") .write( "bar.just", " [arg('a', short='a')] [arg('b', pattern='123|789', help='hello')] [arg('d', short='d', long='delightful')] [arg('e', short='e', pattern='abc|xyz')] [arg('f', long='f', pattern='lucky')] [arg('g', short='g', ...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/fuzz/fuzz_targets/compile.rs
fuzz/fuzz_targets/compile.rs
#![no_main] use libfuzzer_sys::fuzz_target; fuzz_target!(|src: &str| { let _ = just::fuzzing::compile(src); });
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/crates/update-contributors/src/main.rs
crates/update-contributors/src/main.rs
use { regex::{Captures, Regex}, std::{fs, process::Command, str}, }; fn author(pr: u64) -> String { eprintln!("#{pr}"); let output = Command::new("sh") .args([ "-c", &format!("gh pr view {pr} --json author | jq -r .author.login"), ]) .output() .unwrap(); assert!( output.statu...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
casey/just
https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/crates/generate-book/src/main.rs
crates/generate-book/src/main.rs
use { pulldown_cmark::{CowStr, Event, HeadingLevel, Options, Parser, Tag}, pulldown_cmark_to_cmark::cmark, std::{ collections::{BTreeMap, BTreeSet}, error::Error, fmt::Write, fs, ops::Deref, }, }; type Result<T = ()> = std::result::Result<T, Box<dyn Error>>; #[derive(Copy, Clone, Debug)] e...
rust
CC0-1.0
5732ee083a58c534804d184acbdede11d1bbaac5
2026-01-04T15:34:07.853244Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/config.rs
src/config.rs
use std::collections::HashMap; use std::path::PathBuf; use clap::parser::ValueSource; use regex::Regex; use syntect::highlighting::Style as SyntectStyle; use syntect::highlighting::Theme as SyntaxTheme; use syntect::parsing::SyntaxSet; use crate::ansi; use crate::cli; use crate::color::{self, ColorMode}; use crate::d...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/paint.rs
src/paint.rs
use std::borrow::Cow; use std::collections::HashMap; use std::io::Write; use ansi_term::ANSIString; use itertools::Itertools; use syntect::easy::HighlightLines; use syntect::highlighting::Style as SyntectStyle; use syntect::parsing::{SyntaxReference, SyntaxSet}; use crate::config::{self, delta_unreachable, Config}; u...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
true
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/parse_styles.rs
src/parse_styles.rs
use std::collections::{HashMap, HashSet}; use crate::cli; use crate::color; use crate::fatal; use crate::git_config::GitConfig; use crate::style::{self, Style}; #[derive(Debug, Clone)] enum StyleReference { Style(Style), Reference(String), } fn is_style_reference(style_string: &str) -> bool { style_strin...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/delta.rs
src/delta.rs
use std::borrow::Cow; use std::collections::HashMap; use std::io::{self, BufRead, IsTerminal, Write}; use bytelines::ByteLines; use crate::ansi; use crate::config::delta_unreachable; use crate::config::Config; use crate::config::GrepType; use crate::features; use crate::handlers::grep; use crate::handlers::hunk_heade...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/cli.rs
src/cli.rs
use std::collections::{HashMap, HashSet}; use std::ffi::OsString; use std::path::{Path, PathBuf}; use bat::assets::HighlightingAssets; use clap::error::Error; use clap::{ArgMatches, ColorChoice, CommandFactory, FromArgMatches, Parser, ValueEnum, ValueHint}; use clap_complete::Shell; use console::Term; use lazy_static:...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
true
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/minusplus.rs
src/minusplus.rs
use std::ops::{Index, IndexMut}; /// Represent data related to removed/minus and added/plus lines which /// can be indexed with [`MinusPlusIndex::{Plus`](MinusPlusIndex::Plus)`,`[`Minus}`](MinusPlusIndex::Minus). #[derive(Debug, Clone, PartialEq, Eq)] pub struct MinusPlus<T> { pub minus: T, pub plus: T, } #[d...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/wrapping.rs
src/wrapping.rs
use syntect::highlighting::Style as SyntectStyle; use unicode_segmentation::UnicodeSegmentation; use unicode_width::UnicodeWidthStr; use crate::cli; use crate::config::INLINE_SYMBOL_WIDTH_1; use crate::fatal; use crate::config::Config; use crate::delta::DiffType; use crate::delta::State; use crate::features::line_num...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
true
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/parse_style.rs
src/parse_style.rs
use bitflags::bitflags; use crate::color; use crate::config::delta_unreachable; use crate::fatal; use crate::git_config::GitConfig; use crate::style::{DecorationStyle, Style}; impl Style { /// Construct Style from style and decoration-style strings supplied on command line, together /// with defaults. A style...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/env.rs
src/env.rs
use std::env; const COLORTERM: &str = "COLORTERM"; const BAT_THEME: &str = "BAT_THEME"; const GIT_CONFIG_PARAMETERS: &str = "GIT_CONFIG_PARAMETERS"; const GIT_PREFIX: &str = "GIT_PREFIX"; const DELTA_FEATURES: &str = "DELTA_FEATURES"; const DELTA_NAVIGATE: &str = "DELTA_NAVIGATE"; const DELTA_EXPERIMENTAL_MAX_LINE_DIS...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/edits.rs
src/edits.rs
use regex::Regex; use unicode_segmentation::UnicodeSegmentation; use unicode_width::UnicodeWidthStr; use crate::align; use crate::minusplus::MinusPlus; /// Infer the edit operations responsible for the differences between a collection of old and new /// lines. A "line" is a string. An annotated line is a Vec of (op,...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
true
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/align.rs
src/align.rs
use std::cmp::max; use std::collections::VecDeque; const DELETION_COST: usize = 2; const INSERTION_COST: usize = 2; // extra cost for starting a new group of changed tokens const INITIAL_MISMATCH_PENALTY: usize = 1; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Operation { NoOp, Deletion, Insertio...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/format.rs
src/format.rs
use std::convert::{TryFrom, TryInto}; use regex::Regex; use smol_str::SmolStr; use unicode_segmentation::UnicodeSegmentation; use crate::features::side_by_side::ansifill::ODD_PAD_CHAR; #[derive(Debug, PartialEq, Eq)] pub enum Placeholder<'a> { NumberMinus, NumberPlus, Str(&'a str), } impl<'a> TryFrom<Op...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/style.rs
src/style.rs
use std::borrow::Cow; use std::fmt; use std::hash::{Hash, Hasher}; use lazy_static::lazy_static; use crate::ansi; use crate::color; use crate::git_config::GitConfig; // PERF: Avoid deriving Copy here? #[derive(Clone, Copy, PartialEq, Default)] pub struct Style { pub ansi_term_style: ansi_term::Style, pub is_...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/main.rs
src/main.rs
mod align; mod ansi; mod cli; mod color; mod colors; mod config; mod delta; mod edits; mod env; mod features; mod format; mod git_config; mod handlers; mod minusplus; mod options; mod paint; mod parse_style; mod parse_styles; mod style; mod utils; mod wrapping; mod subcommands; mod tests; use std::ffi::{OsStr, OsStr...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/colors.rs
src/colors.rs
pub fn color_groups() -> Vec<(&'static str, Vec<(&'static str, &'static str)>)> { vec![ ( "Blue", vec![ ("cadetblue", "#5f9ea0"), ("steelblue", "#4682b4"), ("lightsteelblue", "#b0c4de"), ("lightblue", "#add8e6"), ...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/color.rs
src/color.rs
use std::collections::HashMap; use std::str::FromStr; use ansi_term::Color; use lazy_static::lazy_static; use syntect::highlighting::Color as SyntectColor; use crate::fatal; use crate::git_config::GitConfig; use crate::utils; use ColorMode::*; pub fn parse_color(s: &str, true_color: bool, git_config: Option<&GitConf...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/options/theme.rs
src/options/theme.rs
//! Delta doesn't have a formal concept of a "theme". What it has is //! //! 1. The choice of "theme". This is the language syntax highlighting theme; you have to make this //! choice when using `bat` also. //! 2. The choice of "light vs dark mode". This determines whether the background colors should be //! chos...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/options/option_value.rs
src/options/option_value.rs
use crate::config::delta_unreachable; /// A value associated with a Delta command-line option name. pub enum OptionValue { Boolean(bool), Float(f64), OptionString(Option<String>), String(String), Int(usize), } /// An OptionValue, tagged according to its provenance/semantics. pub enum ProvenancedOp...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/options/mod.rs
src/options/mod.rs
pub mod get; pub mod option_value; pub mod set; pub mod theme;
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/options/set.rs
src/options/set.rs
use std::collections::{HashMap, HashSet, VecDeque}; use std::convert::TryInto; use std::result::Result; use std::str::FromStr; use bat::assets::HighlightingAssets; use console::Term; use crate::cli; use crate::config; use crate::env::DeltaEnv; use crate::errors::*; use crate::fatal; use crate::features; use crate::gi...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/options/get.rs
src/options/get.rs
use std::collections::HashMap; use crate::cli; use crate::features; use crate::git_config::{self, GitConfigGet}; use crate::options::option_value::{OptionValue, ProvenancedOptionValue}; use ProvenancedOptionValue::*; // Look up a value of type `T` associated with `option name`. The search rules are: // // 1. If there...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/tests/test_example_diffs.rs
src/tests/test_example_diffs.rs
#[cfg(test)] mod tests { use crate::ansi::{self, strip_ansi_codes}; use crate::cli::InspectRawLines; use crate::delta::{DiffType, State}; use crate::handlers::hunk_header::ParsedHunkHeader; use crate::style; use crate::tests::ansi_test_utils::ansi_test_utils; use crate::tests::integration_te...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
true
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/tests/integration_test_utils.rs
src/tests/integration_test_utils.rs
#![cfg(test)] use std::borrow::Cow; use std::fs::File; use std::io::{BufReader, Write}; use std::path::Path; use bytelines::ByteLines; use itertools::Itertools; use crate::ansi; use crate::cli; use crate::config; use crate::delta::delta; use crate::env::DeltaEnv; use crate::git_config::GitConfig; use crate::tests::t...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/tests/ansi_test_utils.rs
src/tests/ansi_test_utils.rs
#[cfg(test)] #[allow(clippy::module_inception)] pub mod ansi_test_utils { use ansi_term; use crate::ansi; use crate::config::Config; use crate::delta::State; use crate::paint; use crate::style::Style; // Check if `output[line_number]` start with `expected_prefix` // Then check if the f...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/tests/test_utils.rs
src/tests/test_utils.rs
#![cfg(test)] /// Return true iff `s` contains exactly one occurrence of substring `t`. pub fn contains_once(s: &str, t: &str) -> bool { match (s.find(t), s.rfind(t)) { (Some(i), Some(j)) => i == j, _ => false, } } #[allow(dead_code)] pub fn print_with_line_numbers(s: &str) { for (i, t) in ...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/tests/mod.rs
src/tests/mod.rs
pub mod ansi_test_utils; pub mod integration_test_utils; pub mod test_example_diffs; pub mod test_utils; #[cfg(not(test))] pub const TESTING: bool = false; #[cfg(test)] pub const TESTING: bool = true; #[test] #[allow(clippy::assertions_on_constants)] fn am_testing() { assert!(TESTING); }
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/round_char_boundary.rs
src/utils/round_char_boundary.rs
// Taken from https://github.com/rust-lang/rust/pull/86497 // TODO: Remove when this is in the version of the Rust standard library that delta is building // against. #[inline] const fn is_utf8_char_boundary(b: u8) -> bool { // This is bit magic equivalent to: b < 128 || b >= 192 (b as i8) >= -0x40 } #[inline...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/path.rs
src/utils/path.rs
use std::path::{Component, Path, PathBuf}; use crate::config::Config; use super::process::calling_process; // Infer absolute path to `relative_path`. pub fn absolute_path(relative_path: &str, config: &Config) -> Option<PathBuf> { match ( &config.cwd_of_delta_process, &config.cwd_of_user_shell_pro...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/tabs.rs
src/utils/tabs.rs
use unicode_segmentation::UnicodeSegmentation; #[derive(Debug, Clone)] pub struct TabCfg { replacement: String, } impl TabCfg { pub fn new(width: usize) -> Self { TabCfg { replacement: " ".repeat(width), } } pub fn width(&self) -> usize { self.replacement.len() ...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/process.rs
src/utils/process.rs
use std::collections::{HashMap, HashSet}; use std::path::Path; use std::sync::atomic::AtomicUsize; use std::sync::{Arc, Condvar, Mutex, MutexGuard}; use lazy_static::lazy_static; use sysinfo::{Pid, PidExt, Process, ProcessExt, ProcessRefreshKind, SystemExt}; use crate::utils::DELTA_ATOMIC_ORDERING; pub type DeltaPid...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
true
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/git.rs
src/utils/git.rs
use std::process::Command; pub fn retrieve_git_version() -> Option<(usize, usize)> { if let Ok(git_path) = grep_cli::resolve_binary("git") { let cmd = Command::new(git_path).arg("--version").output().ok()?; parse_git_version(&cmd.stdout) } else { None } } fn parse_git_version(outpu...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/syntect.rs
src/utils/syntect.rs
use std::str::FromStr; use syntect::highlighting::{Color, FontStyle, Style}; use crate::color; use crate::style as delta_style; pub fn syntect_color_from_ansi_name(name: &str) -> Option<Color> { color::ansi_16_color_name_to_number(name).and_then(syntect_color_from_ansi_number) } pub fn syntect_color_from_name(n...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/mod.rs
src/utils/mod.rs
#[cfg(not(tarpaulin_include))] pub mod bat; pub mod git; pub mod helpwrap; pub mod path; pub mod process; pub mod regex_replacement; pub mod round_char_boundary; pub mod syntect; pub mod tabs; pub mod workarounds; // Use the most (even overly) strict ordering. Atomics are not used in hot loops so // a one-size-fits-al...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/workarounds.rs
src/utils/workarounds.rs
// env var which should disable workarounds const NO_WORKAROUNDS: &str = "DELTA_NO_WORKAROUNDS"; // Work around a bug in the 'console' crate (inherited from 'terminal-size', #25): On Windows // it can not determine the width of an MSYS2 / MINGW64 terminal (e.g. from Git-Bash) correctly. // Instead use the usually incl...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/helpwrap.rs
src/utils/helpwrap.rs
#![allow(clippy::comparison_to_empty)] // no_indent != "", instead of !no_indent.is_empty() use crate::ansi::measure_text_width; /// Wrap `text` at spaces ('` `') to fit into `width`. If `indent_with` is non-empty, indent /// each line with this string. If a line from `text` starts with `no_indent`, do not indent. //...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/regex_replacement.rs
src/utils/regex_replacement.rs
use std::borrow::Cow; use regex::{Regex, RegexBuilder}; #[derive(Clone, Debug)] pub struct RegexReplacement { regex: Regex, replacement: String, replace_all: bool, } impl RegexReplacement { pub fn from_sed_command(sed_command: &str) -> Option<Self> { let sep = sed_command.chars().nth(1)?; ...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/bat/terminal.rs
src/utils/bat/terminal.rs
use ansi_term::Color::{self, Fixed, RGB}; use ansi_term::{self, Style}; use syntect::highlighting::{self, FontStyle}; pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> Option<ansi_term::Color> { if color.a == 0 { // Themes can specify one of the user-configurable terminal colors by ...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/bat/mod.rs
src/utils/bat/mod.rs
pub mod assets; pub mod dirs; mod less; pub mod output; pub mod terminal;
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/bat/dirs.rs
src/utils/bat/dirs.rs
// Based on code from https://github.com/sharkdp/bat e981e974076a926a38f124b7d8746de2ca5f0a28 // See src/utils/bat/LICENSE use lazy_static::lazy_static; use std::path::{Path, PathBuf}; #[cfg(target_os = "macos")] use std::env; /// Wrapper for 'dirs' that treats MacOS more like Linux, by following the XDG specificati...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/bat/less.rs
src/utils/bat/less.rs
use std::path::PathBuf; use std::process::Command; pub fn retrieve_less_version(less_path: PathBuf) -> Option<usize> { let cmd = Command::new(less_path).arg("--version").output().ok()?; parse_less_version(&cmd.stdout) } fn parse_less_version(output: &[u8]) -> Option<usize> { if output.starts_with(b"less "...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/bat/assets.rs
src/utils/bat/assets.rs
// Based on code from https://github.com/sharkdp/bat a1b9334a44a2c652f52dddaa83dbacba57372468 // See src/utils/bat/LICENSE use std::io::{self, Write}; use ansi_term::Colour::Green; use ansi_term::Style; use bat; use crate::utils; pub fn load_highlighting_assets() -> bat::assets::HighlightingAssets { bat::assets...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/utils/bat/output.rs
src/utils/bat/output.rs
// https://github.com/sharkdp/bat a1b9334a44a2c652f52dddaa83dbacba57372468 // src/output.rs // See src/utils/bat/LICENSE use std::ffi::OsString; use std::io::{self, Write}; use std::path::PathBuf; use std::process::{Child, Command, Stdio}; use super::less::retrieve_less_version; use crate::config; use crate::env::Del...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/ansi/console_tests.rs
src/ansi/console_tests.rs
// This file contains some unit tests copied from the `console` project: // https://github.com/mitsuhiko/console // // The MIT License (MIT) // Copyright (c) 2017 Armin Ronacher <armin.ronacher@active-4.com> // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associ...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/ansi/mod.rs
src/ansi/mod.rs
mod console_tests; mod iterator; use std::borrow::Cow; use ansi_term::Style; use itertools::Itertools; use unicode_segmentation::UnicodeSegmentation; use unicode_width::UnicodeWidthStr; use iterator::{AnsiElementIterator, Element}; pub const ANSI_CSI_CLEAR_TO_EOL: &str = "\x1b[0K"; pub const ANSI_CSI_CLEAR_TO_BOL: ...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/ansi/iterator.rs
src/ansi/iterator.rs
use anstyle_parse::{Params, ParamsIter}; use core::str::Bytes; use std::convert::TryFrom; use std::iter; pub struct AnsiElementIterator<'a> { // The input bytes bytes: Bytes<'a>, // The state machine machine: anstyle_parse::Parser, // Becomes non-None when the parser finishes parsing an ANSI sequ...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/features/color_only.rs
src/features/color_only.rs
use std::collections::HashSet; use crate::features::raw; use crate::features::OptionValueFunction; /// color-only is like raw but does not override these styles. pub fn make_feature() -> Vec<(String, OptionValueFunction)> { let styles: HashSet<_> = [ "minus-style", "minus-emph-style", "zer...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/features/hyperlinks.rs
src/features/hyperlinks.rs
use std::borrow::Cow; use std::path::Path; use lazy_static::lazy_static; use regex::{Match, Matches, Regex}; use crate::config::Config; use crate::features::OptionValueFunction; #[cfg(test)] use crate::git_config::GitConfig; pub fn make_feature() -> Vec<(String, OptionValueFunction)> { builtin_feature!([ ...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/features/line_numbers.rs
src/features/line_numbers.rs
use std::cmp::max; use lazy_static::lazy_static; use regex::Regex; use crate::color::ColorMode::*; use crate::config; use crate::delta::State; use crate::features::hyperlinks; use crate::features::side_by_side::ansifill::{self, ODD_PAD_CHAR}; use crate::features::side_by_side::{Left, PanelSide, Right}; use crate::fea...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/features/side_by_side.rs
src/features/side_by_side.rs
use itertools::Itertools; use syntect::highlighting::Style as SyntectStyle; use unicode_width::UnicodeWidthStr; use crate::ansi; use crate::cli; use crate::config::{self, delta_unreachable, Config}; use crate::delta::DiffType; use crate::delta::State; use crate::edits; use crate::features::{line_numbers, OptionValueFu...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/features/diff_so_fancy.rs
src/features/diff_so_fancy.rs
use crate::features::diff_highlight; use crate::features::OptionValueFunction; pub fn make_feature() -> Vec<(String, OptionValueFunction)> { let mut feature = diff_highlight::_make_feature(true); feature.extend(builtin_feature!([ ( "minus-emph-style", String, Some("c...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false
dandavison/delta
https://github.com/dandavison/delta/blob/acd758f7a08df6c2ac5542a2c5a4034c664a9ed8/src/features/raw.rs
src/features/raw.rs
use crate::features::OptionValueFunction; pub fn make_feature() -> Vec<(String, OptionValueFunction)> { builtin_feature!([ ( "commit-decoration-style", String, None, _opt => "none" ), ( "commit-style", String, ...
rust
MIT
acd758f7a08df6c2ac5542a2c5a4034c664a9ed8
2026-01-04T15:34:43.859751Z
false