diff --git a/koji/README.md b/koji/README.md new file mode 100644 index 0000000..c3fc370 --- /dev/null +++ b/koji/README.md @@ -0,0 +1,80 @@ +--- +title: koji +homepage: https://github.com/its-danny/koji +tagline: | + 🦊 An interactive CLI for creating conventional commits. +--- + +To update or switch versions, run `webi koji@stable` (or `@v2`, `@beta`, etc). + +**Note**: You should install git before installing koji. + +## Files + +These are the files that are created and/or modified with this installer: + +``` +~/.config/envman/PATH.env +~/.local/bin/koji +~/.local/opt/koji-VERSION/bin/koji +``` + +## Cheat Sheet + +`koji` is an interactive CLI for creating +[conventional commits](https://www.conventionalcommits.org/en/v1.0.0/), ran in +place of `git commit`. + +### Using koji + +```bash +cd dev/work-stuff +# Do some work +cd dev/work-stuff +git add .env.production + +# Create a conventional commit with koji +# in place of `git commmit` +koji +``` + +### With emoji + +Passing `-e` or `--emoji` to `koji` will prepend your commit message with an +emoji related to the commit type. The default emoji can be seen +[here](https://github.com/its-danny/koji/blob/main/meta/config/koji-default.toml). + +You can also use shortcodes (`:pinched_fingers:`) in the scope, summary, or +body. + +### Autocomplete + +Passing `-a` or `--autocomplete` to `koji` will enable autocomplete for the +scope prompt. This scans your commit history to collect previous scopes, so it +does slow down the startup a bit. + +For reference, ran inside the [angular](https://github.com/angular/angular) repo +with 22k commits: + +``` +koji 0.00s +koji -a 0.40s +``` + +### As a git hook + +If you're using [rusty-hook](https://github.com/swellaby/rusty-hook), set this +in your `.rusty-hook.toml` file. + +```toml +prepare-commit-msg = "koji --hook" +``` + +Similar should work for any hook runner, just make sure you're using it with the +`prepare-commit-msg` hook as it writes the commit message to `COMMIT_EDITMSG`. + +### Use custom commit types + +You can add custom commit types via a `koji.toml` file in the working directory. +Some examples can be found +[here](https://github.com/its-danny/koji/blob/main/meta/config). diff --git a/koji/install.sh b/koji/install.sh new file mode 100644 index 0000000..ce1094c --- /dev/null +++ b/koji/install.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e +set -u + +pkg_cmd_name="koji" + +# IMPORTANT: this let's other functions know to expect this to be a single file +WEBI_SINGLE=true + +function pkg_get_current_version() { + # 'koji version' has output in this format: + # koji 1.3.4 + # This trims it down to just the version number: + # 1.3.4 + echo "$(koji --version 2> /dev/null | cut -c6-)" +} + +function pkg_install() { + # $HOME/.local/opt/koji-1.3.4/bin + mkdir -p "$pkg_src_bin" + + # mv ./koji* "$HOME/.local/opt/koji-1.3.4/bin/koji" + mv ./"$pkg_cmd_name"* "$pkg_src_cmd" + + # chmod a+x "$HOME/.local/opt/koji-1.3.4/bin/koji" + chmod a+x "$pkg_src_cmd" +} + +function pkg_link() { + # rm -f "$HOME/.local/bin/koji" + rm -f "$pkg_dst_cmd" + + # ln -s "$HOME/.local/opt/koji-1.3.4/bin/koji" "$HOME/.local/bin/koji" + ln -s "$pkg_src_cmd" "$pkg_dst_cmd" +} diff --git a/koji/releases.js b/koji/releases.js new file mode 100644 index 0000000..372c765 --- /dev/null +++ b/koji/releases.js @@ -0,0 +1,18 @@ +'use strict'; + +var github = require('../_common/github.js'); +var owner = 'its-danny'; +var repo = 'koji'; + +module.exports = function (request) { + return github(request, owner, repo).then(function (all) { + return all; + }); +}; + +if (module === require.main) { + module.exports(require('@root/request')).then(function (all) { + all = require('../_webi/normalize.js')(all); + console.info(JSON.stringify(all)); + }); +} diff --git a/test/install.sh b/test/install.sh index 3d55469..4fad9be 100644 --- a/test/install.sh +++ b/test/install.sh @@ -43,6 +43,7 @@ function __rmrf_local() { k9s \ keypairs \ kind \ + koji \ kubectx \ kubens \ lf \ @@ -133,6 +134,7 @@ function __rmrf_local() { k9s \ keypairs \ kind \ + koji \ kubectx \ kubens \ lf \ @@ -227,6 +229,7 @@ function __test() { k9s \ keypairs \ kind \ + koji \ kubectx \ kubens \ lf \