@@ -3,11 +3,12 @@ module Commands
33 class Generate < Base
44 help "Generate the bash script and required files"
55
6- usage "bashly generate [--force --wrap FUNCTION]"
6+ usage "bashly generate [--force --quiet -- wrap FUNCTION]"
77 usage "bashly generate (-h|--help)"
88
99 option "-f --force" , "Overwrite existing files"
1010 option "-w --wrap FUNCTION" , "Wrap the entire script in a function so it can also be sourced"
11+ option "-q --quiet" , "Less verbose output"
1112
1213 environment "BASHLY_SOURCE_DIR" , "The path containing the bashly configuration and source files [default: src]"
1314 environment "BASHLY_TARGET_DIR" , "The path to use for creating the bash script [default: .]"
@@ -18,13 +19,13 @@ class Generate < Base
1819 def run
1920 create_user_files
2021 create_master_script
21- say "run !txtpur!#{ master_script_path } --help!txtrst! to test your bash script"
22+ say "run !txtpur!#{ master_script_path } --help!txtrst! to test your bash script" unless args [ '--quiet' ]
2223 end
2324
2425 private
2526
2627 def create_user_files
27- say "creating user files in !txtgrn!#{ Settings . source_dir } "
28+ say "creating user files in !txtgrn!#{ Settings . source_dir } " unless args [ '--quiet' ]
2829
2930 create_file "#{ Settings . source_dir } /initialize.sh" , command . render ( :default_initialize_script )
3031
@@ -50,7 +51,7 @@ def create_all_command_files
5051
5152 def create_file ( file , content )
5253 if File . exist? file and !args [ '--force' ]
53- say "skipped !txtgrn!#{ file } !txtrst! (exists)"
54+ say "skipped !txtgrn!#{ file } !txtrst! (exists)" unless args [ '--quiet' ]
5455 else
5556 File . write file , content
5657 say "created !txtgrn!#{ file } "
@@ -60,7 +61,7 @@ def create_file(file, content)
6061 def create_master_script
6162 File . write master_script_path , script . code
6263 FileUtils . chmod "+x" , master_script_path
63- say "created !txtgrn!#{ master_script_path } "
64+ say "created !txtgrn!#{ master_script_path } " unless args [ '--quiet' ]
6465 end
6566
6667 def script
0 commit comments