Skip to content

Commit 839464a

Browse files
committed
prettier
1 parent cc5202b commit 839464a

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

bin/cli.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ async function main() {
3232
// everything after "complete" as the completion payload.
3333
const completionArgs =
3434
// POSIX or already-present separator
35-
(dashIndex !== -1 && (!isPowerShell || dashIndex < process.argv.length - 1))
35+
dashIndex !== -1 && (!isPowerShell || dashIndex < process.argv.length - 1)
3636
? process.argv.slice(dashIndex + 1)
3737
: isPowerShell
38-
// PowerShell shims may drop the first '--' and leave only a trailing one
39-
? args.slice(2)
38+
? // PowerShell shims may drop the first '--' and leave only a trailing one
39+
args.slice(2)
4040
: null;
4141

4242
if (!completionArgs) {
@@ -81,7 +81,6 @@ function generateCompletionScript(packageManager: string, shell: string) {
8181
const name = packageManager;
8282
console.log(process.argv);
8383

84-
8584
const isLocalDev = process.argv[1].endsWith('dist/bin/cli.js');
8685

8786
const executable = isLocalDev

src/powershell.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@ import { ShellCompDirective } from './t';
33
// TODO: issue with -- -- completions
44

55
export function generate(
6-
name: string,
7-
exec: string,
8-
includeDesc = false
6+
name: string,
7+
exec: string,
8+
includeDesc = false
99
): string {
10-
// Replace '-' and ':' with '_' for variable names
11-
const nameForVar = name.replace(/[-:]/g, '_');
12-
13-
// Determine the completion command
14-
// const compCmd = includeDesc ? "complete" : "complete";
15-
16-
// Shell completion directives
17-
const ShellCompDirectiveError = ShellCompDirective.ShellCompDirectiveError;
18-
const ShellCompDirectiveNoSpace =
19-
ShellCompDirective.ShellCompDirectiveNoSpace;
20-
const ShellCompDirectiveNoFileComp =
21-
ShellCompDirective.ShellCompDirectiveNoFileComp;
22-
const ShellCompDirectiveFilterFileExt =
23-
ShellCompDirective.ShellCompDirectiveFilterFileExt;
24-
const ShellCompDirectiveFilterDirs =
25-
ShellCompDirective.ShellCompDirectiveFilterDirs;
26-
const ShellCompDirectiveKeepOrder =
27-
ShellCompDirective.ShellCompDirectiveKeepOrder;
28-
29-
return `# powershell completion for ${name} -*- shell-script -*-
10+
// Replace '-' and ':' with '_' for variable names
11+
const nameForVar = name.replace(/[-:]/g, '_');
12+
13+
// Determine the completion command
14+
// const compCmd = includeDesc ? "complete" : "complete";
15+
16+
// Shell completion directives
17+
const ShellCompDirectiveError = ShellCompDirective.ShellCompDirectiveError;
18+
const ShellCompDirectiveNoSpace =
19+
ShellCompDirective.ShellCompDirectiveNoSpace;
20+
const ShellCompDirectiveNoFileComp =
21+
ShellCompDirective.ShellCompDirectiveNoFileComp;
22+
const ShellCompDirectiveFilterFileExt =
23+
ShellCompDirective.ShellCompDirectiveFilterFileExt;
24+
const ShellCompDirectiveFilterDirs =
25+
ShellCompDirective.ShellCompDirectiveFilterDirs;
26+
const ShellCompDirectiveKeepOrder =
27+
ShellCompDirective.ShellCompDirectiveKeepOrder;
28+
29+
return `# powershell completion for ${name} -*- shell-script -*-
3030
3131
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
3232
function __${name}_debug {

0 commit comments

Comments
 (0)