@gkalpak/aliases 0.13.1 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/config/cfgbash.js +1 -1
- package/bin/config/cfgbash.wsl.js +1 -1
- package/bin/config/cfggit.js +2 -1
- package/bin/config/cfggit.win32.js +2 -1
- package/bin/config/cfggit.wsl.js +2 -1
- package/bin/config/cfggpg.js +1 -1
- package/bin/config/cfgssh.js +1 -1
- package/bin/config/cfgvim.js +1 -1
- package/bin/config/cfgwsl.wsl.js +2 -2
- package/bin/git/gba.js +11 -0
- package/bin/git/gbdio.js +11 -0
- package/bin/git/gbdr.js +11 -0
- package/bin/git/gshg.js +11 -0
- package/bin/git/gshng.js +11 -0
- package/bin/misc/alv.js +1 -1
- package/lib/alias-scripts/g-pick-branch.js +52 -44
- package/lib/alias-scripts/g-pick-commit.js +25 -8
- package/lib/constants.js +11 -1
- package/package.json +163 -148
- package/scripts/test-pkg.js +1 -1
package/bin/config/cfgbash.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
/* eslint-disable max-len */
|
|
4
4
|
console.log(stripIndentation(`
|
|
5
|
-
### [Generated by: @gkalpak/aliases v0.13.
|
|
5
|
+
### [Generated by: @gkalpak/aliases v0.13.3]
|
|
6
6
|
### Copy the following into '~/.bashrc':
|
|
7
7
|
|
|
8
8
|
# Set up prompt.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
/* eslint-disable max-len */
|
|
4
4
|
console.log(stripIndentation(`
|
|
5
|
-
### [Generated by: @gkalpak/aliases v0.13.
|
|
5
|
+
### [Generated by: @gkalpak/aliases v0.13.3]
|
|
6
6
|
### Copy the following into '~/.bashrc':
|
|
7
7
|
|
|
8
8
|
# Set up prompt.
|
package/bin/config/cfggit.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.13.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.13.3]
|
|
5
5
|
### Run the following commands:
|
|
6
6
|
|
|
7
7
|
git config --global commit.gpgSign true
|
|
8
8
|
git config --global core.editor "vim"
|
|
9
9
|
git config --global credential.helper "manager"
|
|
10
|
+
git config --global init.defaultBranch "main"
|
|
10
11
|
git config --global merge.tool "kdiff3"
|
|
11
12
|
git config --global mergetool.kdiff3.path "/path/to/kdiff3"
|
|
12
13
|
git config --global mergetool.kdiff3.trustExitCode "false"
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.13.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.13.3]
|
|
5
5
|
### Run the following commands:
|
|
6
6
|
|
|
7
7
|
git config --global commit.gpgSign true
|
|
8
8
|
git config --global core.editor "vim"
|
|
9
9
|
git config --global credential.helper "manager"
|
|
10
|
+
git config --global init.defaultBranch "main"
|
|
10
11
|
git config --global merge.tool "kdiff3"
|
|
11
12
|
git config --global mergetool.kdiff3.path "C:/Program Files/KDiff3/bin/kdiff3.exe"
|
|
12
13
|
git config --global mergetool.kdiff3.trustExitCode "false"
|
package/bin/config/cfggit.wsl.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.13.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.13.3]
|
|
5
5
|
### Run the following commands:
|
|
6
6
|
|
|
7
7
|
git config --global commit.gpgSign true
|
|
8
8
|
git config --global core.editor "vim"
|
|
9
9
|
git config --global credential.helper "/mnt/c/Program\\ Files/Git/mingw64/bin/git-credential-manager.exe"
|
|
10
|
+
git config --global init.defaultBranch "main"
|
|
10
11
|
git config --global merge.tool "kdiff3"
|
|
11
12
|
git config --global mergetool.kdiff3.path "/mnt/c/Program Files/KDiff3/bin/kdiff3.exe"
|
|
12
13
|
git config --global mergetool.kdiff3.trustExitCode "false"
|
package/bin/config/cfggpg.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.13.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.13.3]
|
|
5
5
|
### Copy the following into '~/.gnupg/gpg-agent.conf':
|
|
6
6
|
|
|
7
7
|
default-cache-ttl 86400
|
package/bin/config/cfgssh.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.13.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.13.3]
|
|
5
5
|
### Copy the following into '~/.ssh/config':
|
|
6
6
|
|
|
7
7
|
IdentityFile ~/.ssh/id-rsa-gkalpak.ppk
|
package/bin/config/cfgvim.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import {readFileSync} from 'node:fs';
|
|
3
3
|
import {fileURLToPath} from 'node:url';
|
|
4
4
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
5
|
-
console.log('""" [Generated by: @gkalpak/aliases v0.13.
|
|
5
|
+
console.log('""" [Generated by: @gkalpak/aliases v0.13.3]');
|
|
6
6
|
console.log('""" Copy the following into \'~/.vimrc\':\n');
|
|
7
7
|
console.log(readFileSync(`${__dirname}/../../lib/assets/vimrc.txt`, 'utf8').trim() + '\n');
|
package/bin/config/cfgwsl.wsl.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.13.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.13.3]
|
|
5
5
|
### Copy the following into a root-owned, 600-mode '/etc/resolv.conf' file:
|
|
6
6
|
|
|
7
7
|
# Cloudflare
|
|
@@ -14,7 +14,7 @@ console.log(stripIndentation(`
|
|
|
14
14
|
|
|
15
15
|
-----
|
|
16
16
|
|
|
17
|
-
### [Generated by: @gkalpak/aliases v0.13.
|
|
17
|
+
### [Generated by: @gkalpak/aliases v0.13.3]
|
|
18
18
|
### Copy the following into a root-owned, 600-mode '/etc/wsl.conf' file:
|
|
19
19
|
|
|
20
20
|
[network]
|
package/bin/git/gba.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {commandUtils} from '@gkalpak/cli-utils';
|
|
3
|
+
import {isMain, onError} from '../../lib/utils.js';
|
|
4
|
+
// eslint-disable-next-line max-len
|
|
5
|
+
const cmd = 'git branch --all $*';
|
|
6
|
+
export default cmd;
|
|
7
|
+
if (isMain(import.meta.url)) {
|
|
8
|
+
const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
|
|
9
|
+
// eslint-disable-next-line quotes
|
|
10
|
+
commandUtils.run(cmd, args, Object.assign({"sapVersion":2}, config)).catch(onError);
|
|
11
|
+
}
|
package/bin/git/gbdio.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {commandUtils} from '@gkalpak/cli-utils';
|
|
3
|
+
import {isMain, onError} from '../../lib/utils.js';
|
|
4
|
+
// eslint-disable-next-line max-len
|
|
5
|
+
const cmd = 'git branch --delete --force ${1:::__g-pick-branch --gkcu-returnOutput=1} && git push --delete origin ${1:::__g-pick-branch --gkcu-returnOutput=1}';
|
|
6
|
+
export default cmd;
|
|
7
|
+
if (isMain(import.meta.url)) {
|
|
8
|
+
const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
|
|
9
|
+
// eslint-disable-next-line quotes
|
|
10
|
+
commandUtils.run(cmd, args, Object.assign({"sapVersion":2}, config)).catch(onError);
|
|
11
|
+
}
|
package/bin/git/gbdr.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {commandUtils} from '@gkalpak/cli-utils';
|
|
3
|
+
import {isMain, onError} from '../../lib/utils.js';
|
|
4
|
+
// eslint-disable-next-line max-len
|
|
5
|
+
const cmd = 'git push --delete ${*:::__g-pick-branch --remote --gkcu-returnOutput=1}';
|
|
6
|
+
export default cmd;
|
|
7
|
+
if (isMain(import.meta.url)) {
|
|
8
|
+
const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
|
|
9
|
+
// eslint-disable-next-line quotes
|
|
10
|
+
commandUtils.run(cmd, args, Object.assign({"sapVersion":2}, config)).catch(onError);
|
|
11
|
+
}
|
package/bin/git/gshg.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {commandUtils} from '@gkalpak/cli-utils';
|
|
3
|
+
import {isMain, onError} from '../../lib/utils.js';
|
|
4
|
+
// eslint-disable-next-line max-len
|
|
5
|
+
const cmd = 'git show ${0:::__g-pick-commit --filter-commits="$1" --gkcu-returnOutput=1}';
|
|
6
|
+
export default cmd;
|
|
7
|
+
if (isMain(import.meta.url)) {
|
|
8
|
+
const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
|
|
9
|
+
// eslint-disable-next-line quotes
|
|
10
|
+
commandUtils.run(cmd, args, Object.assign({"sapVersion":2}, config)).catch(onError);
|
|
11
|
+
}
|
package/bin/git/gshng.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {commandUtils} from '@gkalpak/cli-utils';
|
|
3
|
+
import {isMain, onError} from '../../lib/utils.js';
|
|
4
|
+
// eslint-disable-next-line max-len
|
|
5
|
+
const cmd = 'git show --name-only ${0:::__g-pick-commit --filter-commits="$1" --gkcu-returnOutput=1}';
|
|
6
|
+
export default cmd;
|
|
7
|
+
if (isMain(import.meta.url)) {
|
|
8
|
+
const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
|
|
9
|
+
// eslint-disable-next-line quotes
|
|
10
|
+
commandUtils.run(cmd, args, Object.assign({"sapVersion":2}, config)).catch(onError);
|
|
11
|
+
}
|
package/bin/misc/alv.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
console.log('@gkalpak/aliases v0.13.
|
|
2
|
+
console.log('@gkalpak/aliases v0.13.3');
|
|
@@ -5,6 +5,11 @@ import {importWithEnv} from '../utils.js';
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
// Constants
|
|
8
|
+
const branchNameSuffices = {
|
|
9
|
+
'': '',
|
|
10
|
+
'*': ' (current)',
|
|
11
|
+
'+': ' (other worktree)',
|
|
12
|
+
};
|
|
8
13
|
const internal = {
|
|
9
14
|
_gPickBranch,
|
|
10
15
|
};
|
|
@@ -15,12 +20,16 @@ export {
|
|
|
15
20
|
* @function gPickBranch
|
|
16
21
|
*
|
|
17
22
|
* @description
|
|
18
|
-
* Prompt the user to pick one of the available git branches via an interactive list.
|
|
23
|
+
* Prompt the user to pick one of the available git branches via an interactive list. By default, local branches are
|
|
24
|
+
* shown, but this can be optionally switched to remote branches only. Supported runtime arguments:
|
|
25
|
+
* - `--remote` [flag]: Only show remote branches when present (otherwise only show local branches).
|
|
19
26
|
*
|
|
27
|
+
* @param {string[]} [runtimeArgs=[]] - The runtime arguments.
|
|
20
28
|
* @param {IRunConfig} [config={}] - A configuration object. See {@link commandUtils#IRunConfig} for more details.
|
|
21
29
|
*
|
|
22
30
|
* @return {Promise<void|string>} - A promise that resolves to either `undefined` or the selected branch (depending on
|
|
23
|
-
* the value of `config.returnOutput`).
|
|
31
|
+
* the value of `config.returnOutput`). When switched to remote branches only the selected branch consists of the
|
|
32
|
+
* remote name, followed by a space, followed by the actual branch name (for example, `origin some-branch`).
|
|
24
33
|
*/
|
|
25
34
|
gPickBranch,
|
|
26
35
|
|
|
@@ -31,16 +40,18 @@ export {
|
|
|
31
40
|
};
|
|
32
41
|
|
|
33
42
|
// Helpers
|
|
34
|
-
async function _gPickBranch(config) {
|
|
43
|
+
async function _gPickBranch(runtimeArgs = [], config = {}) {
|
|
35
44
|
const gbConfig = Object.assign({}, config, {returnOutput: true});
|
|
45
|
+
const branchType = runtimeArgs.includes('--remote') ? 'remote' : 'local';
|
|
36
46
|
|
|
37
47
|
if (config.dryrun) {
|
|
38
|
-
console.log(
|
|
48
|
+
console.log(`Pick one from a list of ${branchType} branches.`);
|
|
39
49
|
return;
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
const branchOutput = await commandUtils.run('git branch', [], gbConfig);
|
|
43
|
-
const
|
|
52
|
+
const branchOutput = await commandUtils.run('git branch --all', [], gbConfig);
|
|
53
|
+
const branches = processBranches(branchOutput).filter(({remote}) => remote === (branchType === 'remote'));
|
|
54
|
+
const branch = await pickBranch(branchType, branches);
|
|
44
55
|
|
|
45
56
|
if (config.returnOutput) {
|
|
46
57
|
return branch;
|
|
@@ -49,49 +60,19 @@ async function _gPickBranch(config) {
|
|
|
49
60
|
console.log(branch);
|
|
50
61
|
}
|
|
51
62
|
|
|
52
|
-
function gPickBranch(config) {
|
|
53
|
-
return internal._gPickBranch(config);
|
|
63
|
+
function gPickBranch(runtimeArgs, config) {
|
|
64
|
+
return internal._gPickBranch(runtimeArgs, config);
|
|
54
65
|
}
|
|
55
66
|
|
|
56
|
-
function main(
|
|
57
|
-
return gPickBranch(config);
|
|
67
|
+
function main(runtimeArgs, config) {
|
|
68
|
+
return gPickBranch(runtimeArgs, config);
|
|
58
69
|
}
|
|
59
70
|
|
|
60
|
-
async function pickBranch(
|
|
71
|
+
async function pickBranch(branchType, branches) {
|
|
61
72
|
// Ensure colors are always used (even when running with `returnOutput: <number>`).
|
|
62
73
|
const {default: inquirer} = await importWithEnv(() => import('inquirer'), {FORCE_COLOR: '1'});
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
const branches = branchesStr.
|
|
66
|
-
split('\n').
|
|
67
|
-
map(line => line.trim()).
|
|
68
|
-
filter(Boolean).
|
|
69
|
-
map((branch, i) => {
|
|
70
|
-
const [, specialSymbol = '', branchName] = /^(?:([*+])\s*)?(\S.*)$/.exec(branch);
|
|
71
|
-
let displayName = branchName.replace(/^(gcoghpr)-(.*)$/, '[$1] $2');
|
|
72
|
-
|
|
73
|
-
switch (specialSymbol) {
|
|
74
|
-
case '':
|
|
75
|
-
break;
|
|
76
|
-
case '*':
|
|
77
|
-
currentBranchIdx = i;
|
|
78
|
-
displayName += ' (current)';
|
|
79
|
-
break;
|
|
80
|
-
case '+':
|
|
81
|
-
displayName += ' (other worktree)';
|
|
82
|
-
break;
|
|
83
|
-
default:
|
|
84
|
-
throw new Error(`Unexpected branch prefix symbol: ${specialSymbol}`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
name: displayName,
|
|
89
|
-
value: branchName,
|
|
90
|
-
short: branchName,
|
|
91
|
-
};
|
|
92
|
-
}).
|
|
93
|
-
sort((a, b) => (a.name > b.name) ? 1 : -1).
|
|
94
|
-
concat(new inquirer.Separator());
|
|
75
|
+
const currentBranchIdx = Math.max(0, branches.findIndex(({name}) => name.endsWith(branchNameSuffices['*'])));
|
|
95
76
|
|
|
96
77
|
const unlisten = processUtils.doOnExit(process, code => {
|
|
97
78
|
if (code === 0) {
|
|
@@ -107,8 +88,8 @@ async function pickBranch(branchesStr) {
|
|
|
107
88
|
{
|
|
108
89
|
type: 'list',
|
|
109
90
|
name: 'branch',
|
|
110
|
-
message:
|
|
111
|
-
choices: branches,
|
|
91
|
+
message: `Pick a ${branchType} branch:`,
|
|
92
|
+
choices: branches.concat(new inquirer.Separator()),
|
|
112
93
|
default: currentBranchIdx,
|
|
113
94
|
},
|
|
114
95
|
]);
|
|
@@ -118,3 +99,30 @@ async function pickBranch(branchesStr) {
|
|
|
118
99
|
unlisten();
|
|
119
100
|
}
|
|
120
101
|
}
|
|
102
|
+
|
|
103
|
+
function processBranches(branchesStr) {
|
|
104
|
+
return branchesStr.
|
|
105
|
+
split('\n').
|
|
106
|
+
map(line => line.trim()).
|
|
107
|
+
// Filter out empty lines and `HEAD` "aliases".
|
|
108
|
+
filter(line => (line.length > 0) && !line.includes('/HEAD -> ')).
|
|
109
|
+
map(branch => {
|
|
110
|
+
const [, specialSymbol = '', remote = false, branchName] = /^(?:([*+])\s*)?(remotes\/)?(\S.*)$/.exec(branch);
|
|
111
|
+
const branchNameSuffix = branchNameSuffices[specialSymbol];
|
|
112
|
+
|
|
113
|
+
if (branchNameSuffix === undefined) {
|
|
114
|
+
throw new Error(`Unexpected branch prefix symbol: ${specialSymbol}`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const displayName = branchName.replace(/^(gcoghpr)-(.*)$/, '[$1] $2') + branchNameSuffix;
|
|
118
|
+
const isRemote = remote !== false;
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
name: displayName,
|
|
122
|
+
short: branchName,
|
|
123
|
+
value: isRemote ? branchName.replace('/', ' ') : branchName,
|
|
124
|
+
remote: isRemote,
|
|
125
|
+
};
|
|
126
|
+
}).
|
|
127
|
+
sort((a, b) => (a.name > b.name) ? 1 : -1);
|
|
128
|
+
}
|
|
@@ -15,8 +15,11 @@ export {
|
|
|
15
15
|
* @function gPickCommit
|
|
16
16
|
*
|
|
17
17
|
* @description
|
|
18
|
-
* Prompt the user to pick one of the available git commits via an interactive list.
|
|
18
|
+
* Prompt the user to pick one of the available git commits via an interactive list. Optionally, filter the commits
|
|
19
|
+
* based on the commit message. Supported runtime arguments:
|
|
20
|
+
* - `--filter-commits` [string]: A basic pattern to filter commit messages (case-sensitive).
|
|
19
21
|
*
|
|
22
|
+
* @param {string[]} [runtimeArgs=[]] - The runtime arguments.
|
|
20
23
|
* @param {IRunConfig} [config={}] - A configuration object. See {@link commandUtils#IRunConfig} for more details.
|
|
21
24
|
*
|
|
22
25
|
* @return {Promise<void|string>} - A promise that resolves to either `undefined` or the selected commit (depending on
|
|
@@ -31,15 +34,29 @@ export {
|
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
// Helpers
|
|
34
|
-
async function _gPickCommit(config) {
|
|
37
|
+
async function _gPickCommit(runtimeArgs = [], config = {}) {
|
|
38
|
+
const maxCommits = 50;
|
|
35
39
|
const glConfig = Object.assign({}, config, {returnOutput: true});
|
|
40
|
+
let glCmd = 'git log --oneline';
|
|
41
|
+
|
|
42
|
+
const filterCommitsPattern =
|
|
43
|
+
(runtimeArgs.find((_arg, idx, arr) => (idx > 0) && (arr[idx - 1] === '--filter-commits')) ??
|
|
44
|
+
runtimeArgs.find(arg => arg.startsWith('--filter-commits='))?.slice('--filter-commits='.length))?.
|
|
45
|
+
replace(/^(['"])(.*)\1$/, '$2');
|
|
46
|
+
if (filterCommitsPattern !== undefined) {
|
|
47
|
+
glCmd += ` | grep "${filterCommitsPattern}"`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
glCmd += ` --max-count=${maxCommits}`; // `--max-count` works both for `git log` and `grep`.
|
|
36
51
|
|
|
37
52
|
if (config.dryrun) {
|
|
38
|
-
console.log(
|
|
53
|
+
console.log(
|
|
54
|
+
`Pick one from the first ${maxCommits} commits` +
|
|
55
|
+
`${(filterCommitsPattern === undefined) ? '' : ` whose header matches '${filterCommitsPattern}'`}.`);
|
|
39
56
|
return;
|
|
40
57
|
}
|
|
41
58
|
|
|
42
|
-
const commitOutput = await commandUtils.run(
|
|
59
|
+
const commitOutput = await commandUtils.run(glCmd, [], glConfig);
|
|
43
60
|
const commit = await pickCommit(commitOutput);
|
|
44
61
|
|
|
45
62
|
if (config.returnOutput) {
|
|
@@ -49,12 +66,12 @@ async function _gPickCommit(config) {
|
|
|
49
66
|
console.log(commit);
|
|
50
67
|
}
|
|
51
68
|
|
|
52
|
-
function gPickCommit(config) {
|
|
53
|
-
return internal._gPickCommit(config);
|
|
69
|
+
function gPickCommit(runtimeArgs, config) {
|
|
70
|
+
return internal._gPickCommit(runtimeArgs, config);
|
|
54
71
|
}
|
|
55
72
|
|
|
56
|
-
function main(
|
|
57
|
-
return gPickCommit(config);
|
|
73
|
+
function main(runtimeArgs, config) {
|
|
74
|
+
return gPickCommit(runtimeArgs, config);
|
|
58
75
|
}
|
|
59
76
|
|
|
60
77
|
async function pickCommit(commitsStr) {
|
package/lib/constants.js
CHANGED
|
@@ -38,8 +38,10 @@ const DESC_REPLACEMENTS = {
|
|
|
38
38
|
[AliasUnknown.DESCRIPTION]: '???',
|
|
39
39
|
'::gdefb': '<default-branch>',
|
|
40
40
|
'::__a-builds-dir': '(<.../angular/aio/aio-builds-setup>)',
|
|
41
|
-
'::__g-pick-branch --gkcu-returnOutput=1': '(interactively pick a branch)',
|
|
41
|
+
'::__g-pick-branch --gkcu-returnOutput=1': '(interactively pick a local branch)',
|
|
42
|
+
'::__g-pick-branch --remote --gkcu-returnOutput=1': '(interactively pick a remote branch)',
|
|
42
43
|
'::__g-pick-commit --gkcu-returnOutput=1': '(interactively pick a commit)',
|
|
44
|
+
'::__g-pick-commit --filter-commits="$1" --gkcu-returnOutput=1': '(interactively pick a filtered commit)',
|
|
43
45
|
};
|
|
44
46
|
|
|
45
47
|
const DEF_CODE = AliasSpecDefault.DEF_CODE = (cmd, cfg = {}) => stripIndentation(`
|
|
@@ -104,6 +106,7 @@ const CFGGIT_SPEC = (credHelper, kdiff3Path) => new AliasSpec(
|
|
|
104
106
|
git config --global commit.gpgSign true
|
|
105
107
|
git config --global core.editor "vim"
|
|
106
108
|
git config --global credential.helper "${credHelper}"
|
|
109
|
+
git config --global init.defaultBranch "main"
|
|
107
110
|
git config --global merge.tool "kdiff3"
|
|
108
111
|
git config --global mergetool.kdiff3.path "${kdiff3Path}"
|
|
109
112
|
git config --global mergetool.kdiff3.trustExitCode "false"
|
|
@@ -258,7 +261,9 @@ const ALIASES = {
|
|
|
258
261
|
gl1: new AliasDefault('git log --decorate --oneline $* || true'),
|
|
259
262
|
gl1g: new AliasDefault('git log --decorate --oneline | grep $*'),
|
|
260
263
|
gsh: new AliasDefault('git show ${*:::__g-pick-commit --gkcu-returnOutput=1}'),
|
|
264
|
+
gshg: new AliasDefault('git show ${0:::__g-pick-commit --filter-commits="$1" --gkcu-returnOutput=1}'),
|
|
261
265
|
gshn: new AliasDefault('git show --name-only ${*:::__g-pick-commit --gkcu-returnOutput=1}'),
|
|
266
|
+
gshng: new AliasDefault('git show --name-only ${0:::__g-pick-commit --filter-commits="$1" --gkcu-returnOutput=1}'),
|
|
262
267
|
gd: new AliasDefault('ngm-diff-wh $*'),
|
|
263
268
|
gdn: new AliasDefault('ngm-diff-wh --name-only $*'),
|
|
264
269
|
gdh: new AliasDefault('ngm-diff-wh HEAD $*'),
|
|
@@ -310,10 +315,15 @@ const ALIASES = {
|
|
|
310
315
|
|
|
311
316
|
// BRANCH
|
|
312
317
|
gb: new AliasDefault('git branch $*'),
|
|
318
|
+
gba: new AliasDefault('git branch --all $*'),
|
|
313
319
|
gbc: new AliasDefault(GIT_CREATE_BRANCH_CMD('${2:HEAD}')),
|
|
314
320
|
gbcd: new AliasDefault(GIT_CREATE_BRANCH_CMD('${0:::gdefb}')),
|
|
315
321
|
gbco: new AliasDefault(`git fetch origin $1 && ${GIT_CREATE_BRANCH_CMD('origin/$1')}`),
|
|
316
322
|
gbd: new AliasDefault('git branch --delete --force ${*:::__g-pick-branch --gkcu-returnOutput=1}'),
|
|
323
|
+
gbdr: new AliasDefault('git push --delete ${*:::__g-pick-branch --remote --gkcu-returnOutput=1}'),
|
|
324
|
+
gbdio: new AliasDefault(
|
|
325
|
+
'git branch --delete --force ${1:::__g-pick-branch --gkcu-returnOutput=1} && ' +
|
|
326
|
+
'git push --delete origin ${1:::__g-pick-branch --gkcu-returnOutput=1}'),
|
|
317
327
|
|
|
318
328
|
// PULL(-REBASE)
|
|
319
329
|
gpr: new AliasDefault('git pull --rebase $*'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gkalpak/aliases",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"description": "My global aliases.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Utility"
|
|
@@ -31,150 +31,155 @@
|
|
|
31
31
|
"~~test-unit": "jasmine test/unit/**/*.spec.js"
|
|
32
32
|
},
|
|
33
33
|
"bin": {
|
|
34
|
-
"__a-builds-dir": "
|
|
35
|
-
"__g-pick-branch": "
|
|
36
|
-
"__g-pick-commit": "
|
|
37
|
-
"aioall": "
|
|
38
|
-
"aioatt": "
|
|
39
|
-
"aiobd": "
|
|
40
|
-
"aiord": "
|
|
41
|
-
"aiorm": "
|
|
42
|
-
"alv": "
|
|
43
|
-
"cfgbash": "
|
|
44
|
-
"cfggit": "
|
|
45
|
-
"cfggpg": "
|
|
46
|
-
"cfgssh": "
|
|
47
|
-
"cfgvim": "
|
|
48
|
-
"cfgwsl": "
|
|
49
|
-
"dkrall": "
|
|
50
|
-
"dkratt": "
|
|
51
|
-
"dkrbd": "
|
|
52
|
-
"dkrrd": "
|
|
53
|
-
"dkrrm": "
|
|
54
|
-
"gaa": "
|
|
55
|
-
"gb": "
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"
|
|
34
|
+
"__a-builds-dir": "bin/aio/__a-builds-dir.js",
|
|
35
|
+
"__g-pick-branch": "bin/git/__g-pick-branch.js",
|
|
36
|
+
"__g-pick-commit": "bin/git/__g-pick-commit.js",
|
|
37
|
+
"aioall": "bin/aio/aioall.js",
|
|
38
|
+
"aioatt": "bin/aio/aioatt.js",
|
|
39
|
+
"aiobd": "bin/aio/aiobd.js",
|
|
40
|
+
"aiord": "bin/aio/aiord.js",
|
|
41
|
+
"aiorm": "bin/aio/aiorm.js",
|
|
42
|
+
"alv": "bin/misc/alv.js",
|
|
43
|
+
"cfgbash": "bin/config/cfgbash.js",
|
|
44
|
+
"cfggit": "bin/config/cfggit.js",
|
|
45
|
+
"cfggpg": "bin/config/cfggpg.js",
|
|
46
|
+
"cfgssh": "bin/config/cfgssh.js",
|
|
47
|
+
"cfgvim": "bin/config/cfgvim.js",
|
|
48
|
+
"cfgwsl": "bin/config/cfgwsl.js",
|
|
49
|
+
"dkrall": "bin/docker/dkrall.js",
|
|
50
|
+
"dkratt": "bin/docker/dkratt.js",
|
|
51
|
+
"dkrbd": "bin/docker/dkrbd.js",
|
|
52
|
+
"dkrrd": "bin/docker/dkrrd.js",
|
|
53
|
+
"dkrrm": "bin/docker/dkrrm.js",
|
|
54
|
+
"gaa": "bin/git/gaa.js",
|
|
55
|
+
"gb": "bin/git/gb.js",
|
|
56
|
+
"gba": "bin/git/gba.js",
|
|
57
|
+
"gbc": "bin/git/gbc.js",
|
|
58
|
+
"gbcd": "bin/git/gbcd.js",
|
|
59
|
+
"gbco": "bin/git/gbco.js",
|
|
60
|
+
"gbd": "bin/git/gbd.js",
|
|
61
|
+
"gbdio": "bin/git/gbdio.js",
|
|
62
|
+
"gbdr": "bin/git/gbdr.js",
|
|
63
|
+
"gcl": "bin/git/gcl.js",
|
|
64
|
+
"gcm": "bin/git/gcm.js",
|
|
65
|
+
"gcma": "bin/git/gcma.js",
|
|
66
|
+
"gcmane": "bin/git/gcmane.js",
|
|
67
|
+
"gcmf": "bin/git/gcmf.js",
|
|
68
|
+
"gcmfc": "bin/git/gcmfc.js",
|
|
69
|
+
"gcmfs": "bin/git/gcmfs.js",
|
|
70
|
+
"gcmi": "bin/git/gcmi.js",
|
|
71
|
+
"gcmia": "bin/git/gcmia.js",
|
|
72
|
+
"gcmiane": "bin/git/gcmiane.js",
|
|
73
|
+
"gcmif": "bin/git/gcmif.js",
|
|
74
|
+
"gcmifc": "bin/git/gcmifc.js",
|
|
75
|
+
"gcmifs": "bin/git/gcmifs.js",
|
|
76
|
+
"gco": "bin/git/gco.js",
|
|
77
|
+
"gcod": "bin/git/gcod.js",
|
|
78
|
+
"gcoghpr": "bin/git/gcoghpr.js",
|
|
79
|
+
"gcoghpr-cleanup": "bin/git/gcoghpr-cleanup.js",
|
|
80
|
+
"gcopr": "bin/git/gcopr.js",
|
|
81
|
+
"gcp": "bin/git/gcp.js",
|
|
82
|
+
"gcpa": "bin/git/gcpa.js",
|
|
83
|
+
"gcpc": "bin/git/gcpc.js",
|
|
84
|
+
"gcpx": "bin/git/gcpx.js",
|
|
85
|
+
"gcpxl": "bin/git/gcpxl.js",
|
|
86
|
+
"gd": "bin/git/gd.js",
|
|
87
|
+
"gd1": "bin/git/gd1.js",
|
|
88
|
+
"gdn": "bin/git/gdn.js",
|
|
89
|
+
"gdefb": "bin/git/gdefb.js",
|
|
90
|
+
"gdn1": "bin/git/gdn1.js",
|
|
91
|
+
"gdnh": "bin/git/gdnh.js",
|
|
92
|
+
"gdh": "bin/git/gdh.js",
|
|
93
|
+
"gl": "bin/git/gl.js",
|
|
94
|
+
"gl1": "bin/git/gl1.js",
|
|
95
|
+
"gl1g": "bin/git/gl1g.js",
|
|
96
|
+
"gmt": "bin/git/gmt.js",
|
|
97
|
+
"gngprh": "bin/git/gngprh.js",
|
|
98
|
+
"gngprm": "bin/git/gngprm.js",
|
|
99
|
+
"gp": "bin/git/gp.js",
|
|
100
|
+
"gp1": "bin/git/gp1.js",
|
|
101
|
+
"gpf": "bin/git/gpf.js",
|
|
102
|
+
"gpr": "bin/git/gpr.js",
|
|
103
|
+
"gpro": "bin/git/gpro.js",
|
|
104
|
+
"gprod": "bin/git/gprod.js",
|
|
105
|
+
"gpru": "bin/git/gpru.js",
|
|
106
|
+
"gprud": "bin/git/gprud.js",
|
|
107
|
+
"grb": "bin/git/grb.js",
|
|
108
|
+
"grba": "bin/git/grba.js",
|
|
109
|
+
"grbc": "bin/git/grbc.js",
|
|
110
|
+
"grbd": "bin/git/grbd.js",
|
|
111
|
+
"grbi": "bin/git/grbi.js",
|
|
112
|
+
"grbia": "bin/git/grbia.js",
|
|
113
|
+
"grbin": "bin/git/grbin.js",
|
|
114
|
+
"grs": "bin/git/grs.js",
|
|
115
|
+
"grs1": "bin/git/grs1.js",
|
|
116
|
+
"gs": "bin/git/gs.js",
|
|
117
|
+
"gsh": "bin/git/gsh.js",
|
|
118
|
+
"gshg": "bin/git/gshg.js",
|
|
119
|
+
"gshn": "bin/git/gshn.js",
|
|
120
|
+
"gshng": "bin/git/gshng.js",
|
|
121
|
+
"gst": "bin/git/gst.js",
|
|
122
|
+
"gstk": "bin/git/gstk.js",
|
|
123
|
+
"gstl": "bin/git/gstl.js",
|
|
124
|
+
"gstm": "bin/git/gstm.js",
|
|
125
|
+
"gstp": "bin/git/gstp.js",
|
|
126
|
+
"gsync": "bin/git/gsync.js",
|
|
127
|
+
"halp": "bin/misc/halp.js",
|
|
128
|
+
"ll": "bin/misc/ll.js",
|
|
129
|
+
"lla": "bin/misc/lla.js",
|
|
130
|
+
"nad": "bin/node/nad.js",
|
|
131
|
+
"naga": "bin/node/naga.js",
|
|
132
|
+
"nap": "bin/node/nap.js",
|
|
133
|
+
"niin": "bin/node/niin.js",
|
|
134
|
+
"nls": "bin/node/nls.js",
|
|
135
|
+
"nls1": "bin/node/nls1.js",
|
|
136
|
+
"nlsg": "bin/node/nlsg.js",
|
|
137
|
+
"nlsg1": "bin/node/nlsg1.js",
|
|
138
|
+
"nr": "bin/node/nr.js",
|
|
139
|
+
"nrd": "bin/node/nrd.js",
|
|
140
|
+
"nrin": "bin/node/nrin.js",
|
|
141
|
+
"nrp": "bin/node/nrp.js",
|
|
142
|
+
"nrx": "bin/node/nrx.js",
|
|
143
|
+
"ns": "bin/node/ns.js",
|
|
144
|
+
"nsin": "bin/node/nsin.js",
|
|
145
|
+
"nsx": "bin/node/nsx.js",
|
|
146
|
+
"nt": "bin/node/nt.js",
|
|
147
|
+
"ntin": "bin/node/ntin.js",
|
|
148
|
+
"ntx": "bin/node/ntx.js",
|
|
149
|
+
"nua": "bin/node/nua.js",
|
|
150
|
+
"nud": "bin/node/nud.js",
|
|
151
|
+
"nup": "bin/node/nup.js",
|
|
152
|
+
"nv": "bin/node/nv.js",
|
|
153
|
+
"nvls": "bin/node/nvls.js",
|
|
154
|
+
"nvlsa": "bin/node/nvlsa.js",
|
|
155
|
+
"nvmup": "bin/node/nvmup.js",
|
|
156
|
+
"nvu": "bin/node/nvu.js",
|
|
157
|
+
"osv": "bin/misc/osv.js",
|
|
158
|
+
"salfup": "bin/misc/salfup.js",
|
|
159
|
+
"srv": "bin/node/srv.js",
|
|
160
|
+
"srvw": "bin/node/srvw.js",
|
|
161
|
+
"yad": "bin/node/yad.js",
|
|
162
|
+
"yaga": "bin/node/yaga.js",
|
|
163
|
+
"yap": "bin/node/yap.js",
|
|
164
|
+
"yiin": "bin/node/yiin.js",
|
|
165
|
+
"yls": "bin/node/yls.js",
|
|
166
|
+
"yls1": "bin/node/yls1.js",
|
|
167
|
+
"ylsg": "bin/node/ylsg.js",
|
|
168
|
+
"ylsg1": "bin/node/ylsg1.js",
|
|
169
|
+
"yr": "bin/node/yr.js",
|
|
170
|
+
"yrd": "bin/node/yrd.js",
|
|
171
|
+
"yrin": "bin/node/yrin.js",
|
|
172
|
+
"yrp": "bin/node/yrp.js",
|
|
173
|
+
"yrx": "bin/node/yrx.js",
|
|
174
|
+
"ys": "bin/node/ys.js",
|
|
175
|
+
"ysin": "bin/node/ysin.js",
|
|
176
|
+
"ysx": "bin/node/ysx.js",
|
|
177
|
+
"yt": "bin/node/yt.js",
|
|
178
|
+
"ytin": "bin/node/ytin.js",
|
|
179
|
+
"ytx": "bin/node/ytx.js",
|
|
180
|
+
"yua": "bin/node/yua.js",
|
|
181
|
+
"yud": "bin/node/yud.js",
|
|
182
|
+
"yup": "bin/node/yup.js"
|
|
178
183
|
},
|
|
179
184
|
"type": "module",
|
|
180
185
|
"license": "Unlicense",
|
|
@@ -195,17 +200,27 @@
|
|
|
195
200
|
"dependencies": {
|
|
196
201
|
"@gkalpak/cli-utils": "^0.2.0",
|
|
197
202
|
"chalk": "^5.3.0",
|
|
198
|
-
"inquirer": "^
|
|
203
|
+
"inquirer": "^10.1.8",
|
|
199
204
|
"is-wsl": "^3.1.0"
|
|
200
205
|
},
|
|
201
206
|
"devDependencies": {
|
|
202
207
|
"eslint": "^8.57.0",
|
|
203
208
|
"eslint-plugin-import": "^2.29.1",
|
|
204
|
-
"eslint-plugin-jasmine": "^4.2.
|
|
205
|
-
"jasmine": "^5.
|
|
209
|
+
"eslint-plugin-jasmine": "^4.2.1",
|
|
210
|
+
"jasmine": "^5.2.0",
|
|
206
211
|
"npm-run-all": "^4.1.5",
|
|
207
212
|
"shelljs": "^0.8.5",
|
|
208
213
|
"strip-ansi": "^7.1.0",
|
|
209
214
|
"watch": "^1.0.2"
|
|
215
|
+
},
|
|
216
|
+
"overrides-comments": {
|
|
217
|
+
"watch": {
|
|
218
|
+
"exec-sh": "Fix vulnerability in transitive dependency `merge` (see https://github.com/gkalpak/aliases/security/dependabot/1)."
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
"overrides": {
|
|
222
|
+
"watch": {
|
|
223
|
+
"exec-sh": "0.4.0"
|
|
224
|
+
}
|
|
210
225
|
}
|
|
211
226
|
}
|
package/scripts/test-pkg.js
CHANGED