@pnpm/cli.commands 1100.0.23 → 1100.0.25
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.
|
@@ -12,7 +12,7 @@ export async function complete(ctx, input) {
|
|
|
12
12
|
};
|
|
13
13
|
// Autocompleting option values
|
|
14
14
|
if (input.currentTypedWordType !== 'option') {
|
|
15
|
-
if (input.lastOption === '--filter') {
|
|
15
|
+
if (input.lastOption === '--filter' || input.lastOption === '-F') {
|
|
16
16
|
const workspaceDir = await findWorkspaceDir(process.cwd()) ?? process.cwd();
|
|
17
17
|
const workspaceManifest = await readWorkspaceManifest(workspaceDir);
|
|
18
18
|
const allProjects = await findWorkspaceProjects(workspaceDir, {
|
|
@@ -12,13 +12,29 @@ export function help() {
|
|
|
12
12
|
usages: SUPPORTED_SHELLS.map(shell => `pnpm completion ${shell}`),
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
+
const PNPM_COMMAND = 'pnpm';
|
|
16
|
+
const PNPM_SHORT_ALIAS = 'pn';
|
|
15
17
|
export function createCompletionGenerator(ctx) {
|
|
16
18
|
return async function handler(_opts, params) {
|
|
17
19
|
const shell = getShellFromParams(params);
|
|
18
|
-
const output = await getCompletionScript({ name:
|
|
19
|
-
ctx.log(output);
|
|
20
|
+
const output = await getCompletionScript({ name: PNPM_COMMAND, completer: PNPM_COMMAND, shell });
|
|
21
|
+
ctx.log(registerShortAlias(output, shell));
|
|
20
22
|
};
|
|
21
23
|
}
|
|
24
|
+
function registerShortAlias(output, shell) {
|
|
25
|
+
switch (shell) {
|
|
26
|
+
case 'bash':
|
|
27
|
+
return output.replace(`complete -o default -F _${PNPM_COMMAND}_completion ${PNPM_COMMAND}`, `complete -o default -F _${PNPM_COMMAND}_completion ${PNPM_COMMAND} ${PNPM_SHORT_ALIAS}`);
|
|
28
|
+
case 'fish':
|
|
29
|
+
return output.replace(`complete -f -d '${PNPM_COMMAND}' -c ${PNPM_COMMAND} -a "(_${PNPM_COMMAND}_completion)"`, `complete -f -d '${PNPM_COMMAND}' -c ${PNPM_COMMAND} -a "(_${PNPM_COMMAND}_completion)"\ncomplete -f -d '${PNPM_COMMAND}' -c ${PNPM_SHORT_ALIAS} -a "(_${PNPM_COMMAND}_completion)"`);
|
|
30
|
+
case 'pwsh':
|
|
31
|
+
return output.replace(`Register-ArgumentCompleter -CommandName '${PNPM_COMMAND}' -ScriptBlock`, `Register-ArgumentCompleter -CommandName '${PNPM_COMMAND}','${PNPM_SHORT_ALIAS}' -ScriptBlock`);
|
|
32
|
+
case 'zsh':
|
|
33
|
+
return output
|
|
34
|
+
.replace(`#compdef ${PNPM_COMMAND}`, `#compdef ${PNPM_COMMAND} ${PNPM_SHORT_ALIAS}`)
|
|
35
|
+
.replace(`compdef _${PNPM_COMMAND}_completion ${PNPM_COMMAND}`, `compdef _${PNPM_COMMAND}_completion ${PNPM_COMMAND} ${PNPM_SHORT_ALIAS}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
22
38
|
export const handler = createCompletionGenerator({
|
|
23
39
|
log: console.log,
|
|
24
40
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/cli.commands",
|
|
3
|
-
"version": "1100.0.
|
|
3
|
+
"version": "1100.0.25",
|
|
4
4
|
"description": "Commands for pnpm CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"render-help": "^2.0.0",
|
|
34
34
|
"split-cmd": "^1.1.0",
|
|
35
35
|
"@pnpm/cli.command": "^1100.0.1",
|
|
36
|
-
"@pnpm/cli.parse-cli-args": "^1100.1.5",
|
|
37
|
-
"@pnpm/cli.utils": "^1101.0.13",
|
|
38
36
|
"@pnpm/error": "^1100.0.1",
|
|
39
|
-
"@pnpm/config.reader": "1101.
|
|
37
|
+
"@pnpm/config.reader": "1101.11.1",
|
|
40
38
|
"@pnpm/workspace.root-finder": "^1100.0.3",
|
|
41
39
|
"@pnpm/workspace.projects-reader": "^1101.0.13",
|
|
42
|
-
"@pnpm/workspace.workspace-manifest-reader": "^1100.0.9"
|
|
40
|
+
"@pnpm/workspace.workspace-manifest-reader": "^1100.0.9",
|
|
41
|
+
"@pnpm/cli.parse-cli-args": "^1100.1.5",
|
|
42
|
+
"@pnpm/cli.utils": "^1101.0.13"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@pnpm/logger": "^1100.0.0"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@jest/globals": "30.4.1",
|
|
49
49
|
"@types/ramda": "0.31.1",
|
|
50
50
|
"@pnpm/logger": "1100.0.0",
|
|
51
|
-
"@pnpm/cli.commands": "1100.0.
|
|
51
|
+
"@pnpm/cli.commands": "1100.0.25"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22.13"
|