diff --git a/justfile b/justfile index 17c7992c9e..21e1aca0dd 100755 --- a/justfile +++ b/justfile @@ -221,12 +221,16 @@ test-release-workflow: [group: 'test'] test-completions: + #!/usr/bin/env bash rm -rf tmp/complete mkdir -p tmp/complete/bin cargo build cp target/debug/just tmp/complete/bin ./tmp/complete/bin/just --completions bash > tmp/complete/just.bash - echo 'mod foo' > tmp/complete/justfile + cat > tmp/complete/justfile << EOF + alias hello := foo::bar + mod foo + EOF echo 'bar:' > tmp/complete/foo.just cd tmp/complete && PATH="`realpath bin`:$PATH" bash --init-file just.bash diff --git a/tests/completions.rs b/tests/completions.rs index f11feca242..bf73f8956c 100644 --- a/tests/completions.rs +++ b/tests/completions.rs @@ -355,6 +355,23 @@ fn aliases_completed_with_flag() { .success(); } +#[test] +fn aliases_completed_with_environment_variable() { + Test::new() + .justfile( + " + foo: + alias b := foo + ", + ) + .shell(false) + .env("JUST_COMPLETE", "fish") + .env("JUST_COMPLETE_ALIASES", "true") + .args(complete_args(&[""])) + .stdout_regex("foo\nb\n--.*") + .success(); +} + #[test] fn private_aliases_excluded() { Test::new()