@@ -77,6 +77,10 @@ CHANGES_POSSIBLE=0
7777#  0: skip auto_bootstrap, 1: ask, 2: perform bootstrap, 3: prevent bootstrap
7878DO_BOOTSTRAP=0
7979
80+ #  flag to indicate if the program should be quiet or not
81+ #  YES: be quiet, NO: be more noisy
82+ QUIET=" NO" 
83+ 
8084function  main()  {
8185
8286  require_git
@@ -120,7 +124,7 @@ function main() {
120124          -a) #  used by list()
121125            LIST_ALL=" YES" 
122126          ;;
123-           -d) #  used by all commands
127+           -d|--debug ) #  used by all commands
124128            DEBUG=" YES" 
125129          ;;
126130          -f) #  used by init(), clone() and upgrade()
@@ -130,6 +134,9 @@ function main() {
130134            DO_LIST=" YES" 
131135            [[ " $YADM_COMMAND " =~  ^(clone| config)$ ]] &&  YADM_ARGS+=(" $1 " 
132136          ;;
137+           -q|--quiet) #  used by all commands
138+             QUIET=" YES" 
139+           ;;
133140          -w) #  used by init() and clone()
134141            YADM_WORK=" $( qualify_path " $2 " " work tree" ) " 
135142            shift 
@@ -246,7 +253,7 @@ function score_file() {
246253        record_template " $tgt " " $cmd " " $src " 
247254      else 
248255        debug " No supported template processor for template $src " 
249-         [ -n   " $loud " &&  echo  " No supported template processor for template $src " 
256+         [ " $QUIET "   =   " NO " &&  echo  " No supported template processor for template $src " 
250257      fi 
251258      return  0
252259    #  unsupported values
@@ -560,10 +567,6 @@ function alt() {
560567  local  local_distro_family
561568  set_local_alt_values
562569
563-   #  only be noisy if the "alt" command was run directly
564-   local  loud=
565-   [ " $YADM_COMMAND " =  " alt" &&  loud=" YES" 
566- 
567570  #  decide if a copy should be done instead of a symbolic link
568571  local  do_copy=0
569572  [ " $( config --bool yadm.alt-copy) " ==  " true" &&  do_copy=1
@@ -708,7 +711,7 @@ function alt_linking() {
708711    if  [ -n  " $template_cmd " ;  then 
709712      #  a template is defined, process the template
710713      debug " Creating $tgt  from template $src " 
711-       [ -n   " $loud " &&  echo  " Creating $tgt  from template $src " 
714+       [ " $QUIET "   =   " NO " &&  echo  " Creating $tgt  from template $src " 
712715      #  ensure the destination path exists
713716      assert_parent " $tgt " 
714717      #  remove any existing symlink before processing template
@@ -717,7 +720,7 @@ function alt_linking() {
717720    elif  [ -n  " $src " ;  then 
718721      #  a link source is defined, create symlink
719722      debug " Linking $src  to $tgt " 
720-       [ -n   " $loud " &&  echo  " Linking $src  to $tgt " 
723+       [ " $QUIET "   =   " NO " &&  echo  " Linking $src  to $tgt " 
721724      #  ensure the destination path exists
722725      assert_parent " $tgt " 
723726      if  [ " $do_copy " -eq  1 ];  then 
@@ -1174,6 +1177,11 @@ Commands:
11741177  yadm git-crypt [OPTIONS]   - Run git-crypt commands for the yadm repo 
11751178  yadm transcrypt [OPTIONS]  - Run transcrypt commands for the yadm repo 
11761179
1180+ General Options: 
1181+   --help                     - Display this help message 
1182+   -d, --debug                - Enable debug output 
1183+   -q, --quiet                - Suppress output 
1184+ 
11771185Files: 
11781186  \$ HOME/.config/yadm/config        - yadm's configuration file 
11791187  \$ HOME/.config/yadm/encrypt       - List of globs to encrypt/decrypt 
0 commit comments