AutoYADM commit: 2025-05-02 18:45:13
This commit is contained in:
parent
280592de23
commit
240cc37ac1
1 changed files with 23 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
echo Help menu
|
||||
end
|
||||
|
@ -8,20 +8,35 @@ function newrepo --argument-names name
|
|||
return 0
|
||||
end
|
||||
# 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
|
||||
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
|
||||
# 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!'
|
||||
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
|
||||
if test (count $error_messages) -ne 0
|
||||
for i in $error_messages
|
||||
echo $i
|
||||
if test (count $errors) -ne 0
|
||||
for i in $errors
|
||||
echo ERROR: $i
|
||||
end
|
||||
help
|
||||
return 1
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue