[INFO] fetching crate workhelix-cli-common 0.4.1... [INFO] testing workhelix-cli-common-0.4.1 against try#c2e32f1c9652b13ed99608599c1e855462f421f3 for pr-146098-8 [INFO] extracting crate workhelix-cli-common 0.4.1 into /workspace/builds/worker-1-tc2/source [INFO] started tweaking crates.io crate workhelix-cli-common 0.4.1 [INFO] finished tweaking crates.io crate workhelix-cli-common 0.4.1 [INFO] tweaked toml for crates.io crate workhelix-cli-common 0.4.1 written to /workspace/builds/worker-1-tc2/source/Cargo.toml [INFO] validating manifest of crates.io crate workhelix-cli-common 0.4.1 on toolchain c2e32f1c9652b13ed99608599c1e855462f421f3 [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+c2e32f1c9652b13ed99608599c1e855462f421f3" "metadata" "--manifest-path" "Cargo.toml" "--no-deps", kill_on_drop: false }` [INFO] crate crates.io crate workhelix-cli-common 0.4.1 already has a lockfile, it will not be regenerated [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+c2e32f1c9652b13ed99608599c1e855462f421f3" "fetch" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [INFO] [stderr] Blocking waiting for file lock on package cache [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc2/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc2/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:4848fb76d95f26979359cc7e45710b1dbc8f3acb7aeedee7c460d7702230f228" "/opt/rustwide/cargo-home/bin/cargo" "+c2e32f1c9652b13ed99608599c1e855462f421f3" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }` [INFO] [stdout] 2fe811ea4953e1ffba30836e60b4b41b3fc945825c2bcdc832f8d0f274b36fa0 [INFO] running `Command { std: "docker" "start" "-a" "2fe811ea4953e1ffba30836e60b4b41b3fc945825c2bcdc832f8d0f274b36fa0", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "2fe811ea4953e1ffba30836e60b4b41b3fc945825c2bcdc832f8d0f274b36fa0", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "2fe811ea4953e1ffba30836e60b4b41b3fc945825c2bcdc832f8d0f274b36fa0", kill_on_drop: false }` [INFO] [stdout] 2fe811ea4953e1ffba30836e60b4b41b3fc945825c2bcdc832f8d0f274b36fa0 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc2/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc2/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:4848fb76d95f26979359cc7e45710b1dbc8f3acb7aeedee7c460d7702230f228" "/opt/rustwide/cargo-home/bin/cargo" "+c2e32f1c9652b13ed99608599c1e855462f421f3" "build" "--frozen" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] c58d8bb6b7d78e2b7a958df76b7e5af1235528effffe6a59136edfb085ce783c [INFO] running `Command { std: "docker" "start" "-a" "c58d8bb6b7d78e2b7a958df76b7e5af1235528effffe6a59136edfb085ce783c", kill_on_drop: false }` [INFO] [stderr] Compiling proc-macro2 v1.0.101 [INFO] [stderr] Compiling unicode-ident v1.0.19 [INFO] [stderr] Compiling quote v1.0.41 [INFO] [stderr] Compiling anstyle v1.0.13 [INFO] [stderr] Compiling clap_lex v0.7.6 [INFO] [stderr] Compiling colored v3.0.0 [INFO] [stderr] Compiling is-terminal v0.4.16 [INFO] [stderr] Compiling anstream v0.6.21 [INFO] [stderr] Compiling clap_builder v4.5.50 [INFO] [stderr] Compiling syn v2.0.107 [INFO] [stderr] Compiling clap_derive v4.5.49 [INFO] [stderr] Compiling clap v4.5.50 [INFO] [stderr] Compiling clap_complete v4.5.59 [INFO] [stderr] Compiling workhelix-cli-common v0.4.1 (/opt/rustwide/workdir) [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 10.04s [INFO] running `Command { std: "docker" "inspect" "c58d8bb6b7d78e2b7a958df76b7e5af1235528effffe6a59136edfb085ce783c", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "c58d8bb6b7d78e2b7a958df76b7e5af1235528effffe6a59136edfb085ce783c", kill_on_drop: false }` [INFO] [stdout] c58d8bb6b7d78e2b7a958df76b7e5af1235528effffe6a59136edfb085ce783c [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc2/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc2/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:4848fb76d95f26979359cc7e45710b1dbc8f3acb7aeedee7c460d7702230f228" "/opt/rustwide/cargo-home/bin/cargo" "+c2e32f1c9652b13ed99608599c1e855462f421f3" "test" "--frozen" "--no-run" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] b9edd9487068d072897500e63d393f8f72e7647d237aacec700622e56e0b21db [INFO] running `Command { std: "docker" "start" "-a" "b9edd9487068d072897500e63d393f8f72e7647d237aacec700622e56e0b21db", kill_on_drop: false }` [INFO] [stderr] Compiling workhelix-cli-common v0.4.1 (/opt/rustwide/workdir) [INFO] [stderr] Finished `test` profile [unoptimized + debuginfo] target(s) in 0.71s [INFO] running `Command { std: "docker" "inspect" "b9edd9487068d072897500e63d393f8f72e7647d237aacec700622e56e0b21db", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "b9edd9487068d072897500e63d393f8f72e7647d237aacec700622e56e0b21db", kill_on_drop: false }` [INFO] [stdout] b9edd9487068d072897500e63d393f8f72e7647d237aacec700622e56e0b21db [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc2/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc2/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:4848fb76d95f26979359cc7e45710b1dbc8f3acb7aeedee7c460d7702230f228" "/opt/rustwide/cargo-home/bin/cargo" "+c2e32f1c9652b13ed99608599c1e855462f421f3" "test" "--frozen", kill_on_drop: false }` [INFO] [stdout] e0f9ab14c42f7c4240222f3f66202ddfe5cf4cf6811c309f3b8631ca3012ba8f [INFO] running `Command { std: "docker" "start" "-a" "e0f9ab14c42f7c4240222f3f66202ddfe5cf4cf6811c309f3b8631ca3012ba8f", kill_on_drop: false }` [INFO] [stderr] Finished `test` profile [unoptimized + debuginfo] target(s) in 0.41s [INFO] [stderr] Running unittests src/lib.rs (/opt/rustwide/target/debug/deps/workhelix_cli_common-e3a9646a3cb6850c) [INFO] [stdout] [INFO] [stdout] running 24 tests [INFO] [stdout] _test-cli() { [INFO] [stdout] local i cur prev opts cmd [INFO] [stdout] COMPREPLY=() [INFO] [stdout] if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then [INFO] [stdout] cur="$2" [INFO] [stdout] else [INFO] [stdout] cur="${COMP_WORDS[COMP_CWORD]}" [INFO] [stdout] fi [INFO] [stdout] prev="$3" [INFO] [stdout] cmd="" [INFO] [stdout] opts="" [INFO] [stdout] [INFO] [stdout] for i in "${COMP_WORDS[@]:0:COMP_CWORD}" [INFO] [stdout] do [INFO] [stdout] case "${cmd},${i}" in [INFO] [stdout] ",$1") [INFO] [stdout] cmd="test__cli" [INFO] [stdout] ;; [INFO] [stdout] test__cli,help) [INFO] [stdout] cmd="test__cli__help" [INFO] [stdout] ;; [INFO] [stdout] test__cli,test) [INFO] [stdout] cmd="test__cli__test" [INFO] [stdout] ;; [INFO] [stdout] test__cli,version) [INFO] [stdout] cmd="test__cli__version" [INFO] [stdout] ;; [INFO] [stdout] test__cli__help,help) [INFO] [stdout] cmd="test__cli__help__help" [INFO] [stdout] ;; [INFO] [stdout] test__cli__help,test) [INFO] [stdout] cmd="test__cli__help__test" [INFO] [stdout] ;; [INFO] [stdout] test__cli__help,version) [INFO] [stdout] cmd="test__cli__help__version" [INFO] [stdout] ;; [INFO] [stdout] *) [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] done [INFO] [stdout] [INFO] [stdout] case "${cmd}" in [INFO] [stdout] test__cli) [INFO] [stdout] opts="-h --help version test help" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__help) [INFO] [stdout] opts="version test help" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__help__help) [INFO] [stdout] opts="" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__help__test) [INFO] [stdout] opts="" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__help__version) [INFO] [stdout] opts="" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__test) [INFO] [stdout] opts="-h --help " [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__version) [INFO] [stdout] opts="-h --help" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] } [INFO] [stdout] [INFO] [stdout] if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then [INFO] [stdout] complete -F _test-cli -o nosort -o bashdefault -o default test-cli [INFO] [stdout] else [INFO] [stdout] complete -F _test-cli -o bashdefault -o default test-cli [INFO] [stdout] fi [INFO] [stdout] #compdef test-cli [INFO] [stdout] [INFO] [stdout] autoload -U is-at-least [INFO] [stdout] [INFO] [stdout] _test-cli() { [INFO] [stdout] typeset -A opt_args [INFO] [stdout] typeset -a _arguments_options [INFO] [stdout] local ret=1 [INFO] [stdout] [INFO] [stdout] if is-at-least 5.2; then [INFO] [stdout] _arguments_options=(-s -S -C) [INFO] [stdout] else [INFO] [stdout] _arguments_options=(-s -C) [INFO] [stdout] fi [INFO] [stdout] [INFO] [stdout] local context curcontext="$curcontext" state line [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] '-h[Print help]' \ [INFO] [stdout] '--help[Print help]' \ [INFO] [stdout] ":: :_test-cli_commands" \ [INFO] [stdout] "*::: :->test-cli" \ [INFO] [stdout] && ret=0 [INFO] [stdout] case $state in [INFO] [stdout] (test-cli) [INFO] [stdout] words=($line[1] "${words[@]}") [INFO] [stdout] (( CURRENT += 1 )) [INFO] [stdout] curcontext="${curcontext%:*:*}:test-cli-command-$line[1]:" [INFO] [stdout] case $line[1] in [INFO] [stdout] (version) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] '-h[Print help]' \ [INFO] [stdout] '--help[Print help]' \ [INFO] [stdout] && ret=0 [INFO] [stdout] ;; [INFO] [stdout] (test) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] '-h[Print help]' \ [INFO] [stdout] '--help[Print help]' \ [INFO] [stdout] ':arg:_default' \ [INFO] [stdout] && ret=0 [INFO] [stdout] ;; [INFO] [stdout] (help) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] ":: :_test-cli__help_commands" \ [INFO] [stdout] "*::: :->help" \ [INFO] [stdout] && ret=0 [INFO] [stdout] [INFO] [stdout] case $state in [INFO] [stdout] (help) [INFO] [stdout] words=($line[1] "${words[@]}") [INFO] [stdout] (( CURRENT += 1 )) [INFO] [stdout] curcontext="${curcontext%:*:*}:test-cli-help-command-$line[1]:" [INFO] [stdout] case $line[1] in [INFO] [stdout] (version) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] && ret=0 [INFO] [stdout] ;; [INFO] [stdout] (test) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] && ret=0 [INFO] [stdout] ;; [INFO] [stdout] (help) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] && ret=0 [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] } [INFO] [stdout] [INFO] [stdout] (( $+functions[_test-cli_commands] )) || [INFO] [stdout] _test-cli_commands() { [INFO] [stdout] local commands; commands=( [INFO] [stdout] 'version:' \ [INFO] [stdout] 'test:' \ [INFO] [stdout] 'help:Print this message or the help of the given subcommand(s)' \ [INFO] [stdout] ) [INFO] [stdout] _describe -t commands 'test-cli commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__help_commands] )) || [INFO] [stdout] _test-cli__help_commands() { [INFO] [stdout] local commands; commands=( [INFO] [stdout] 'version:' \ [INFO] [stdout] 'test:' \ [INFO] [stdout] 'help:Print this message or the help of the given subcommand(s)' \ [INFO] [stdout] ) [INFO] [stdout] _describe -t commands 'test-cli help commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__help__help_commands] )) || [INFO] [stdout] _test-cli__help__help_commands() { [INFO] [stdout] local commands; commands=() [INFO] [stdout] _describe -t commands 'test-cli help help commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__help__test_commands] )) || [INFO] [stdout] _test-cli__help__test_commands() { [INFO] [stdout] local commands; commands=() [INFO] [stdout] _describe -t commands 'test-cli help test commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__help__version_commands] )) || [INFO] [stdout] _test-cli__help__version_commands() { [INFO] [stdout] local commands; commands=() [INFO] [stdout] _describe -t commands 'test-cli help version commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__test_commands] )) || [INFO] [stdout] _test-cli__test_commands() { [INFO] [stdout] local commands; commands=() [INFO] [stdout] _describe -t commands 'test-cli test commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__version_commands] )) || [INFO] [stdout] _test-cli__version_commands() { [INFO] [stdout] local commands; commands=() [INFO] [stdout] _describe -t commands 'test-cli version commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] [INFO] [stdout] if [ "$funcstack[1]" = "_test-cli" ]; then [INFO] [stdout] _test-cli "$@" [INFO] [stdout] else [INFO] [stdout] compdef _test-cli test-cli [INFO] [stdout] fi [INFO] [stdout] # Print an optspec for argparse to handle cmd's options that are independent of any subcommand. [INFO] [stdout] function __fish_test_cli_global_optspecs [INFO] [stdout] string join \n h/help [INFO] [stdout] end [INFO] [stdout] [INFO] [stdout] function __fish_test_cli_needs_command [INFO] [stdout] # Figure out if the current invocation already has a command. [INFO] [stdout] set -l cmd (commandline -opc) [INFO] [stdout] set -e cmd[1] [INFO] [stdout] argparse -s (__fish_test_cli_global_optspecs) -- $cmd 2>/dev/null [INFO] [stdout] or return [INFO] [stdout] if set -q argv[1] [INFO] [stdout] # Also print the command, so this can be used to figure out what it is. [INFO] [stdout] echo $argv[1] [INFO] [stdout] return 1 [INFO] [stdout] end [INFO] [stdout] return 0 [INFO] [stdout] end [INFO] [stdout] [INFO] [stdout] function __fish_test_cli_using_subcommand [INFO] [stdout] set -l cmd (__fish_test_cli_needs_command) [INFO] [stdout] test -z "$cmd" [INFO] [stdout] and return 1 [INFO] [stdout] contains -- $cmd[1] $argv [INFO] [stdout] end [INFO] [stdout] [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_needs_command" -s h -l help -d 'Print help' [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_needs_command" -f -a "version" [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_needs_command" -f -a "test" [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_needs_command" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_using_subcommand version" -s h -l help -d 'Print help' [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_using_subcommand test" -s h -l help -d 'Print help' [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_using_subcommand help; and not __fish_seen_subcommand_from version test help" -f -a "version" [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_using_subcommand help; and not __fish_seen_subcommand_from version test help" -f -a "test" [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_using_subcommand help; and not __fish_seen_subcommand_from version test help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' [INFO] [stdout] [INFO] [stdout] use builtin; [INFO] [stdout] use str; [INFO] [stdout] [INFO] [stdout] set edit:completion:arg-completer[test-cli] = {|@words| [INFO] [stdout] fn spaces {|n| [INFO] [stdout] builtin:repeat $n ' ' | str:join '' [INFO] [stdout] } [INFO] [stdout] fn cand {|text desc| [INFO] [stdout] edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc [INFO] [stdout] } [INFO] [stdout] var command = 'test-cli' [INFO] [stdout] for word $words[1..-1] { [INFO] [stdout] if (str:has-prefix $word '-') { [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] set command = $command';'$word [INFO] [stdout] } [INFO] [stdout] var completions = [ [INFO] [stdout] &'test-cli'= { [INFO] [stdout] cand -h 'Print help' [INFO] [stdout] cand --help 'Print help' [INFO] [stdout] cand version 'version' [INFO] [stdout] cand test 'test' [INFO] [stdout] cand help 'Print this message or the help of the given subcommand(s)' [INFO] [stdout] } [INFO] [stdout] &'test-cli;version'= { [INFO] [stdout] cand -h 'Print help' [INFO] [stdout] cand --help 'Print help' [INFO] [stdout] } [INFO] [stdout] &'test-cli;test'= { [INFO] [stdout] cand -h 'Print help' [INFO] [stdout] cand --help 'Print help' [INFO] [stdout] } [INFO] [stdout] &'test-cli;help'= { [INFO] [stdout] cand version 'version' [INFO] [stdout] cand test 'test' [INFO] [stdout] cand help 'Print this message or the help of the given subcommand(s)' [INFO] [stdout] } [INFO] [stdout] &'test-cli;help;version'= { [INFO] [stdout] } [INFO] [stdout] &'test-cli;help;test'= { [INFO] [stdout] } [INFO] [stdout] &'test-cli;help;help'= { [INFO] [stdout] } [INFO] [stdout] ] [INFO] [stdout] $completions[$command] [INFO] [stdout] } [INFO] [stdout] _test-cli() { [INFO] [stdout] local i cur prev opts cmd [INFO] [stdout] COMPREPLY=() [INFO] [stdout] if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then [INFO] [stdout] cur="$2" [INFO] [stdout] else [INFO] [stdout] cur="${COMP_WORDS[COMP_CWORD]}" [INFO] [stdout] fi [INFO] [stdout] prev="$3" [INFO] [stdout] cmd="" [INFO] [stdout] opts="" [INFO] [stdout] [INFO] [stdout] for i in "${COMP_WORDS[@]:0:COMP_CWORD}" [INFO] [stdout] do [INFO] [stdout] case "${cmd},${i}" in [INFO] [stdout] ",$1") [INFO] [stdout] cmd="test__cli" [INFO] [stdout] ;; [INFO] [stdout] test__cli,help) [INFO] [stdout] cmd="test__cli__help" [INFO] [stdout] ;; [INFO] [stdout] test__cli,test) [INFO] [stdout] cmd="test__cli__test" [INFO] [stdout] ;; [INFO] [stdout] test__cli,version) [INFO] [stdout] cmd="test__cli__version" [INFO] [stdout] ;; [INFO] [stdout] test__cli__help,help) [INFO] [stdout] cmd="test__cli__help__help" [INFO] [stdout] ;; [INFO] [stdout] test__cli__help,test) [INFO] [stdout] cmd="test__cli__help__test" [INFO] [stdout] ;; [INFO] [stdout] test__cli__help,version) [INFO] [stdout] cmd="test__cli__help__version" [INFO] [stdout] ;; [INFO] [stdout] *) [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] done [INFO] [stdout] [INFO] [stdout] case "${cmd}" in [INFO] [stdout] test__cli) [INFO] [stdout] opts="-h --help version test help" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__help) [INFO] [stdout] opts="version test help" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__help__help) [INFO] [stdout] opts="" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__help__test) [INFO] [stdout] opts="" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__help__version) [INFO] [stdout] opts="" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__test) [INFO] [stdout] opts="-h --help " [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] test__cli__version) [INFO] [stdout] opts="-h --help" [INFO] [stdout] if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] fi [INFO] [stdout] case "${prev}" in [INFO] [stdout] *) [INFO] [stdout] COMPREPLY=() [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) [INFO] [stdout] return 0 [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] } [INFO] [stdout] [INFO] [stdout] if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then [INFO] [stdout] complete -F _test-cli -o nosort -o bashdefault -o default test-cli [INFO] [stdout] else [INFO] [stdout] complete -F _test-cli -o bashdefault -o default test-cli [INFO] [stdout] fi [INFO] [stdout] [INFO] [stdout] using namespace System.Management.Automation [INFO] [stdout] using namespace System.Management.Automation.Language [INFO] [stdout] [INFO] [stdout] Register-ArgumentCompleter -Native -CommandName 'test-cli' -ScriptBlock { [INFO] [stdout] param($wordToComplete, $commandAst, $cursorPosition) [INFO] [stdout] [INFO] [stdout] $commandElements = $commandAst.CommandElements [INFO] [stdout] $command = @( [INFO] [stdout] 'test-cli' [INFO] [stdout] for ($i = 1; $i -lt $commandElements.Count; $i++) { [INFO] [stdout] $element = $commandElements[$i] [INFO] [stdout] if ($element -isnot [StringConstantExpressionAst] -or [INFO] [stdout] $element.StringConstantType -ne [StringConstantType]::BareWord -or [INFO] [stdout] $element.Value.StartsWith('-') -or [INFO] [stdout] $element.Value -eq $wordToComplete) { [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] $element.Value [INFO] [stdout] }) -join ';' [INFO] [stdout] [INFO] [stdout] $completions = @(switch ($command) { [INFO] [stdout] 'test-cli' { [INFO] [stdout] [CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] [CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] [CompletionResult]::new('version', 'version', [CompletionResultType]::ParameterValue, 'version') [INFO] [stdout] [CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'test') [INFO] [stdout] [CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)') [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;version' { [INFO] [stdout] [CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] [CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;test' { [INFO] [stdout] [CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] [CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;help' { [INFO] [stdout] [CompletionResult]::new('version', 'version', [CompletionResultType]::ParameterValue, 'version') [INFO] [stdout] [CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'test') [INFO] [stdout] [CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)') [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;help;version' { [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;help;test' { [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;help;help' { [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] }) [INFO] [stdout] [INFO] [stdout] $completions.Where{ $_.CompletionText -like "$wordToComplete*" } | [INFO] [stdout] Sort-Object -Property ListItemText [INFO] [stdout] } [INFO] [stdout] #compdef test-cli [INFO] [stdout] [INFO] [stdout] autoload -U is-at-least [INFO] [stdout] [INFO] [stdout] _test-cli() { [INFO] [stdout] typeset -A opt_args [INFO] [stdout] typeset -a _arguments_options [INFO] [stdout] local ret=1 [INFO] [stdout] [INFO] [stdout] if is-at-least 5.2; then [INFO] [stdout] _arguments_options=(-s -S -C) [INFO] [stdout] else [INFO] [stdout] _arguments_options=(-s -C) [INFO] [stdout] fi [INFO] [stdout] [INFO] [stdout] local context curcontext="$curcontext" state line [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] '-h[Print help]' \ [INFO] [stdout] '--help[Print help]' \ [INFO] [stdout] ":: :_test-cli_commands" \ [INFO] [stdout] "*::: :->test-cli" \ [INFO] [stdout] && ret=0 [INFO] [stdout] case $state in [INFO] [stdout] (test-cli) [INFO] [stdout] words=($line[1] "${words[@]}") [INFO] [stdout] (( CURRENT += 1 )) [INFO] [stdout] curcontext="${curcontext%:*:*}:test-cli-command-$line[1]:" [INFO] [stdout] case $line[1] in [INFO] [stdout] (version) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] '-h[Print help]' \ [INFO] [stdout] '--help[Print help]' \ [INFO] [stdout] && ret=0 [INFO] [stdout] ;; [INFO] [stdout] (test) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] '-h[Print help]' \ [INFO] [stdout] '--help[Print help]' \ [INFO] [stdout] ':arg:_default' \ [INFO] [stdout] && ret=0 [INFO] [stdout] ;; [INFO] [stdout] (help) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] ":: :_test-cli__help_commands" \ [INFO] [stdout] "*::: :->help" \ [INFO] [stdout] && ret=0 [INFO] [stdout] [INFO] [stdout] case $state in [INFO] [stdout] (help) [INFO] [stdout] words=($line[1] "${words[@]}") [INFO] [stdout] (( CURRENT += 1 )) [INFO] [stdout] curcontext="${curcontext%:*:*}:test-cli-help-command-$line[1]:" [INFO] [stdout] case $line[1] in [INFO] [stdout] (version) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] && ret=0 [INFO] [stdout] ;; [INFO] [stdout] (test) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] && ret=0 [INFO] [stdout] ;; [INFO] [stdout] (help) [INFO] [stdout] _arguments "${_arguments_options[@]}" : \ [INFO] [stdout] && ret=0 [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] ;; [INFO] [stdout] esac [INFO] [stdout] } [INFO] [stdout] [INFO] [stdout] (( $+functions[_test-cli_commands] )) || [INFO] [stdout] _test-cli_commands() { [INFO] [stdout] local commands; commands=( [INFO] [stdout] 'version:' \ [INFO] [stdout] 'test:' \ [INFO] [stdout] 'help:Print this message or the help of the given subcommand(s)' \ [INFO] [stdout] ) [INFO] [stdout] _describe -t commands 'test-cli commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__help_commands] )) || [INFO] [stdout] _test-cli__help_commands() { [INFO] [stdout] local commands; commands=( [INFO] [stdout] 'version:' \ [INFO] [stdout] 'test:' \ [INFO] [stdout] 'help:Print this message or the help of the given subcommand(s)' \ [INFO] [stdout] ) [INFO] [stdout] _describe -t commands 'test-cli help commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__help__help_commands] )) || [INFO] [stdout] _test-cli__help__help_commands() { [INFO] [stdout] local commands; commands=() [INFO] [stdout] _describe -t commands 'test-cli help help commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__help__test_commands] )) || [INFO] [stdout] _test-cli__help__test_commands() { [INFO] [stdout] local commands; commands=() [INFO] [stdout] _describe -t commands 'test-cli help test commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__help__version_commands] )) || [INFO] [stdout] _test-cli__help__version_commands() { [INFO] [stdout] local commands; commands=() [INFO] [stdout] _describe -t commands 'test-cli help version commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__test_commands] )) || [INFO] [stdout] _test-cli__test_commands() { [INFO] [stdout] local commands; commands=() [INFO] [stdout] _describe -t commands 'test-cli test commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] (( $+functions[_test-cli__version_commands] )) || [INFO] [stdout] _test-cli__version_commands() { [INFO] [stdout] local commands; commands=() [INFO] [stdout] _describe -t commands 'test-cli version commands' commands "$@" [INFO] [stdout] } [INFO] [stdout] [INFO] [stdout] if [ "$funcstack[1]" = "_test-cli" ]; then [INFO] [stdout] _test-cli "$@" [INFO] [stdout] else [INFO] [stdout] compdef _test-cli test-cli [INFO] [stdout] fi [INFO] [stdout] [INFO] [stdout] using namespace System.Management.Automation [INFO] [stdout] using namespace System.Management.Automation.Language [INFO] [stdout] [INFO] [stdout] Register-ArgumentCompleter -Native -CommandName 'test-cli' -ScriptBlock { [INFO] [stdout] param($wordToComplete, $commandAst, $cursorPosition) [INFO] [stdout] [INFO] [stdout] $commandElements = $commandAst.CommandElements [INFO] [stdout] $command = @( [INFO] [stdout] 'test-cli' [INFO] [stdout] for ($i = 1; $i -lt $commandElements.Count; $i++) { [INFO] [stdout] $element = $commandElements[$i] [INFO] [stdout] if ($element -isnot [StringConstantExpressionAst] -or [INFO] [stdout] $element.StringConstantType -ne [StringConstantType]::BareWord -or [INFO] [stdout] $element.Value.StartsWith('-') -or [INFO] [stdout] $element.Value -eq $wordToComplete) { [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] $element.Value [INFO] [stdout] }) -join ';' [INFO] [stdout] [INFO] [stdout] $completions = @(switch ($command) { [INFO] [stdout] 'test-cli' { [INFO] [stdout] [CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] [CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] [CompletionResult]::new('version', 'version', [CompletionResultType]::ParameterValue, 'version') [INFO] [stdout] [CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'test') [INFO] [stdout] [CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)') [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;version' { [INFO] [stdout] [CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] [CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;test' { [INFO] [stdout] [CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] [CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help') [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;help' { [INFO] [stdout] [CompletionResult]::new('version', 'version', [CompletionResultType]::ParameterValue, 'version') [INFO] [stdout] [CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'test') [INFO] [stdout] [CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)') [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;help;version' { [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;help;test' { [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] 'test-cli;help;help' { [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] }) [INFO] [stdout] [INFO] [stdout] $completions.Where{ $_.CompletionText -like "$wordToComplete*" } | [INFO] [stdout] Sort-Object -Property ListItemText [INFO] [stdout] } [INFO] [stdout] [INFO] [stdout] use builtin; [INFO] [stdout] use str; [INFO] [stdout] [INFO] [stdout] set edit:completion:arg-completer[test-cli] = {|@words| [INFO] [stdout] fn spaces {|n| [INFO] [stdout] builtin:repeat $n ' ' | str:join '' [INFO] [stdout] } [INFO] [stdout] fn cand {|text desc| [INFO] [stdout] edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc [INFO] [stdout] } [INFO] [stdout] var command = 'test-cli' [INFO] [stdout] for word $words[1..-1] { [INFO] [stdout] if (str:has-prefix $word '-') { [INFO] [stdout] break [INFO] [stdout] } [INFO] [stdout] set command = $command';'$word [INFO] [stdout] } [INFO] [stdout] var completions = [ [INFO] [stdout] &'test-cli'= { [INFO] [stdout] cand -h 'Print help' [INFO] [stdout] cand --help 'Print help' [INFO] [stdout] cand version 'version' [INFO] [stdout] cand test 'test' [INFO] [stdout] cand help 'Print this message or the help of the given subcommand(s)' [INFO] [stdout] } [INFO] [stdout] &'test-cli;version'= { [INFO] [stdout] cand -h 'Print help' [INFO] [stdout] cand --help 'Print help' [INFO] [stdout] } [INFO] [stdout] &'test-cli;test'= { [INFO] [stdout] cand -h 'Print help' [INFO] [stdout] cand --help 'Print help' [INFO] [stdout] } [INFO] [stdout] &'test-cli;help'= { [INFO] [stdout] cand version 'version' [INFO] [stdout] cand test 'test' [INFO] [stdout] cand help 'Print this message or the help of the given subcommand(s)' [INFO] [stdout] } [INFO] [stdout] &'test-cli;help;version'= { [INFO] [stdout] } [INFO] [stdout] &'test-cli;help;test'= { [INFO] [stdout] } [INFO] [stdout] &'test-cli;help;help'= { [INFO] [stdout] } [INFO] [stdout] ] [INFO] [stdout] $completions[$command] [INFO] [stdout] } [INFO] [stdout] # Print an optspec for argparse to handle cmd's options that are independent of any subcommand. [INFO] [stderr] Doc-tests workhelix_cli_common [INFO] [stdout] function __fish_test_cli_global_optspecs [INFO] [stdout] string join \n h/help [INFO] [stdout] end [INFO] [stdout] [INFO] [stdout] function __fish_test_cli_needs_command [INFO] [stdout] # Figure out if the current invocation already has a command. [INFO] [stdout] set -l cmd (commandline -opc) [INFO] [stdout] set -e cmd[1] [INFO] [stdout] argparse -s (__fish_test_cli_global_optspecs) -- $cmd 2>/dev/null [INFO] [stdout] or return [INFO] [stdout] if set -q argv[1] [INFO] [stdout] # Also print the command, so this can be used to figure out what it is. [INFO] [stdout] echo $argv[1] [INFO] [stdout] return 1 [INFO] [stdout] end [INFO] [stdout] return 0 [INFO] [stdout] end [INFO] [stdout] [INFO] [stdout] function __fish_test_cli_using_subcommand [INFO] [stdout] set -l cmd (__fish_test_cli_needs_command) [INFO] [stdout] test -z "$cmd" [INFO] [stdout] and return 1 [INFO] [stdout] contains -- $cmd[1] $argv [INFO] [stdout] end [INFO] [stdout] [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_needs_command" -s h -l help -d 'Print help' [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_needs_command" -f -a "version" [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_needs_command" -f -a "test" [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_needs_command" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_using_subcommand version" -s h -l help -d 'Print help' [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_using_subcommand test" -s h -l help -d 'Print help' [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_using_subcommand help; and not __fish_seen_subcommand_from version test help" -f -a "version" [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_using_subcommand help; and not __fish_seen_subcommand_from version test help" -f -a "test" [INFO] [stdout] complete -c test-cli -n "__fish_test_cli_using_subcommand help; and not __fish_seen_subcommand_from version test help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' [INFO] [stdout] test completions::tests::test_generate_completions_bash ... ok [INFO] [stdout] test completions::tests::test_all_shells_generate_without_panic ... ok [INFO] [stdout] test completions::tests::test_generate_completions_zsh ... ok [INFO] [stdout] test doctor::tests::test_run_doctor ... ok [INFO] [stdout] test completions::tests::test_generate_completions_powershell ... ok [INFO] [stdout] test completions::tests::test_generate_completions_elvish ... ok [INFO] [stdout] test license::tests::test_display_license_apache ... ok [INFO] [stdout] test license::tests::test_display_license_cc0 ... ok [INFO] [stdout] test license::tests::test_license_type_from_str ... ok [INFO] [stdout] test completions::tests::test_generate_completions_fish ... ok [INFO] [stdout] test license::tests::test_license_type_name ... ok [INFO] [stdout] test license::tests::test_display_license_mit ... ok [INFO] [stdout] test output::tests::test_error_format ... ok [INFO] [stdout] test output::tests::test_header_format ... ok [INFO] [stdout] test output::tests::test_info_format ... ok [INFO] [stdout] test output::tests::test_is_tty_returns_bool ... ok [INFO] [stdout] test output::tests::test_success_format ... ok [INFO] [stdout] test output::tests::test_warning_format ... ok [INFO] [stdout] test tests::test_doctor_check_creation ... ok [INFO] [stdout] test tests::test_repo_info_creation ... ok [INFO] [stdout] test types::tests::test_doctor_check_fail ... ok [INFO] [stdout] test types::tests::test_doctor_check_pass ... ok [INFO] [stdout] test types::tests::test_repo_info_creation ... ok [INFO] [stdout] test tests::test_license_type ... ok [INFO] [stdout] [INFO] [stdout] test result: ok. 24 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] running 2 tests [INFO] [stdout] test src/completions.rs - completions::generate_completions (line 22) - compile ... ok [INFO] [stdout] test src/lib.rs - (line 11) - compile ... ok [INFO] [stdout] [INFO] [stdout] test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s [INFO] [stdout] [INFO] [stdout] all doctests ran in 0.49s; merged doctests compilation took 0.48s [INFO] running `Command { std: "docker" "inspect" "e0f9ab14c42f7c4240222f3f66202ddfe5cf4cf6811c309f3b8631ca3012ba8f", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "e0f9ab14c42f7c4240222f3f66202ddfe5cf4cf6811c309f3b8631ca3012ba8f", kill_on_drop: false }` [INFO] [stdout] e0f9ab14c42f7c4240222f3f66202ddfe5cf4cf6811c309f3b8631ca3012ba8f