dotfiles/.config/fish/functions/newrepo.fish

27 lines
798 B
Fish

function newrepo --argument-names name
argparse h/help p/private P/public s/srht g/github a/all -- $argv
function help
echo Help menu
end
if set -lq _flag_h || test (count $argv) -eq 0
help
return 0
end
# check that some visibility is set
set -l error_messages
if not set -lq _flag_p && not set -lq _flag_P
set -a error_messages 'ERROR: Visibility must be either public or private!'
end
# check that a provider is set
if not set -lq _flag_a && not set -lq _flag_s && not set -lq _flag_g
set -a error_messages 'ERROR: Provider must be set!'
end
if test (count $error_messages) -ne 0
for i in $error_messages
echo $i
end
help
return 1
end
echo Proceed
end