Skip to content

Commit

Permalink
env: added starship
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Sep 23, 2023
1 parent d987971 commit f21a71d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/actions/env/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,25 @@ import (
_os "os"

"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bridge/pkg/actions/bridge"
)

func init() {
knownVariables["common"] = variables{
Names: map[string]string{
"BROWSER": "the browser to use",
"EDITOR": "the editor to use",
"HTTP_PROXY": "http proxy server",
"HTTP_TIMEOUT": "The HTTP timeout in seconds",
"HTTPS_PROXY": "https proxy server",
"HTTP_TIMEOUT": "The HTTP timeout in seconds",
"PAGER": "the pager to use",
"PATH": "A list of directories to be searched when executing commands",
},
Completion: map[string]carapace.Action{
"PATH": carapace.ActionDirectories().List(string(_os.PathListSeparator)).NoSpace(),
"BROWSER": bridge.ActionCarapaceBin().Split(),
"EDITOR": bridge.ActionCarapaceBin().Split(),
"PAGER": bridge.ActionCarapaceBin().Split(),
"PATH": carapace.ActionDirectories().List(string(_os.PathListSeparator)).NoSpace(),
},
}

Expand Down
38 changes: 38 additions & 0 deletions pkg/actions/env/starship.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package env

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace/pkg/style"
)

func init() {
knownVariables["starship"] = variables{
Names: map[string]string{
"STARSHIP_CACHE": "cache location",
"STARSHIP_CONFIG": "config location",
"STARSHIP_LOG": "log level",
"STARSHIP_NUM_THREADS": "number of threads",
"STARSHIP_SESSION_KEY": "session key",
"STARSHIP_SHELL": "shell",
},
Completion: map[string]carapace.Action{
"STARSHIP_CACHE": carapace.ActionDirectories(),
"STARSHIP_CONFIG": carapace.ActionFiles(),
"STARSHIP_LOG": carapace.ActionValues("debug", "error", "info", "trace", "warn").StyleF(style.ForLogLevel),
"STARSHIP_SHELL": carapace.ActionValues(
"bash",
"cmd",
"elvish",
"fish",
"ion",
"nu",
"powershell",
"pwsh",
"tcsh",
"xonsh",
"zsh",
),
},
}

}

0 comments on commit f21a71d

Please sign in to comment.