File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change
1
+ # Complete paths after @ in options:
2
+ function __xh_complete_data
3
+ string match -qr ' ^(?<prefix>.*@)(?<path>.*)' -- (commandline -ct )
4
+ printf ' %s\ n' -- $prefix (__fish_complete_path $path )
5
+ end
6
+ complete -c xh -n ' string match -qr "@" -- (commandline -ct)' -kxa " (__xh_complete_data)"
7
+
1
8
complete -c xh -l raw -d ' Pass raw request data without extra processing' -r
2
9
complete -c xh -l pretty -d ' Controls output processing' -r -f -a " all\t'(default) Enable both coloring and formatting'
3
10
colors\t'Apply syntax highlighting to output'
Original file line number Diff line number Diff line change @@ -19,7 +19,23 @@ pub fn generate(bin_name: &str, generate: Generate) {
19
19
clap_complete:: generate ( Shell :: Elvish , & mut app, bin_name, & mut io:: stdout ( ) ) ;
20
20
}
21
21
Generate :: CompleteFish => {
22
- clap_complete:: generate ( Shell :: Fish , & mut app, bin_name, & mut io:: stdout ( ) ) ;
22
+ use std:: io:: Write ;
23
+ let mut buf = Vec :: new ( ) ;
24
+ clap_complete:: generate ( Shell :: Fish , & mut app, bin_name, & mut buf) ;
25
+ let mut stdout = io:: stdout ( ) ;
26
+ let preamble = format ! (
27
+ r#"# Complete paths after @ in options:
28
+ function __xh_complete_data
29
+ string match -qr '^(?<prefix>.*@)(?<path>.*)' -- (commandline -ct)
30
+ printf '%s\n' -- $prefix(__fish_complete_path $path)
31
+ end
32
+ complete -c {bin_name} -n 'string match -qr "@" -- (commandline -ct)' -kxa "(__xh_complete_data)"
33
+
34
+ "# ,
35
+ bin_name = bin_name,
36
+ ) ;
37
+ stdout. write_all ( preamble. as_bytes ( ) ) . unwrap ( ) ;
38
+ stdout. write_all ( & buf) . unwrap ( ) ;
23
39
}
24
40
Generate :: CompleteNushell => {
25
41
clap_complete:: generate ( Nushell , & mut app, bin_name, & mut io:: stdout ( ) ) ;
You can’t perform that action at this time.
0 commit comments