@codenotch/codenotch.cli 1.0.55 → 1.0.56
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/README.md
CHANGED
|
@@ -75,7 +75,8 @@ go to stderr, and a failure is an exit code 1 with one message. `--json` gives a
|
|
|
75
75
|
result on `cn info`, `cn docs`, `cn validate`, `cn runtime info` / `latest`, `cn project inspect` /
|
|
76
76
|
`compile` / `package` / `deploy` / `refresh` / `test` / `bump` and every `cn generate` command.
|
|
77
77
|
The global `--quiet` drops the progress, `CODENOTCH_DEBUG=1` prints the stack trace of a failure,
|
|
78
|
-
and `cn completion
|
|
78
|
+
and `cn completion --install` sets up the Tab completion of the shell (bash, zsh or PowerShell,
|
|
79
|
+
detected; `cn completion <shell>` prints the script).
|
|
79
80
|
|
|
80
81
|
## Contributing
|
|
81
82
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
/**
|
|
3
|
-
* 'cn completion
|
|
3
|
+
* 'cn completion [shell]': prints a completion script built from the command tree, so it always
|
|
4
4
|
* matches the installed CLI. The script holds one table, "command path" -> "words to propose",
|
|
5
5
|
* and looks the typed path up: no shell has to know anything about commander.
|
|
6
|
+
* '--install' writes the activation line into the profile of the shell instead.
|
|
7
|
+
* The shell is detected when not given: the login shell of Unix, or the shell found among the
|
|
8
|
+
* ancestors of this process (Windows, where cmd and node sit between the shell and the CLI).
|
|
6
9
|
*/
|
|
7
10
|
export declare function registerCompletion(program: Command): void;
|
|
@@ -1,36 +1,195 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.registerCompletion = registerCompletion;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const os_1 = __importDefault(require("os"));
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
const ConsoleUtils_1 = __importDefault(require("../../utils/ConsoleUtils"));
|
|
4
13
|
const SHELLS = ['bash', 'zsh', 'powershell'];
|
|
5
14
|
/** The names the CLI is installed under, both completed */
|
|
6
15
|
const COMMAND_NAMES = ['cn', 'codenotch-cli'];
|
|
16
|
+
/** What the profile of each shell has to run to load the completion, always in sync with the installed CLI */
|
|
17
|
+
const ACTIVATION = {
|
|
18
|
+
bash: 'eval "$(cn completion bash)"',
|
|
19
|
+
zsh: 'eval "$(cn completion zsh)"',
|
|
20
|
+
powershell: 'cn completion powershell | Out-String | Invoke-Expression'
|
|
21
|
+
};
|
|
7
22
|
/**
|
|
8
|
-
* 'cn completion
|
|
23
|
+
* 'cn completion [shell]': prints a completion script built from the command tree, so it always
|
|
9
24
|
* matches the installed CLI. The script holds one table, "command path" -> "words to propose",
|
|
10
25
|
* and looks the typed path up: no shell has to know anything about commander.
|
|
26
|
+
* '--install' writes the activation line into the profile of the shell instead.
|
|
27
|
+
* The shell is detected when not given: the login shell of Unix, or the shell found among the
|
|
28
|
+
* ancestors of this process (Windows, where cmd and node sit between the shell and the CLI).
|
|
11
29
|
*/
|
|
12
30
|
function registerCompletion(program) {
|
|
13
31
|
program
|
|
14
32
|
.command('completion')
|
|
15
|
-
.description('Print the shell completion script of the CLI
|
|
16
|
-
.argument('
|
|
33
|
+
.description('Print the shell completion script of the CLI, or install it in the profile of the shell (--install)')
|
|
34
|
+
.argument('[shell]', `shell: ${SHELLS.join(', ')} (default: the shell this runs in)`)
|
|
35
|
+
.option('-i, --install', 'add the activation line to the profile of the shell instead of printing the script', false)
|
|
36
|
+
.option('-y, --yes', 'do not ask for confirmation before writing the profile', false)
|
|
17
37
|
.addHelpText('after', `
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
Examples:
|
|
39
|
+
$ cn completion --install detect the shell, add the activation line to its profile
|
|
40
|
+
$ cn completion zsh print the zsh script, e.g. to redirect it into a completion file
|
|
41
|
+
|
|
42
|
+
Activation lines, for a manual install (then open a new terminal):
|
|
43
|
+
bash ${ACTIVATION.bash} in ~/.bashrc
|
|
44
|
+
zsh ${ACTIVATION.zsh} in ~/.zshrc
|
|
45
|
+
powershell ${ACTIVATION.powershell} in $PROFILE
|
|
22
46
|
`)
|
|
23
|
-
.action((
|
|
24
|
-
|
|
25
|
-
|
|
47
|
+
.action(async (requested, options) => {
|
|
48
|
+
const detected = resolveShell(requested);
|
|
49
|
+
if (options.install) {
|
|
50
|
+
await installCompletion(detected, options.yes);
|
|
51
|
+
return;
|
|
26
52
|
}
|
|
27
|
-
|
|
28
|
-
console.log(shell === 'bash' ? bashScript(table) : shell === 'zsh' ? zshScript(table) : powershellScript(table));
|
|
53
|
+
console.log(script(detected.shell, buildTable(program)));
|
|
29
54
|
});
|
|
30
55
|
}
|
|
31
|
-
|
|
32
|
-
|
|
56
|
+
//#region Shell detection
|
|
57
|
+
/** The shell asked for, or the one this runs in; an error when neither is known */
|
|
58
|
+
function resolveShell(requested) {
|
|
59
|
+
if (requested !== undefined) {
|
|
60
|
+
if (!SHELLS.includes(requested)) {
|
|
61
|
+
throw new Error(`Unknown shell '${requested}', expected one of: ${SHELLS.join(', ')}.`);
|
|
62
|
+
}
|
|
63
|
+
return { shell: requested };
|
|
64
|
+
}
|
|
65
|
+
const detected = detectShell();
|
|
66
|
+
if (detected === undefined) {
|
|
67
|
+
throw new Error(`Could not tell the shell this runs in, give it: cn completion <${SHELLS.join('|')}>`);
|
|
68
|
+
}
|
|
69
|
+
return detected;
|
|
70
|
+
}
|
|
71
|
+
function detectShell() {
|
|
72
|
+
// The login shell of Unix (Git Bash sets it too): the one whose profile the next terminal reads
|
|
73
|
+
const fromEnvironment = shellOf(process.env.SHELL);
|
|
74
|
+
if (fromEnvironment !== undefined) {
|
|
75
|
+
return fromEnvironment;
|
|
76
|
+
}
|
|
77
|
+
// Otherwise the process tree: the shell is an ancestor of this process, above the npm shim and node
|
|
78
|
+
for (const name of ancestorNames()) {
|
|
79
|
+
const shell = shellOf(name);
|
|
80
|
+
if (shell !== undefined) {
|
|
81
|
+
return shell;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
/** The shell an executable name stands for, undefined for anything else (node, cmd, the npm shim...) */
|
|
87
|
+
function shellOf(executable) {
|
|
88
|
+
// A login shell shows with a leading dash ('-zsh'), a Windows one with its extension
|
|
89
|
+
const name = (0, path_1.basename)((executable ?? '').trim()).toLowerCase().replace(/^-/, '').replace(/\.exe$/, '');
|
|
90
|
+
switch (name) {
|
|
91
|
+
case 'bash': return { shell: 'bash' };
|
|
92
|
+
case 'zsh': return { shell: 'zsh' };
|
|
93
|
+
case 'pwsh': return { shell: 'powershell', powershellExe: 'pwsh' };
|
|
94
|
+
case 'powershell': return { shell: 'powershell', powershellExe: 'powershell' };
|
|
95
|
+
default: return undefined;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** The names of the ancestors of this process, closest first; empty when they cannot be read */
|
|
99
|
+
function ancestorNames() {
|
|
100
|
+
try {
|
|
101
|
+
return process.platform === 'win32' ? windowsAncestors() : unixAncestors();
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function windowsAncestors() {
|
|
108
|
+
// One query for the whole process table, walked here
|
|
109
|
+
const output = (0, child_process_1.execFileSync)('powershell', [
|
|
110
|
+
'-NoProfile', '-NonInteractive', '-Command',
|
|
111
|
+
"Get-CimInstance Win32_Process | ForEach-Object { '{0},{1},{2}' -f $_.ProcessId, $_.ParentProcessId, $_.Name }"
|
|
112
|
+
], { encoding: 'utf8', windowsHide: true, timeout: 15000 });
|
|
113
|
+
const processes = new Map();
|
|
114
|
+
for (const line of output.split(/\r?\n/)) {
|
|
115
|
+
const [pid, parent, name] = line.split(',');
|
|
116
|
+
if (pid && parent && name) {
|
|
117
|
+
processes.set(Number(pid), { parent: Number(parent), name: name.trim() });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return walkAncestors(pid => processes.get(pid));
|
|
121
|
+
}
|
|
122
|
+
function unixAncestors() {
|
|
123
|
+
return walkAncestors(pid => {
|
|
124
|
+
const output = (0, child_process_1.execFileSync)('ps', ['-o', 'ppid=,comm=', '-p', String(pid)], { encoding: 'utf8', timeout: 5000 }).trim();
|
|
125
|
+
const match = /^(\d+)\s+(.+)$/.exec(output);
|
|
126
|
+
return match ? { parent: Number(match[1]), name: match[2] } : undefined;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function walkAncestors(lookup) {
|
|
130
|
+
const names = [];
|
|
131
|
+
let pid = process.ppid;
|
|
132
|
+
for (let depth = 0; depth < 8 && pid > 0; depth++) {
|
|
133
|
+
const entry = lookup(pid);
|
|
134
|
+
if (entry === undefined || entry.parent === pid) {
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
names.push(entry.name);
|
|
138
|
+
pid = entry.parent;
|
|
139
|
+
}
|
|
140
|
+
return names;
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region Installation
|
|
144
|
+
async function installCompletion(detected, yes) {
|
|
145
|
+
const profilePath = profileOf(detected);
|
|
146
|
+
const line = ACTIVATION[detected.shell];
|
|
147
|
+
ConsoleUtils_1.default.check(`Shell: ${detected.shell}, profile: ${profilePath}`);
|
|
148
|
+
const current = (0, fs_1.existsSync)(profilePath) ? (0, fs_1.readFileSync)(profilePath, 'utf8') : '';
|
|
149
|
+
if (current.includes(`cn completion ${detected.shell}`)) {
|
|
150
|
+
ConsoleUtils_1.default.check(`The completion is already installed in '${profilePath}'.`);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
// Writing a profile of the user deserves an explicit go: outside a terminal, only --yes can give it
|
|
154
|
+
if (!yes && !await ConsoleUtils_1.default.confirm(`Add '${line}' to '${profilePath}'?`, false)) {
|
|
155
|
+
console.error(chalk_1.default.yellow(`Aborted: nothing written. Run with '--yes' to skip the confirmation, or add the line yourself.`));
|
|
156
|
+
process.exitCode = 1;
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(profilePath), { recursive: true });
|
|
160
|
+
const separator = current === '' || current.endsWith('\n') ? '' : '\n';
|
|
161
|
+
(0, fs_1.appendFileSync)(profilePath, `${separator}\n# Completion of the Codenotch CLI (cn)\n${line}\n`);
|
|
162
|
+
ConsoleUtils_1.default.check(`Completion installed in '${profilePath}', open a new terminal to use it.`);
|
|
163
|
+
}
|
|
164
|
+
/** The profile the next terminal of this shell reads */
|
|
165
|
+
function profileOf(detected) {
|
|
166
|
+
// bash and zsh read '$HOME', which Git Bash on Windows may set apart from the profile folder os.homedir() reports
|
|
167
|
+
const home = process.env.HOME || os_1.default.homedir();
|
|
168
|
+
switch (detected.shell) {
|
|
169
|
+
case 'zsh': return (0, path_1.join)(process.env.ZDOTDIR || home, '.zshrc');
|
|
170
|
+
// The Terminal of macOS opens login shells, which read .bash_profile and not .bashrc
|
|
171
|
+
case 'bash': return (0, path_1.join)(home, process.platform === 'darwin' ? '.bash_profile' : '.bashrc');
|
|
172
|
+
case 'powershell': return powershellProfile(detected.powershellExe);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/** The profile of the current user, asked to the PowerShell at hand since 'Documents' can be redirected */
|
|
176
|
+
function powershellProfile(exe) {
|
|
177
|
+
const candidates = exe !== undefined ? [exe] : ['pwsh', 'powershell'];
|
|
178
|
+
for (const candidate of candidates) {
|
|
179
|
+
try {
|
|
180
|
+
const output = (0, child_process_1.execFileSync)(candidate, ['-NoProfile', '-NonInteractive', '-Command', 'Write-Output $PROFILE'], { encoding: 'utf8', windowsHide: true, timeout: 15000 }).trim();
|
|
181
|
+
if (output !== '') {
|
|
182
|
+
return output;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
// Not installed, or not callable: try the next one
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
throw new Error(`No PowerShell found (pwsh or powershell) to ask the path of its profile.`);
|
|
33
190
|
}
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region Scripts
|
|
34
193
|
/**
|
|
35
194
|
* Every command path (aliases included) with the words it accepts next: its subcommands, its
|
|
36
195
|
* options, and the global options that are valid anywhere. Keyed "cn <path>" for the lookup.
|
|
@@ -73,6 +232,13 @@ function optionWords(command) {
|
|
|
73
232
|
}
|
|
74
233
|
return words;
|
|
75
234
|
}
|
|
235
|
+
function script(shell, table) {
|
|
236
|
+
switch (shell) {
|
|
237
|
+
case 'bash': return bashScript(table);
|
|
238
|
+
case 'zsh': return zshScript(table);
|
|
239
|
+
case 'powershell': return powershellScript(table);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
76
242
|
function bashScript(table) {
|
|
77
243
|
const cases = [...table.entries()].map(([key, words]) => ` "${key}") candidates="${words.join(' ')}" ;;`).join('\n');
|
|
78
244
|
return `# Completion of the Codenotch CLI, generated by 'cn completion bash'
|
|
@@ -142,4 +308,5 @@ ${entries}
|
|
|
142
308
|
${COMMAND_NAMES.map(name => `Register-ArgumentCompleter -Native -CommandName ${name} -ScriptBlock $cnCompletion`).join('\n')}
|
|
143
309
|
`;
|
|
144
310
|
}
|
|
311
|
+
//#endregion
|
|
145
312
|
//# sourceMappingURL=completion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../../src/commands/system/completion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../../src/commands/system/completion.ts"],"names":[],"mappings":";;;;;AAmCA,gDAyBC;AA3DD,kDAA0B;AAC1B,iDAA6C;AAC7C,2BAAyE;AACzE,4CAAoB;AACpB,+BAA+C;A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I,6BAA6B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;CAC3H,CAAC;AACF,CAAC;AAED,YAAY"}
|
package/dist/index.js
CHANGED
|
@@ -67,8 +67,8 @@ Getting started:
|
|
|
67
67
|
|
|
68
68
|
Automation:
|
|
69
69
|
stdout carries the results only, the progress and the messages go to stderr. Most commands take
|
|
70
|
-
'--json' for a machine-readable result and '--quiet' drops the progress. 'cn completion
|
|
71
|
-
|
|
70
|
+
'--json' for a machine-readable result and '--quiet' drops the progress. 'cn completion --install'
|
|
71
|
+
sets up the completion of the shell (bash, zsh or powershell, detected).
|
|
72
72
|
|
|
73
73
|
Environment:
|
|
74
74
|
CODENOTCH_PATH folder of the local runtime (default: ~/.codenotch)
|
package/dist/utils/BuildUtils.js
CHANGED
|
@@ -562,7 +562,7 @@ try {
|
|
|
562
562
|
name: 'codenotch-server-only',
|
|
563
563
|
enforce: 'pre',
|
|
564
564
|
resolveId(source, importer) {
|
|
565
|
-
if (!/^@codenotch\\/(process
|
|
565
|
+
if (!/^@codenotch\\/(process)(\\/|$)/.test(source)) {
|
|
566
566
|
return null;
|
|
567
567
|
}
|
|
568
568
|
if (importer) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codenotch/codenotch.cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.56",
|
|
4
4
|
"description": "The Codenotch CLI ('cn'): scaffold, run, validate, package and deploy full-stack TypeScript Codenotch projects - processes, tables, documents and React apps - on a local Codenotch runtime",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|