An alternative to Comet with additional features.
The way I've changed the original is for it to look and feel more like Commitizen when invoking its sub-command commit. My only gripe was that the start-up speed was a tad on the slow side sometimes, given that it is Python, and that customizing the prompts wasn't as straight-forward as with Comet.
What I missed with Comet though was that Commitizen's commit by default keeps the values given for previous prompts on the screen, as seen in the demo, and that in and of itself was a major sticking point in continuing to use Comet.
Other minor changes include a fix to the prompt that asks for a commit message body that was misaligned and a check prior to running that confirms whether there are even any files that can be committed (i.e. are in the staging area). More improvements have been made in terms of customizing the character input limits for the scope, message, or setting a total one in general and having a visible character count for all limit types.
- using
go install:
go install github.com/usrme/cometary@latest-
download a binary from the releases page
-
build it yourself (requires Go 1.18+):
git clone https://github.com/usrme/cometary.git
cd cometary
go buildrm -f "${GOPATH}/bin/cometary"
rm -rf "${GOPATH}/pkg/mod/github.com/usrme/cometary*"There is an additional comet.json file that includes the prefixes and descriptions that I most prefer myself, which can be added to either the root of a repository, to one's home directory as .comet.json or to ${XDG_CONFIG_HOME}/cometary/config.json. Omitting this means that the same defaults are used as in the original.
- To adjust the character limit of the scope, add the key
scopeInputCharLimitwith the desired limit- Default: 16
- To adjust the character limit of the message, add the key
commitInputCharLimitwith the desired limit- Default: 100
- To adjust the total limit of characters in the resulting commit message, add the key
totalInputCharLimitwith the desired limit- Adding this key overrides scope- and message-specific limits
- To adjust the order of the scope completion values (i.e. longer or shorter strings first), add the key
scopeOrderCompletionwith either"ascending"or"descending"- Default:
"descending"
- Default:
- To enable the storing of runtime statistics, add the key
storeRuntimewith the valuetrue- Default:
false - This will create a
stats.jsonfile next to the configuration file with aggregated statistics across days, weeks, months, and years
- Default:
- To show the session runtime statistics after each commit, add the key
showRuntimewith the valuetrue- Default:
false - This will show
> Session: N secondsafter the commit was successful
- Default:
- To show the all-time runtime statistics after each commit, add the key
showStatswith the valuetrue- Default:
false - To just show the all-time runtime statistics and quit the program, run the program with the
-sflag
- Default:
- To adjust the format of the statistics from seconds to hours or minutes, add the key
showStatsFormatwith either"minutes"or"hours"- Default:
"seconds"
- Default:
- To always show session runtime statistics as seconds but keep everything else as defined by
showStatsFormat, add the keysessionStatAsSecondswith the valuetrue- Default:
false
- Default:
There is also a -m flag that takes a string that will be used as the basis for a search among all commit messages. For example: if you're committing something of a chore and always just use the message "update dependencies", you can do cometary -m update (use quotation marks if argument to -m includes spaces) and Cometary will populate the list of possible messages with those that include "update", which can then be cycled through with the Tab key. This is similar to the search you could make with git log --grep="update".
By default the -m flag behavior is set to only populate with possible messages that adhere to conventional commits, but this behavior can be changed by setting the findAllCommitMessages value in the configuration file as true.
Couldn't have been possible without the work of Liam Galvin.
