AutoYADM commit: 2025-05-02 18:45:13

This commit is contained in:
Daniel Fichtinger 2025-05-02 18:45:13 -04:00
parent 280592de23
commit 240cc37ac1

View file

@ -1,5 +1,5 @@
function newrepo --argument-names name function newrepo --argument-names name
argparse h/help p/private P/public s/srht g/github a/all -- $argv argparse h/help p/private P/public s/srht g/github a/all d/description= -- $argv
function help function help
echo Help menu echo Help menu
end end
@ -8,20 +8,35 @@ function newrepo --argument-names name
return 0 return 0
end end
# check that some visibility is set # check that some visibility is set
set -l error_messages set -l errors
set -l visibility
if not set -lq _flag_p && not set -lq _flag_P if not set -lq _flag_p && not set -lq _flag_P
set -a error_messages 'ERROR: Visibility must be either public or private!' set -a errors 'Visibility must be either public or private!'
else if set -lq _flag_p && not set -lq _flag_P
set visibility private
else if not set -lq _flag_p && set -lq _flag_P
set visibility public
else
set -a errors 'Only one visibility can be set!'
end end
# check that a provider is set # check that a provider is set
if not set -lq _flag_a && not set -lq _flag_s && not set -lq _flag_g 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!' set -a errors 'Provider must be set!'
else if set -lq _flag_a && set -lq _flag_s || set -lq _flag_g
set -a errors 'provider: all must be alone!'
end end
if test (count $error_messages) -ne 0 if test (count $errors) -ne 0
for i in $error_messages for i in $errors
echo $i echo ERROR: $i
end end
help help
return 1 return 1
end end
echo Proceed if set -lq _flag_s || set -lq _flag_a
set -l add
if set -lq _flag_d
set add --description $_flag_d
end
echo hut git create $name --visibility $visibility $add
end
end end