File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 1- let example_completer = {|spans |
1+ let example_completer = {|spans |
2+ # if the current command is an alias, get it's expansion
3+ let expanded_alias = (scope aliases | where name == $spans.0 | $in.0 ?.expansion? )
4+
5+ # overwrite
6+ let spans = (if $expanded_alias != null {
7+ # put the first word of the expanded alias first in the span
8+ $spans | skip 1 | prepend ($expanded_alias | split row " " | take 1 )
9+ } else {
10+ $spans | skip 1 | prepend ($spans.0 )
11+ })
12+
213 example _carapace nushell ... $spans | from json
314}
Original file line number Diff line number Diff line change @@ -10,7 +10,18 @@ import (
1010
1111// Snippet creates the nushell completion script.
1212func Snippet (cmd * cobra.Command ) string {
13- return fmt .Sprintf (`let %v_completer = {|spans|
13+ return fmt .Sprintf (`let %v_completer = {|spans|
14+ # if the current command is an alias, get it's expansion
15+ let expanded_alias = (scope aliases | where name == $spans.0 | $in.0?.expansion?)
16+
17+ # overwrite
18+ let spans = (if $expanded_alias != null {
19+ # put the first word of the expanded alias first in the span
20+ $spans | skip 1 | prepend ($expanded_alias | split row " " | take 1)
21+ } else {
22+ $spans | skip 1 | prepend ($spans.0)
23+ })
24+
1425 %v _carapace nushell ...$spans | from json
1526}` , cmd .Name (), uid .Executable ())
1627}
You can’t perform that action at this time.
0 commit comments