Skip to content

Commit

Permalink
Merge pull request #664 from rsteube/nushell-init
Browse files Browse the repository at this point in the history
nushell init
  • Loading branch information
rsteube authored Oct 9, 2021
2 parents 3ce35b0 + 130c615 commit 3c148d6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
3 changes: 3 additions & 0 deletions cmd/caralint/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ var rootCmd = &cobra.Command{
Use: "caralint",
Short: "",
Args: cobra.MinimumNArgs(1),
CompletionOptions: cobra.CompletionOptions{
DisableDefaultCmd: true,
},
Run: func(cmd *cobra.Command, args []string) {
exitCode := 0
for _, arg := range args {
Expand Down
8 changes: 8 additions & 0 deletions cmd/carapace/cmd/lazyInit.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ complete -c '%v' -f -a '(_carapace_lazy %v)'`, completer, completer, completer)
return fmt.Sprintf(snippet, strings.Join(complete, "\n"))
}

func nushell_lazy(completers []string) string {
snippet := make([]string, len(completers))
for index, completer := range completers {
snippet[index] = fmt.Sprintf(`config set completion.%v [carapace %v nushell _]`, completer, completer)
}
return strings.Join(snippet, "\n")
}

func oil_lazy(completers []string) string {
snippet := `_carapace_lazy() {
source <(carapace $1 oil)
Expand Down
2 changes: 2 additions & 0 deletions cmd/carapace/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ var rootCmd = &cobra.Command{
fmt.Println(elvish_lazy(completers))
case "fish":
fmt.Println(fish_lazy(completers))
case "nushell":
fmt.Println(nushell_lazy(completers))
case "oil":
fmt.Println(oil_lazy(completers))
case "powershell":
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
build: &base
image: ghcr.io/rsteube/carapace:v0.8.9
image: ghcr.io/rsteube/carapace:v0.8.11
command: sh -c 'sh -c "cd /carapace-bin/cmd/carapace && go generate ./... && go build -ldflags=\"-s -w\" ."'
environment:
TARGET: /carapace-bin/cmd/carapace/carapace
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-ps v1.0.0
github.com/pelletier/go-toml v1.9.3
github.com/rsteube/carapace v0.8.9
github.com/rsteube/carapace v0.8.11
github.com/spf13/cobra v1.2.1
github.com/spf13/pflag v1.0.5
golang.org/x/sys v0.0.0-20210510120138-977fb7262007
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rsteube/carapace v0.8.9 h1:SQPuHcXftpdLdXn9Q43uNwqJWtAV9zfsxaNnVEUgtPI=
github.com/rsteube/carapace v0.8.9/go.mod h1:vDNOn5K8QzGAqLTSA6WcUVvoUR5jRDcBxxQIAbv2XzY=
github.com/rsteube/carapace v0.8.11 h1:XYdIE3mvlx7X9k7PaGPGvxYEBRF5qYZtzUG9hDd6PA8=
github.com/rsteube/carapace v0.8.11/go.mod h1:vDNOn5K8QzGAqLTSA6WcUVvoUR5jRDcBxxQIAbv2XzY=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
Expand Down

0 comments on commit 3c148d6

Please sign in to comment.