Skip to content

Commit

Permalink
Merge pull request #938 from rsteube/nushell-fix-snippet
Browse files Browse the repository at this point in the history
nushell: fix snippet
  • Loading branch information
rsteube authored Oct 15, 2023
2 parents bf44ea8 + 8212a04 commit f796f2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
16 changes: 2 additions & 14 deletions example/cmd/_test/nushell.nu
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
let external_completer = {|spans|
{
$spans.0: { } # default
example: { example _carapace nushell $spans | from json }
} | get $spans.0 | each {|it| do $it}
}

let-env config = {
completions: {
external: {
enable: true
completer: $external_completer
}
}
let example_completer = {|spans|
example _carapace nushell $spans | from json
}
16 changes: 2 additions & 14 deletions internal/shell/nushell/snippet.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,7 @@ import (

// Snippet creates the nushell completion script.
func Snippet(cmd *cobra.Command) string {
return fmt.Sprintf(`let external_completer = {|spans|
{
$spans.0: { } # default
%v: { %v _carapace nushell $spans | from json }
} | get $spans.0 | each {|it| do $it}
}
let-env config = {
completions: {
external: {
enable: true
completer: $external_completer
}
}
return fmt.Sprintf(`let %v_completer = {|spans|
%v _carapace nushell $spans | from json
}`, cmd.Name(), uid.Executable())
}

0 comments on commit f796f2b

Please sign in to comment.