Skip to content

Commit

Permalink
feat(git): add gshg and gshng aliases
Browse files Browse the repository at this point in the history
Add new `gshg` and `gshng` aliases. These behave very similarly to their
non-"g" counterparts, `gsh` and `gshn`, with the following differences:
- They do not pass arguments through to the `git show` command.
- They allow passing a pattern to `__g-pick-commit` to filter the
  commits the user can choose from.
  • Loading branch information
gkalpak committed Jul 10, 2024
1 parent bcfaeea commit 723ff99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const DESC_REPLACEMENTS = {
'::__a-builds-dir': '(<.../angular/aio/aio-builds-setup>)',
'::__g-pick-branch --gkcu-returnOutput=1': '(interactively pick a branch)',
'::__g-pick-commit --gkcu-returnOutput=1': '(interactively pick a commit)',
'::__g-pick-commit --filter-commits="$1" --gkcu-returnOutput=1': '(interactively pick a filtered commit)',
};

const DEF_CODE = AliasSpecDefault.DEF_CODE = (cmd, cfg = {}) => stripIndentation(`
Expand Down Expand Up @@ -259,7 +260,9 @@ const ALIASES = {
gl1: new AliasDefault('git log --decorate --oneline $* || true'),
gl1g: new AliasDefault('git log --decorate --oneline | grep $*'),
gsh: new AliasDefault('git show ${*:::__g-pick-commit --gkcu-returnOutput=1}'),
gshg: new AliasDefault('git show ${0:::__g-pick-commit --filter-commits="$1" --gkcu-returnOutput=1}'),
gshn: new AliasDefault('git show --name-only ${*:::__g-pick-commit --gkcu-returnOutput=1}'),
gshng: new AliasDefault('git show --name-only ${0:::__g-pick-commit --filter-commits="$1" --gkcu-returnOutput=1}'),
gd: new AliasDefault('ngm-diff-wh $*'),
gdn: new AliasDefault('ngm-diff-wh --name-only $*'),
gdh: new AliasDefault('ngm-diff-wh HEAD $*'),
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@
"grs1": "./bin/git/grs1.js",
"gs": "./bin/git/gs.js",
"gsh": "./bin/git/gsh.js",
"gshg": "./bin/git/gshg.js",
"gshn": "./bin/git/gshn.js",
"gshng": "./bin/git/gshng.js",
"gst": "./bin/git/gst.js",
"gstk": "./bin/git/gstk.js",
"gstl": "./bin/git/gstl.js",
Expand Down

0 comments on commit 723ff99

Please sign in to comment.