function __fish_my_function_no_subcommand for i in (commandline -opc) if contains -- $i command:with:colons hello help list spaced return 1 end end return 0 end # global options complete -c script -n '__fish_my_function_no_subcommand' -l ansi -d 'Force ANSI output.' complete -c script -n '__fish_my_function_no_subcommand' -l help -d 'Display help for the given command. When no command is given display help for the list command.' complete -c script -n '__fish_my_function_no_subcommand' -l no-ansi -d 'Disable ANSI output.' complete -c script -n '__fish_my_function_no_subcommand' -l no-interaction -d 'Do not ask any interactive question.' complete -c script -n '__fish_my_function_no_subcommand' -l quiet -d 'Do not output any message.' complete -c script -n '__fish_my_function_no_subcommand' -l verbose -d 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.' complete -c script -n '__fish_my_function_no_subcommand' -l version -d 'Display this application version.' # commands complete -c script -f -n '__fish_my_function_no_subcommand' -a command:with:colons -d 'Test.' complete -c script -f -n '__fish_my_function_no_subcommand' -a hello -d 'Complete me please.' complete -c script -f -n '__fish_my_function_no_subcommand' -a help -d 'Displays help for a command.' complete -c script -f -n '__fish_my_function_no_subcommand' -a list -d 'Lists commands.' complete -c script -f -n '__fish_my_function_no_subcommand' -a spaced complete -c script -f -n '__fish_seen_subcommand_from spaced; and not __fish_seen_subcommand_from command' -a command -d 'Command with space in name.' # command options # command:with:colons complete -c script -n '__fish_seen_subcommand_from command:with:colons' -l goodbye -d '' # hello complete -c script -n '__fish_seen_subcommand_from hello' -l dangerous-option -d 'This $hould be `escaped`.' complete -c script -n '__fish_seen_subcommand_from hello' -l option-without-description -d '' # help # list # spaced command complete -c script -n '__fish_seen_subcommand_from spaced; and __fish_seen_subcommand_from command' -l goodbye -d ''