Skip to content

Commit

Permalink
nushell: fix snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Oct 15, 2023
1 parent bf44ea8 commit 8212a04
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 8212a04

Please sign in to comment.