Version 2 is here! Gen
has come a long way from a simple function in my bashrc
. I've probably learned more Bash than anyone needs to know in making this, and it's been a lot of fun. Thank you to everyone who helped get me this far!
This release contains a major functionality change, and several small bug fixes:
Bug Fixes/Improvements:
- Realigned templates with original design intent. Only shell script support is hard-coded into
gen
.- Custom templates continue to be 100% optional, however,
gen
installs several examples by default. - My goal is to make the main script as simple as possible with the intent for streamlined scripting; not a replacement for robust boilerplate solutions.
- Custom templates continue to be 100% optional, however,
- Complete overhaul of error codes and exit statuses.
Gen
will now exit on errors with statuses that reflect the nature of the error. Please check out theman
page for more details.
Man
page is now complete.- The
man
includes details on exit statuses, a thorough explanation on howgen
selects an editor, the thought process for changing file permissions, and descriptions for all arguments.
- The
- Removed all
HereDocs
.- This is purely a style choice, however, HereDocs require actual tab characters to maintain readability. In practice, HereDocs (IMHO) become unreadable easily, so I did away with them entirely.
- I made several other small changes in the name of readability.
- Complete rework of the
create_file
function to handle all error cases ( hopefully ). - Complete rework of file permission assignments.
gen
now automatically ensures at least read/write permissions are given to the user. In practice, this should catch anyumask
errors, orread-only
filesystems.Gen
relies on the robust error handling ofchmod
and allows error messages fromchmod
to be printed.
- Deprecated
-x
option.-c
now handles all possible custom file permissions. ( Must use octal mode bits [ i.e.754
, etc. ] ).- I also added input validation to
-c
that confirm a user enter3
digits from0-7
. I may revisit this and attempt to include symbolic mode bits (u+rw
) as well.
- I also added input validation to
Moving forward:
- I'm working on adding workflows for automated testing. I have almost no knowledge of how this works, so this is mostly for me to learn. My goal would be more reliable commits.
- No features will be pushed/pulled that cannot pass
shellcheck
ANDset -o nounset
.