Add options to enable/disable hooks (sending mail, commit /etc/.git, save to database…) #7
Loading…
Reference in a new issue
No description provided.
Delete branch "options"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
With a few options we can choose (from configuration or on-the-fly) :
HOOK_MAIL=<0|1>
or--[no-]mail
: send an email, or notHOOK_DB=<0|1>
or--[no-]db
: save log in the database, or notHOOK_COMMIT=<0|1>
or--[no-]commit
: commit repository changes, or notDRY_RUN=<0|1>
or-n|--dry-run
: execute no hooks, but prit the options valuesI also want to change the prompt of the interactive mode to ask if hooks must be skipped or not, but I don't have any idea how yet.
I've figured it out 🎉
First we need to find out if the script is run in interactive mode or not.
If not, we just apply the options for the hooks.
If yes, each hook asks a question to run it or not. The default value is implied by the option.
I've also added a verbose mode to show the content of the mail, the DB query and the repositories diffs.
The "dry run" mode becomes silent. It "just" removes the hook execution.
The two of them applied together is useful to verify the general behaviour of the script without changing anything on the host.
I'm very satisfied with how it turned out.
Now I need to do a lot of testing on many Debian ans OpenBSD versions.
Now we can also customize the mail recipient on the fly!
I've added
--version
and--help
options.The help message gives a lot of informations, almost like a man page.
I've also improved the POSIX compatibility.
As discussed AFK, we'll explore a few changes :
/etc/motd
(keep the last few only)We also talked about removing the copyright notice from --help and keeping it in --version instead. As well as removing the version number from --help.
I will create an issue for the man(1) page.
new things to do :
WIP: Add options to enable/disable hooks (sending mail, commit /etc/.git, save to database…)to Add options to enable/disable hooks (sending mail, commit /etc/.git, save to database…)