@@ -3,30 +3,30 @@ import { ShellCompDirective } from './t';
33// TODO: issue with -- -- completions
44
55export 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 {
@@ -75,7 +75,7 @@ export function generate(
7575 # Split the command at the first space to separate the program and arguments.
7676 $Program, $Arguments = $Command.Split(" ", 2)
7777
78- $RequestComp = "& ${ exec } complete -- $Arguments"
78+ $RequestComp = "& ${ exec } complete --% -- $Arguments"
7979 __${ name } _debug "RequestComp: $RequestComp"
8080
8181 # we cannot use $WordToComplete because it
0 commit comments