Skip to content

Instantly share code, notes, and snippets.

@bdmorin
Created September 20, 2024 18:51
Show Gist options
  • Save bdmorin/0053a71039b751fb935ec4c244172f2b to your computer and use it in GitHub Desktop.
Save bdmorin/0053a71039b751fb935ec4c244172f2b to your computer and use it in GitHub Desktop.
#!/usr/bin/env fish
# Strict Mode and Tracing
set -e
set -u
if set -q TRACE; and test "$TRACE" = 1
set -x
end
# Help Message
if test (count $argv) -gt 0; and test $argv[1] = '-h' -o $argv[1] = '--help'
echo 'Usage: ./script.fish arg-one arg-two'
echo 'This is an awesome fish script to make your life better.'
exit
end
# Main Function
function main
echo do awesome stuff
end
# Completion
complete -c $PROGRAM_NAME -n '__fish_use_subcommand' -a 'arg-one' -d 'The first argument'
complete -c $PROGRAM_NAME -n '__fish_use_subcommand' -a 'arg-two' -d 'The second argument'
# Call main function with arguments
main $argv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment