Skip to content

Commit

Permalink
Run the 'nix --help' tests early
Browse files Browse the repository at this point in the history
These don't depend on 'man' so we don't need to skip them.
  • Loading branch information
edolstra committed Jan 23, 2025
1 parent e0c6ed1 commit 2dae5ac
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tests/functional/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

source common.sh

function subcommands() {
jq -r '
def recurse($prefix):
to_entries[] |
($prefix + [.key]) as $newPrefix |
(if .value | has("commands") then
($newPrefix, (.value.commands | recurse($newPrefix)))
else
$newPrefix
end);
.args.commands | recurse([]) | join(" ")
'
}

nix __dump-cli | subcommands | while IFS= read -r cmd; do
# shellcheck disable=SC2086 # word splitting of cmd is intended
nix $cmd --help
done

[[ $(type -p man) ]] || skipTest "'man' not installed"

# test help output
Expand Down Expand Up @@ -51,22 +70,3 @@ nix-daemon --help
nix-hash --help
nix-instantiate --help
nix-prefetch-url --help

function subcommands() {
jq -r '
def recurse($prefix):
to_entries[] |
($prefix + [.key]) as $newPrefix |
(if .value | has("commands") then
($newPrefix, (.value.commands | recurse($newPrefix)))
else
$newPrefix
end);
.args.commands | recurse([]) | join(" ")
'
}

nix __dump-cli | subcommands | while IFS= read -r cmd; do
# shellcheck disable=SC2086 # word splitting of cmd is intended
nix $cmd --help
done

0 comments on commit 2dae5ac

Please sign in to comment.