@gkalpak/aliases 0.9.1 → 0.9.2

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.
@@ -3,7 +3,7 @@
3
3
  const utils = require('../../lib/utils');
4
4
  /* eslint-disable max-len */
5
5
  console.log(utils.stripIndentation(`
6
- ### [Generated by: @gkalpak/aliases v0.9.1]
6
+ ### [Generated by: @gkalpak/aliases v0.9.2]
7
7
  ### Copy the following into '~/.bashrc':
8
8
 
9
9
  # Set up prompt.
@@ -17,4 +17,3 @@ console.log(utils.stripIndentation(`
17
17
 
18
18
  `));
19
19
  /* eslint-enable max-len */
20
-
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
  const utils = require('../../lib/utils');
4
4
  console.log(utils.stripIndentation(`
5
- ### [Generated by: @gkalpak/aliases v0.9.1]
5
+ ### [Generated by: @gkalpak/aliases v0.9.2]
6
6
  ### Run the following commands:
7
7
 
8
8
  git config --global core.editor "vim"
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
  const utils = require('../../lib/utils');
4
4
  console.log(utils.stripIndentation(`
5
- ### [Generated by: @gkalpak/aliases v0.9.1]
5
+ ### [Generated by: @gkalpak/aliases v0.9.2]
6
6
  ### Run the following commands:
7
7
 
8
8
  git config --global core.editor "vim"
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
  const utils = require('../../lib/utils');
4
4
  console.log(utils.stripIndentation(`
5
- ### [Generated by: @gkalpak/aliases v0.9.1]
5
+ ### [Generated by: @gkalpak/aliases v0.9.2]
6
6
  ### Run the following commands:
7
7
 
8
8
  git config --global core.editor "vim"
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- console.log('""" [Generated by: @gkalpak/aliases v0.9.1]');
3
+ console.log('""" [Generated by: @gkalpak/aliases v0.9.2]');
4
4
  console.log('""" Copy the following into \'~/.vimrc\':\n');
5
5
  console.log(require('fs').readFileSync(`${__dirname}/../../lib/assets/vimrc.txt`, 'utf8').trim() + '\n');
package/bin/git/gbcm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  // eslint-disable-next-line max-len
4
- const cmd = module.exports = 'git checkout master -b $1 && git config branch.$1.remote origin && git config branch.$1.merge refs/heads/$1';
4
+ const cmd = module.exports = 'git checkout ${0:::(git show-ref --heads --quiet master && echo master) || (git show-ref --heads --quiet main && echo main) || echo unknown-branch} -b $1 && git config branch.$1.remote origin && git config branch.$1.merge refs/heads/$1';
5
5
  if (require.main === module) {
6
6
  const {commandUtils} = require('@gkalpak/cli-utils');
7
7
  const {onError} = require('../../lib/utils');
package/bin/git/gcom.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  // eslint-disable-next-line max-len
4
- const cmd = module.exports = 'git checkout master $*';
4
+ const cmd = module.exports = 'git checkout ${0:::(git show-ref --heads --quiet master && echo master) || (git show-ref --heads --quiet main && echo main) || echo unknown-branch} $*';
5
5
  if (require.main === module) {
6
6
  const {commandUtils} = require('@gkalpak/cli-utils');
7
7
  const {onError} = require('../../lib/utils');
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ // eslint-disable-next-line max-len
4
+ const cmd = module.exports = '(git show-ref --heads --quiet master && echo master) || (git show-ref --heads --quiet main && echo main) || echo unknown-branch';
5
+ if (require.main === module) {
6
+ const {commandUtils} = require('@gkalpak/cli-utils');
7
+ const {onError} = require('../../lib/utils');
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/gprom.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  // eslint-disable-next-line max-len
4
- const cmd = module.exports = 'git pull --rebase origin master $*';
4
+ const cmd = module.exports = 'git pull --rebase origin ${0:::(git show-ref --heads --quiet master && echo master) || (git show-ref --heads --quiet main && echo main) || echo unknown-branch} $*';
5
5
  if (require.main === module) {
6
6
  const {commandUtils} = require('@gkalpak/cli-utils');
7
7
  const {onError} = require('../../lib/utils');
package/bin/git/gprum.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  // eslint-disable-next-line max-len
4
- const cmd = module.exports = 'git pull --rebase upstream master $*';
4
+ const cmd = module.exports = 'git pull --rebase upstream ${0:::(git show-ref --heads --quiet master && echo master) || (git show-ref --heads --quiet main && echo main) || echo unknown-branch} $*';
5
5
  if (require.main === module) {
6
6
  const {commandUtils} = require('@gkalpak/cli-utils');
7
7
  const {onError} = require('../../lib/utils');
package/bin/git/grbm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  // eslint-disable-next-line max-len
4
- const cmd = module.exports = 'git rebase --ignore-date master $*';
4
+ const cmd = module.exports = 'git rebase --ignore-date ${0:::(git show-ref --heads --quiet master && echo master) || (git show-ref --heads --quiet main && echo main) || echo unknown-branch} $*';
5
5
  if (require.main === module) {
6
6
  const {commandUtils} = require('@gkalpak/cli-utils');
7
7
  const {onError} = require('../../lib/utils');
package/bin/git/gsync.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  // eslint-disable-next-line max-len
4
- const cmd = module.exports = 'git checkout ${1:master} && git pull upstream ${1:master} && git push origin ${1:master}';
4
+ const cmd = module.exports = 'git checkout ${1:::(git show-ref --heads --quiet master && echo master) || (git show-ref --heads --quiet main && echo main) || echo unknown-branch} && git pull upstream ${1:::(git show-ref --heads --quiet master && echo master) || (git show-ref --heads --quiet main && echo main) || echo unknown-branch} && git push origin ${1:::(git show-ref --heads --quiet master && echo master) || (git show-ref --heads --quiet main && echo main) || echo unknown-branch}';
5
5
  if (require.main === module) {
6
6
  const {commandUtils} = require('@gkalpak/cli-utils');
7
7
  const {onError} = require('../../lib/utils');
package/bin/misc/alv.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- console.log('@gkalpak/aliases v0.9.1');
3
+ console.log('@gkalpak/aliases v0.9.2');
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-classes-per-file */
1
2
  'use strict';
2
3
 
3
4
  // Imports
@@ -46,7 +47,7 @@ class _Gcoghpr {
46
47
  * 1. Guess the upstream URL (looking at remotes `upstream` or `origin`).
47
48
  * 2. Retrieve the PR author and branch (either extracting it from the input or fetching it from GitHub).
48
49
  * 3. Check if a local branch with the same name already exists. (If it does, ask for permission to overwrite it.)
49
- * 4. Check out master.
50
+ * 4. Check out the default branch.
50
51
  * 5. Fetch the PR branch from the author's remote into a local branch (with the same name).
51
52
  * 6. Switch to the new branch.
52
53
  * 7. Set up the local branch to track the PR branch.
@@ -103,7 +104,10 @@ class _Gcoghpr {
103
104
  then(() => executor.exec(`git show-ref --heads --quiet ${localBranch}`).
104
105
  then(() => this._confirmOverwriteBranch(localBranch), () => undefined)).
105
106
  then(() => executor.execForOutput('git rev-parse --abbrev-ref HEAD')).
106
- then(currentBranch => (currentBranch === localBranch) && executor.exec('git checkout master')).
107
+ then(currentBranch =>
108
+ (currentBranch === localBranch) &&
109
+ executor.execForOutput(this._constants.ALIASES.git.gdefb.getSpec().command).
110
+ then(defaultBranch => executor.exec(`git checkout ${defaultBranch}`))).
107
111
  then(() => executor.exec(`git remote remove ${remoteAlias} || true`)).
108
112
  then(() => executor.exec(`git remote add ${remoteAlias} ${originUrl}`)).
109
113
  then(() => executor.exec(`git fetch --no-tags ${remoteAlias} ${branch}`)).
@@ -123,8 +127,8 @@ class _Gcoghpr {
123
127
  return new Promise((resolve, reject) => {
124
128
  const rlInstance = this._rl.createInterface(process.stdin, process.stdout);
125
129
  const question = chalk.yellow(
126
- `Branch '${branch}' does already exist.\n` +
127
- `Overwrite it? ${chalk.white('[y/N]')} `);
130
+ `Branch '${branch}' does already exist.\n` +
131
+ `Overwrite it? ${chalk.white('[y/N]')} `);
128
132
 
129
133
  rlInstance.question(question, answer => {
130
134
  rlInstance.close();
@@ -278,8 +282,8 @@ class GitHubUtils {
278
282
  if (!ghToken && !this._shownTokenWarning) {
279
283
  this._shownTokenWarning = true;
280
284
  this._logger.warn(
281
- `No GitHub access token found in \`${GH_TOKEN_NAME}\` environment variable.\n` +
282
- 'Proceeding anonymously (and subject to rate-limiting)...');
285
+ `No GitHub access token found in \`${GH_TOKEN_NAME}\` environment variable.\n` +
286
+ 'Proceeding anonymously (and subject to rate-limiting)...');
283
287
  }
284
288
 
285
289
  return this._httpsGet(url, options).then(responseText => {
package/lib/alias.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-classes-per-file */
1
2
  'use strict';
2
3
 
3
4
  // Imports
@@ -65,7 +66,7 @@ class AliasSpec/* implements IAliasSpec */ {
65
66
 
66
67
  class AliasSpecDefault extends AliasSpec {
67
68
  static DEF_CODE() {
68
- throw new Error('You are supposed to overwrite this method, before creating any instances.');
69
+ throw new Error('This method is supposed to be overwritten, before any instances are created.');
69
70
  }
70
71
 
71
72
  constructor(command/* string */, config/*? IRunConfig */) {
package/lib/constants.js CHANGED
@@ -12,6 +12,9 @@ const VERSION_STAMP = `${pkg.name} v${pkg.version}`;
12
12
  const ROOT_DIR = path.resolve(__dirname, '..');
13
13
  const BIN_DIR = path.join(ROOT_DIR, 'bin');
14
14
  const SOURCE_NVM_CMD = '. $NVM_DIR/nvm.sh';
15
+ const GIT_GET_DEFAULT_BRANCH_CMD =
16
+ `${['master', 'main'].map(b => `(git show-ref --heads --quiet ${b} && echo ${b})`).join(' || ')} || ` +
17
+ 'echo unknown-branch';
15
18
  const GLOBAL_NPM_PACKAGES = [
16
19
  '@angular/cli',
17
20
  '@gkalpak/aliases',
@@ -33,6 +36,7 @@ const GLOBAL_NPM_PACKAGES = [
33
36
 
34
37
  const DESC_REPLACEMENTS = {
35
38
  [AliasUnknown.DESCRIPTION]: '???',
39
+ [`::${GIT_GET_DEFAULT_BRANCH_CMD}`]: '<default-branch>',
36
40
  '::__a-builds-dir': '(<.../angular/aio/aio-builds-setup>)',
37
41
  '::__g-pick-branch --gkcu-returnOutput=1': '(interactively pick a branch)',
38
42
  '::__g-pick-commit --gkcu-returnOutput=1': '(interactively pick a commit)',
@@ -53,27 +57,27 @@ const DEF_CODE = AliasSpecDefault.DEF_CODE = (cmd, cfg = {}) => utils.stripInden
53
57
  `);
54
58
 
55
59
  const CFGGIT_SPEC_WITH_CRED_HELPER = credHelper => new AliasSpec(
56
- utils.stripIndentation(`
57
- #!/usr/bin/env node
58
- 'use strict';
59
- const utils = require('../../lib/utils');
60
- console.log(utils.stripIndentation(\`
61
- ### [Generated by: ${VERSION_STAMP}]
62
- ### Run the following commands:
63
-
64
- git config --global core.editor "vim"
65
- git config --global credential.helper "${credHelper}"
66
- git config --global merge.tool "kdiff3"
67
- git config --global mergetool.kdiff3.path "/path/to/kdiff3"
68
- git config --global mergetool.kdiff3.trustExitCode "false"
69
- git config --global push.default "upstream"
70
- git config --global rebase.autosquash "true"
71
- git config --global rebase.autostash "true"
72
- git config --global user.email "kalpakas.g@gmail.com"
73
- git config --global user.name "George Kalpakas"
74
- \`));
75
- `),
76
- 'Show configuration instructions for `git`.');
60
+ utils.stripIndentation(`
61
+ #!/usr/bin/env node
62
+ 'use strict';
63
+ const utils = require('../../lib/utils');
64
+ console.log(utils.stripIndentation(\`
65
+ ### [Generated by: ${VERSION_STAMP}]
66
+ ### Run the following commands:
67
+
68
+ git config --global core.editor "vim"
69
+ git config --global credential.helper "${credHelper}"
70
+ git config --global merge.tool "kdiff3"
71
+ git config --global mergetool.kdiff3.path "/path/to/kdiff3"
72
+ git config --global mergetool.kdiff3.trustExitCode "false"
73
+ git config --global push.default "upstream"
74
+ git config --global rebase.autosquash "true"
75
+ git config --global rebase.autostash "true"
76
+ git config --global user.email "kalpakas.g@gmail.com"
77
+ git config --global user.name "George Kalpakas"
78
+ \`));
79
+ `),
80
+ 'Show configuration instructions for `git`.');
77
81
 
78
82
  const SCRIPT_BACKED_CODE = (scriptName, desc) => utils.stripIndentation(`
79
83
  #!/usr/bin/env node
@@ -168,6 +172,7 @@ const ALIASES = {
168
172
  git: {
169
173
  // STATUS
170
174
  gs: new AliasDefault('git status $*'),
175
+ gdefb: new AliasDefault(GIT_GET_DEFAULT_BRANCH_CMD),
171
176
  gl: new AliasDefault('git log --decorate $* || true'),
172
177
  gl1: new AliasDefault('git log --decorate --oneline $* || true'),
173
178
  gl1g: new AliasDefault('git log --decorate --oneline | grep $*'),
@@ -188,13 +193,13 @@ const ALIASES = {
188
193
 
189
194
  // CHECKOUT
190
195
  gco: new AliasDefault('git checkout ${*:::__g-pick-branch --gkcu-returnOutput=1}'),
191
- gcom: new AliasDefault('git checkout master $*'),
196
+ gcom: new AliasDefault(`git checkout \${0:::${GIT_GET_DEFAULT_BRANCH_CMD}} $*`),
192
197
  gcopr: new AliasDefault('git fetch upstream pull/$1/head && git checkout FETCH_HEAD'),
193
198
  gcoghpr: SCRIPT_BACKED_ALIAS('gcoghpr', 'Check out a GitHub pull request as a local branch.'),
194
199
  'gcoghpr-cleanup': new AliasDefault(
195
- CLEANUP_CODE('git branches', `${PR_LOCAL_BRANCH_PREFIX}-`, 'git branch', 'git branch --delete --force') +
196
- ' && ' +
197
- CLEANUP_CODE('git remotes', `${PR_REMOTE_ALIAS_PREFIX}-`, 'git remote show', 'git remote remove')),
200
+ CLEANUP_CODE('git branches', `${PR_LOCAL_BRANCH_PREFIX}-`, 'git branch', 'git branch --delete --force') +
201
+ ' && ' +
202
+ CLEANUP_CODE('git remotes', `${PR_REMOTE_ALIAS_PREFIX}-`, 'git remote show', 'git remote remove')),
198
203
 
199
204
  // ADD / COMMIT
200
205
  gaa: new AliasDefault('git add --all $*'),
@@ -224,25 +229,30 @@ const ALIASES = {
224
229
  // BRANCH
225
230
  gb: new AliasDefault('git branch $*'),
226
231
  gbc: new AliasDefault(
227
- 'git checkout ${2:HEAD} -b $1 && git config branch.$1.remote origin && git config branch.$1.merge refs/heads/$1'),
232
+ 'git checkout ${2:HEAD} -b $1 && git config branch.$1.remote origin && ' +
233
+ 'git config branch.$1.merge refs/heads/$1'),
228
234
  gbcm: new AliasDefault(
229
- 'git checkout master -b $1 && git config branch.$1.remote origin && git config branch.$1.merge refs/heads/$1'),
235
+ `git checkout \${0:::${GIT_GET_DEFAULT_BRANCH_CMD}} -b $1 && git config branch.$1.remote origin && ` +
236
+ 'git config branch.$1.merge refs/heads/$1'),
230
237
  gbd: new AliasDefault('git branch --delete --force ${*:::__g-pick-branch --gkcu-returnOutput=1}'),
231
238
 
232
239
  // PULL(-REBASE)
233
240
  gpr: new AliasDefault('git pull --rebase $*'),
234
241
  gpro: new AliasDefault('git pull --rebase origin ${*:::git rev-parse --abbrev-ref HEAD}'),
235
- gprom: new AliasDefault('git pull --rebase origin master $*'),
242
+ gprom: new AliasDefault(`git pull --rebase origin \${0:::${GIT_GET_DEFAULT_BRANCH_CMD}} $*`),
236
243
  gpru: new AliasDefault('git pull --rebase upstream ${*:::git rev-parse --abbrev-ref HEAD}'),
237
- gprum: new AliasDefault('git pull --rebase upstream master $*'),
244
+ gprum: new AliasDefault(`git pull --rebase upstream \${0:::${GIT_GET_DEFAULT_BRANCH_CMD}} $*`),
238
245
 
239
- // SYNC MASTER
240
- gsync: new AliasDefault('git checkout ${1:master} && git pull upstream ${1:master} && git push origin ${1:master}'),
246
+ // SYNC DEFAULT BRANCH
247
+ gsync: new AliasDefault(
248
+ `git checkout \${1:::${GIT_GET_DEFAULT_BRANCH_CMD}} && ` +
249
+ `git pull upstream \${1:::${GIT_GET_DEFAULT_BRANCH_CMD}} && ` +
250
+ `git push origin \${1:::${GIT_GET_DEFAULT_BRANCH_CMD}}`),
241
251
 
242
252
 
243
253
  // REBASE
244
254
  grb: new AliasDefault('git rebase ${*:::__g-pick-branch --gkcu-returnOutput=1}'),
245
- grbm: new AliasDefault('git rebase --ignore-date master $*'),
255
+ grbm: new AliasDefault(`git rebase --ignore-date \${0:::${GIT_GET_DEFAULT_BRANCH_CMD}} $*`),
246
256
  grbi: new AliasDefault('git rebase --interactive HEAD~$1'),
247
257
  grbia: new AliasDefault('git rebase --autosquash --interactive HEAD~$1'),
248
258
  grbin: new AliasDefault('git rebase --no-autosquash --interactive HEAD~$1'),
@@ -304,30 +314,30 @@ const ALIASES = {
304
314
  }),
305
315
  nvu: new Alias({
306
316
  default: new AliasSpec(
307
- SCRIPT_BACKED_CODE('nvu', 'nvm use $*'),
308
- `${SOURCE_NVM_CMD} && nvm use $* (it does not affect the currect process)`),
317
+ SCRIPT_BACKED_CODE('nvu', 'nvm use $*'),
318
+ `${SOURCE_NVM_CMD} && nvm use $* (it does not affect the currect process)`),
309
319
  win32: new AliasSpec(
310
- SCRIPT_BACKED_CODE('nvu', 'nvm use $*'),
311
- 'nvm use $* (the 1st arg is replaced with the latest available version on the specified branch)'),
320
+ SCRIPT_BACKED_CODE('nvu', 'nvm use $*'),
321
+ 'nvm use $* (the 1st arg is replaced with the latest available version on the specified branch)'),
312
322
  }),
313
323
  nvmup: new Alias({
314
324
  default: new AliasSpecDefault(
315
- PRINT_NVM_UPDATE_INSTRUCTIONS_CODE(
316
- `${SOURCE_NVM_CMD} && nvm --version`,
317
- 'nvm-sh/nvm',
318
- 'install--update-script',
319
- 'Run: \'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v{{version}}/install.sh | bash\' ' +
320
- '(or \'wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v{{version}}/install.sh | bash\')',
321
- ),
325
+ PRINT_NVM_UPDATE_INSTRUCTIONS_CODE(
326
+ `${SOURCE_NVM_CMD} && nvm --version`,
327
+ 'nvm-sh/nvm',
328
+ 'install--update-script',
329
+ 'Run: \'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v{{version}}/install.sh | bash\' ' +
330
+ '(or \'wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v{{version}}/install.sh | bash\')',
331
+ ),
322
332
  ),
323
333
  win32: new AliasSpecDefault(
324
- PRINT_NVM_UPDATE_INSTRUCTIONS_CODE(
325
- 'nvm version',
326
- 'coreybutler/nvm-windows',
327
- 'installation--upgrades',
328
- 'Download, unzip and run: ' +
329
- 'https://github.com/coreybutler/nvm-windows/releases/download/{{version}}/nvm-setup.zip',
330
- ),
334
+ PRINT_NVM_UPDATE_INSTRUCTIONS_CODE(
335
+ 'nvm version',
336
+ 'coreybutler/nvm-windows',
337
+ 'installation--upgrades',
338
+ 'Download, unzip and run: ' +
339
+ 'https://github.com/coreybutler/nvm-windows/releases/download/{{version}}/nvm-setup.zip',
340
+ ),
331
341
  ),
332
342
  }),
333
343
 
@@ -380,8 +390,8 @@ const ALIASES = {
380
390
  // SPECIAL
381
391
  srv: new AliasDefault('http-server "${1:.}" --port="4000" $2*'),
382
392
  srvw: new AliasDefault(
383
- 'light-server --bind="localhost" --historyindex="/index.html" --serve="${1:.}" --watchexp="${1:.}/**" $2*',
384
- {suppressTbj: true}),
393
+ 'light-server --bind="localhost" --historyindex="/index.html" --serve="${1:.}" --watchexp="${1:.}/**" $2*',
394
+ {suppressTbj: true}),
385
395
  naga: new AliasDefault(`npm install --global ${GLOBAL_NPM_PACKAGES.join(' ')} $*`),
386
396
  yaga: new AliasDefault(`yarn global add ${GLOBAL_NPM_PACKAGES.filter(x => !/^yarn(?:@|$)/.test(x)).join(' ')} $*`),
387
397
  },
@@ -392,7 +402,7 @@ const ALIASES = {
392
402
  dkrrm: new AliasDefault('docker stop $1 & docker rm $1 || true'),
393
403
  dkrbd: new AliasDefault('docker build --tag $1 $3* $2'),
394
404
  dkrrd: new AliasDefault(
395
- 'docker run -d --name $1 -p 4000:4000 -p 4200:4200 -p 4433:4433 -p 8080:8080 -p 9876:9876 $3* $2'),
405
+ 'docker run -d --name $1 -p 4000:4000 -p 4200:4200 -p 4433:4433 -p 8080:8080 -p 9876:9876 $3* $2'),
396
406
  dkratt: new AliasDefault('docker exec -it $1 /bin/bash $2*'),
397
407
  dkrall: new AliasDefault('dkrrm $1 && dkrbd $2 $3 && dkrrd $1 $2 $4* && dkratt $1'),
398
408
  },
@@ -413,38 +423,37 @@ const ALIASES = {
413
423
 
414
424
  // PRIVATE
415
425
  '__a-builds-dir': SCRIPT_BACKED_ALIAS(
416
- 'a-builds-dir', '[PRIVATE]: Return the absolute path to \'.../angular/aio/aio-builds-setup/\'.'),
426
+ 'a-builds-dir', '[PRIVATE]: Return the absolute path to \'.../angular/aio/aio-builds-setup/\'.'),
417
427
  },
418
428
 
419
429
  // Env config
420
430
  config: {
421
431
  // BASH
422
432
  cfgbash: new Alias(new AliasSpec(
423
- /* eslint-disable max-len */
424
- utils.stripIndentation(`
425
- #!/usr/bin/env node
426
- 'use strict';
427
- const utils = require('../../lib/utils');
428
433
  /* eslint-disable max-len */
429
- console.log(utils.stripIndentation(\`
430
- ### [Generated by: ${VERSION_STAMP}]
431
- ### Copy the following into '~/.bashrc':
432
-
433
- # Set up prompt.
434
- PS1='\\\\[\\\\033[90m\\\\][\\\\d \\\\t]\\\\[\\\\033[00m\\\\]\\\\n\\\${debian_chroot:+($debian_chroot)}\\\\[\\\\033[01;32m\\\\]\\\\u@\\\\h\\\\[\\\\033[00m\\\\]:\\\\[\\\\033[01;34m\\\\]\\\\w\\\\[\\\\033[00m\\\\]$ ';
435
-
436
- # Improve tab completion.
437
- bind "set completion-ignore-case on";
438
- bind "set menu-complete-display-prefix on";
439
- bind "set show-all-if-ambiguous on";
440
- bind "TAB:menu-complete";
441
-
442
- \`));
434
+ utils.stripIndentation(`
435
+ #!/usr/bin/env node
436
+ 'use strict';
437
+ const utils = require('../../lib/utils');
438
+ /* eslint-disable max-len */
439
+ console.log(utils.stripIndentation(\`
440
+ ### [Generated by: ${VERSION_STAMP}]
441
+ ### Copy the following into '~/.bashrc':
442
+
443
+ # Set up prompt.
444
+ PS1='\\\\[\\\\033[90m\\\\][\\\\d \\\\t]\\\\[\\\\033[00m\\\\]\\\\n\\\${debian_chroot:+($debian_chroot)}\\\\[\\\\033[01;32m\\\\]\\\\u@\\\\h\\\\[\\\\033[00m\\\\]:\\\\[\\\\033[01;34m\\\\]\\\\w\\\\[\\\\033[00m\\\\]$ ';
445
+
446
+ # Improve tab completion.
447
+ bind "set completion-ignore-case on";
448
+ bind "set menu-complete-display-prefix on";
449
+ bind "set show-all-if-ambiguous on";
450
+ bind "TAB:menu-complete";
451
+
452
+ \`));
453
+ /* eslint-enable max-len */
454
+ `),
443
455
  /* eslint-enable max-len */
444
-
445
- `),
446
- /* eslint-enable max-len */
447
- 'Show configuration instructions for `bash`.')),
456
+ 'Show configuration instructions for `bash`.')),
448
457
 
449
458
 
450
459
  // GIT
@@ -452,20 +461,20 @@ const ALIASES = {
452
461
  default: CFGGIT_SPEC_WITH_CRED_HELPER('store'),
453
462
  win32: CFGGIT_SPEC_WITH_CRED_HELPER('manager'),
454
463
  wsl: CFGGIT_SPEC_WITH_CRED_HELPER(
455
- '/mnt/c/Program\\\\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe'),
464
+ '/mnt/c/Program\\\\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe'),
456
465
  }),
457
466
 
458
467
 
459
468
  // VIM
460
469
  cfgvim: new Alias(new AliasSpec(
461
- utils.stripIndentation(`
462
- #!/usr/bin/env node
463
- 'use strict';
464
- console.log('""" [Generated by: ${VERSION_STAMP}]');
465
- console.log('""" Copy the following into \\'~/.vimrc\\':\\n');
466
- console.log(require('fs').readFileSync(\`\${__dirname}/../../lib/assets/vimrc.txt\`, 'utf8').trim() + '\\n');
467
- `),
468
- 'Show configuration instructions for `vim`.')),
470
+ utils.stripIndentation(`
471
+ #!/usr/bin/env node
472
+ 'use strict';
473
+ console.log('""" [Generated by: ${VERSION_STAMP}]');
474
+ console.log('""" Copy the following into \\'~/.vimrc\\':\\n');
475
+ console.log(require('fs').readFileSync(\`\${__dirname}/../../lib/assets/vimrc.txt\`, 'utf8').trim() + '\\n');
476
+ `),
477
+ 'Show configuration instructions for `vim`.')),
469
478
  },
470
479
 
471
480
  // Misc
@@ -493,29 +502,29 @@ const ALIASES = {
493
502
 
494
503
  // VERSION
495
504
  alv: new Alias(new AliasSpec(
496
- utils.stripIndentation(`
497
- #!/usr/bin/env node
498
- 'use strict';
499
- console.log('${VERSION_STAMP}');
500
- `),
501
- `Display the installed version of ${pkg.name}.`)),
505
+ utils.stripIndentation(`
506
+ #!/usr/bin/env node
507
+ 'use strict';
508
+ console.log('${VERSION_STAMP}');
509
+ `),
510
+ `Display the installed version of ${pkg.name}.`)),
502
511
 
503
512
  // HELP
504
513
  halp: new Alias(new AliasSpec(
505
- utils.stripIndentation(`
506
- #!/usr/bin/env node
507
- 'use strict';
508
- require('../../lib/helper').help(...process.argv.slice(2));
509
- `),
510
- utils.stripIndentation(`
511
- Display this message. Variations:
512
- - Pass a category name to list aliases of the specified category only.
513
- (Example: \`halp node\`)
514
- - Pass one or more alias names to list only the specified aliases (if they exist).
515
- (Example: \`halp alv\`)
516
- - Pass a partial alias name suffixed with \`*\` to list all aliases that start with that value.
517
- (Example: \`halp grb*\`)
518
- `))),
514
+ utils.stripIndentation(`
515
+ #!/usr/bin/env node
516
+ 'use strict';
517
+ require('../../lib/helper').help(...process.argv.slice(2));
518
+ `),
519
+ utils.stripIndentation(`
520
+ Display this message. Variations:
521
+ - Pass a category name to list aliases of the specified category only.
522
+ (Example: \`halp node\`)
523
+ - Pass one or more alias names to list only the specified aliases (if they exist).
524
+ (Example: \`halp alv\`)
525
+ - Pass a partial alias name suffixed with \`*\` to list all aliases that start with that value.
526
+ (Example: \`halp grb*\`)
527
+ `))),
519
528
  },
520
529
  };
521
530
 
package/lib/helper.js CHANGED
@@ -79,8 +79,8 @@ function _help(...names) {
79
79
  ' Does not work with certain types of commands (e.g. `vim`).',
80
80
  '',
81
81
  utils.wrapLine(
82
- '(NOTE: All arguments starting with `--gkcu-` will be ignored when substituting input arguments or ' +
83
- 'determining their index.)'),
82
+ '(NOTE: All arguments starting with `--gkcu-` will be ignored when substituting input arguments or ' +
83
+ 'determining their index.)'),
84
84
  '',
85
85
  ].join('\n');
86
86
 
package/lib/utils.js CHANGED
@@ -30,8 +30,8 @@ function _capitalize(str) {
30
30
 
31
31
  function _finallyAsPromised(promise, callback) {
32
32
  return promise.then(
33
- val => Promise.resolve(callback()).then(() => val),
34
- err => Promise.resolve(callback()).then(() => Promise.reject(err)));
33
+ val => Promise.resolve(callback()).then(() => val),
34
+ err => Promise.resolve(callback()).then(() => Promise.reject(err)));
35
35
  }
36
36
 
37
37
  function _getPlatform() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gkalpak/aliases",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "My global aliases.",
5
5
  "keywords": [
6
6
  "Utility"
@@ -79,6 +79,7 @@
79
79
  "gd": "./bin/git/gd.js",
80
80
  "gd1": "./bin/git/gd1.js",
81
81
  "gdn": "./bin/git/gdn.js",
82
+ "gdefb": "./bin/git/gdefb.js",
82
83
  "gdn1": "./bin/git/gdn1.js",
83
84
  "gdnh": "./bin/git/gdnh.js",
84
85
  "gdh": "./bin/git/gdh.js",
@@ -187,17 +188,17 @@
187
188
  },
188
189
  "dependencies": {
189
190
  "@gkalpak/cli-utils": "^0.1.10",
190
- "chalk": "^4.1.1",
191
- "inquirer": "^8.1.2",
191
+ "chalk": "^4.1.2",
192
+ "inquirer": "^8.2.1",
192
193
  "is-wsl": "^2.2.0"
193
194
  },
194
195
  "devDependencies": {
195
- "eslint": "^7.31.0",
196
- "eslint-plugin-jasmine": "^4.1.2",
197
- "jasmine": "^3.8.0",
196
+ "eslint": "^8.11.0",
197
+ "eslint-plugin-jasmine": "^4.1.3",
198
+ "jasmine": "^4.0.2",
198
199
  "npm-run-all": "^4.1.5",
199
- "shelljs": "^0.8.4",
200
- "strip-ansi": "^6.0.0",
200
+ "shelljs": "^0.8.5",
201
+ "strip-ansi": "^6.0.1",
201
202
  "watch": "^1.0.2"
202
203
  }
203
204
  }
@@ -46,9 +46,9 @@ function checkFile(propName, filePath, rootDir) {
46
46
  const missingFile = !existsSync(resolve(rootDir, filePath));
47
47
 
48
48
  reportResults(
49
- `The file mentioned in \`package.json > ${propName}\` exists.`,
50
- `The file mentioned in \`package.json > ${propName}\` is missing.`,
51
- {'Missing script': missingFile ? [filePath] : []});
49
+ `The file mentioned in \`package.json > ${propName}\` exists.`,
50
+ `The file mentioned in \`package.json > ${propName}\` is missing.`,
51
+ {'Missing script': missingFile ? [filePath] : []});
52
52
  }
53
53
 
54
54
  function compareToAliases(bin, aliases) {
@@ -58,12 +58,12 @@ function compareToAliases(bin, aliases) {
58
58
  const {missing, extra} = diff(expected, actual);
59
59
 
60
60
  reportResults(
61
- 'Aliases in `lib/constants.js` are in-sync with `package.json > bin`.',
62
- 'Aliases in `lib/constants.js` are not in-sync with `package.json > bin`.',
63
- {
64
- 'Missing from `package.json > bin`': missing,
65
- 'Missing from `lib/constants.js`': extra,
66
- });
61
+ 'Aliases in `lib/constants.js` are in-sync with `package.json > bin`.',
62
+ 'Aliases in `lib/constants.js` are not in-sync with `package.json > bin`.',
63
+ {
64
+ 'Missing from `package.json > bin`': missing,
65
+ 'Missing from `lib/constants.js`': extra,
66
+ });
67
67
  }
68
68
 
69
69
  function compareToBinDir(bin, rootDir) {
@@ -72,9 +72,9 @@ function compareToBinDir(bin, rootDir) {
72
72
  filter(path => !existsSync(path));
73
73
 
74
74
  reportResults(
75
- 'All scripts mentioned in `package.json > bin` exist.',
76
- 'Some scripts mentioned in `package.json > bin` are missing.',
77
- {'Missing scripts': missingScripts});
75
+ 'All scripts mentioned in `package.json > bin` exist.',
76
+ 'Some scripts mentioned in `package.json > bin` are missing.',
77
+ {'Missing scripts': missingScripts});
78
78
  }
79
79
 
80
80
  function diff(arr1, arr2) {