# Print an optspec for argparse to handle cmd's options that are independent of any subcommand. function __fish_fmerge_global_optspecs string join \n e/experimental h/help V/version end function __fish_fmerge_needs_command # Figure out if the current invocation already has a command. set -l cmd (commandline -opc) set -e cmd[1] argparse -s (__fish_fmerge_global_optspecs) -- $cmd 2>/dev/null or return if set -q argv[1] # Also print the command, so this can be used to figure out what it is. echo $argv[1] return 1 end return 0 end function __fish_fmerge_using_subcommand set -l cmd (__fish_fmerge_needs_command) test -z "$cmd" and return 1 contains -- $cmd[1] $argv end complete -c fmerge -n "__fish_fmerge_needs_command" -s e -l experimental -d 'enables experimental features' complete -c fmerge -n "__fish_fmerge_needs_command" -s h -l help -d 'Print help' complete -c fmerge -n "__fish_fmerge_needs_command" -s V -l version -d 'Print version' complete -c fmerge -n "__fish_fmerge_needs_command" -f -a "man" -d 'Renders the manual.' complete -c fmerge -n "__fish_fmerge_needs_command" -f -a "autocomplete" -d 'Renders shell completion scripts.' complete -c fmerge -n "__fish_fmerge_needs_command" -f -a "merge" -d 'Merge.' complete -c fmerge -n "__fish_fmerge_needs_command" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c fmerge -n "__fish_fmerge_using_subcommand man" -s o -l out -r complete -c fmerge -n "__fish_fmerge_using_subcommand man" -s f -l format -r -f -a "{manpages\t'',markdown\t''}" complete -c fmerge -n "__fish_fmerge_using_subcommand man" -s h -l help -d 'Print help' complete -c fmerge -n "__fish_fmerge_using_subcommand man" -s V -l version -d 'Print version' complete -c fmerge -n "__fish_fmerge_using_subcommand autocomplete" -s o -l out -r complete -c fmerge -n "__fish_fmerge_using_subcommand autocomplete" -s s -l shell -r -f -a "{bash\t'',zsh\t'',fish\t'',elvish\t'',powershell\t''}" complete -c fmerge -n "__fish_fmerge_using_subcommand autocomplete" -s h -l help -d 'Print help' complete -c fmerge -n "__fish_fmerge_using_subcommand autocomplete" -s V -l version -d 'Print version' complete -c fmerge -n "__fish_fmerge_using_subcommand merge" -s f -l file -r complete -c fmerge -n "__fish_fmerge_using_subcommand merge" -s r -l regex -r complete -c fmerge -n "__fish_fmerge_using_subcommand merge" -s h -l help -d 'Print help' complete -c fmerge -n "__fish_fmerge_using_subcommand merge" -s V -l version -d 'Print version' complete -c fmerge -n "__fish_fmerge_using_subcommand help; and not __fish_seen_subcommand_from man autocomplete merge help" -f -a "man" -d 'Renders the manual.' complete -c fmerge -n "__fish_fmerge_using_subcommand help; and not __fish_seen_subcommand_from man autocomplete merge help" -f -a "autocomplete" -d 'Renders shell completion scripts.' complete -c fmerge -n "__fish_fmerge_using_subcommand help; and not __fish_seen_subcommand_from man autocomplete merge help" -f -a "merge" -d 'Merge.' complete -c fmerge -n "__fish_fmerge_using_subcommand help; and not __fish_seen_subcommand_from man autocomplete merge help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'