1# greet fish shell completion 2 3function __fish_greet_no_subcommand --description 'Test if there has been any subcommand yet' 4 for i in (commandline -opc) 5 if contains -- $i config c sub-config s ss info i in some-command 6 return 1 7 end 8 end 9 return 0 10end 11 12complete -c greet -n '__fish_greet_no_subcommand' -l socket -s s -r -d 'some \'usage\' text' 13complete -c greet -n '__fish_greet_no_subcommand' -f -l flag -s fl -s f -r 14complete -c greet -n '__fish_greet_no_subcommand' -f -l another-flag -s b -d 'another usage text' 15complete -c greet -n '__fish_greet_no_subcommand' -f -l help -s h -d 'show help' 16complete -c greet -n '__fish_greet_no_subcommand' -f -l version -s v -d 'print the version' 17complete -c greet -n '__fish_seen_subcommand_from config c' -f -l help -s h -d 'show help' 18complete -r -c greet -n '__fish_greet_no_subcommand' -a 'config c' -d 'another usage test' 19complete -c greet -n '__fish_seen_subcommand_from config c' -l flag -s fl -s f -r 20complete -c greet -n '__fish_seen_subcommand_from config c' -f -l another-flag -s b -d 'another usage text' 21complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l help -s h -d 'show help' 22complete -r -c greet -n '__fish_seen_subcommand_from config c' -a 'sub-config s ss' -d 'another usage test' 23complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-flag -s sub-fl -s s -r 24complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-command-flag -s s -d 'some usage text' 25complete -c greet -n '__fish_seen_subcommand_from info i in' -f -l help -s h -d 'show help' 26complete -r -c greet -n '__fish_greet_no_subcommand' -a 'info i in' -d 'retrieve generic information' 27complete -c greet -n '__fish_seen_subcommand_from some-command' -f -l help -s h -d 'show help' 28complete -r -c greet -n '__fish_greet_no_subcommand' -a 'some-command' 29