@@ -3,24 +3,34 @@ module Commands
33 class Generate < Base
44 help "Generate the bash script and required files"
55
6- usage "bashly generate [--force --quiet --upgrade --wrap FUNCTION ]"
6+ usage "bashly generate [options ]"
77 usage "bashly generate (-h|--help)"
88
99 option "-f --force" , "Overwrite existing files"
1010 option "-q --quiet" , "Disable on-screen progress report"
1111 option "-u --upgrade" , "Upgrade all added library functions"
1212 option "-w --wrap FUNCTION" , "Wrap the entire script in a function so it can also be sourced"
13+ option "-e --env ENV" , "Force the generation environment (see BASHLY_ENV)"
1314
1415 environment "BASHLY_SOURCE_DIR" , "The path containing the bashly configuration and source files [default: src]"
1516 environment "BASHLY_TARGET_DIR" , "The path to use for creating the bash script [default: .]"
1617 environment "BASHLY_LIB_DIR" , "The path to use for upgrading library files, relative to the source dir [default: lib]"
1718 environment "BASHLY_STRICT" , "When not empty, enable bash strict mode (set -euo pipefail)"
19+ environment "BASHLY_ENV" , <<~EOF
20+ Set to 'production' or 'development':
21+ - production generate a smaller script, without file markers
22+ - development generate with file markers
23+
24+ Can be overridden with --env [default: development]
25+ EOF
1826
1927 example "bashly generate --force"
2028 example "bashly generate --wrap my_function"
2129
2230 def run
2331 validate_config
32+ ENV [ 'BASHLY_ENV' ] = args [ '--env' ] if args [ '--env' ]
33+ quiet_say "creating !txtgrn!production!txtrst! version" if Bashly . production?
2434 create_user_files
2535 upgrade_libs if args [ '--upgrade' ]
2636 create_master_script
0 commit comments