From 240cc37ac19b463688278808a441185220f07010 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Fri, 2 May 2025 18:45:13 -0400 Subject: [PATCH] AutoYADM commit: 2025-05-02 18:45:13 --- .config/fish/functions/newrepo.fish | 31 +++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/.config/fish/functions/newrepo.fish b/.config/fish/functions/newrepo.fish index 0619ef4e..421a7340 100644 --- a/.config/fish/functions/newrepo.fish +++ b/.config/fish/functions/newrepo.fish @@ -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