@@ -13,7 +13,7 @@ def build-completions-from-pwd [] {
13
13
14
14
# build a completion form a .fish file and generate a .nu file
15
15
def build-completion [fish_file : path , nu_file : path ] {
16
- open $fish_file | parse-fish | make-commands-completion | str join " \n\n " | save $nu_file
16
+ open $fish_file | parse-fish | make-commands-completion | str join " \n\n " | save $nu_file - f
17
17
}
18
18
19
19
# parse a .fish file based on autogenerated complete syntax
@@ -78,6 +78,7 @@ def make-commands-completion [] {
78
78
| get c # c is the command name
79
79
| uniq # is cloned on every complete line
80
80
| each { |command |
81
+ print $' COMMAND ($command )'
81
82
$fishes | where c == $command | make-subcommands-completion [$command ]
82
83
| str join " \n\n "
83
84
}
@@ -94,6 +95,7 @@ def make-subcommands-completion [parents: list<string>] {
94
95
| group-by a # group by sub command (a flag)
95
96
| transpose name args # turn it into a table of name to arguments
96
97
| each {|subcommand |
98
+ print $' SUBCOMMAND ($subcommand.name ) ($subcommand.args | length )'
97
99
[
98
100
# description
99
101
(if (' d' in ($subcommand.args | columns )) and ($subcommand.args.d != " " ) { $" # ($subcommand.args.d.0 )\n " })
@@ -103,7 +105,7 @@ def make-subcommands-completion [parents: list<string>] {
103
105
" [\n "
104
106
(
105
107
$fishes
106
- | if (' n' in ($subcommand | columns )) {
108
+ | if (' n' in ($subcommand.args | columns )) {
107
109
if ($subcommand.name != " " ) {
108
110
where ($it.n | str contains $subcommand.name ) # for subcommand -> any where n matches `__fish_seen_subcommand_from arg` for the subcommand name
109
111
} else {
0 commit comments