Merge pull request #1867 from rsteube/env-starship

env: added starship
This commit is contained in:
rsteube 2023-09-23 13:40:06 +02:00 committed by GitHub
commit 3ce9b6f114
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 2 deletions

View File

@ -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(),
},
}

38
pkg/actions/env/starship.go vendored Normal file
View File

@ -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",
),
},
}
}