mirror of
https://github.com/rsteube/carapace-bin.git
synced 2025-05-05 15:32:53 +00:00
Added doas completer
This commit is contained in:
parent
6213be71bc
commit
4d6ab56cdb
39
completers/doas_completer/cmd/root.go
Normal file
39
completers/doas_completer/cmd/root.go
Normal file
@ -0,0 +1,39 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/carapace-sh/carapace-bin/pkg/actions/os"
|
||||
"github.com/carapace-sh/carapace-bridge/pkg/actions/bridge"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "doas",
|
||||
Short: "execute a command as another user",
|
||||
Long: "https://man.openbsd.org/doas",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func Execute() error {
|
||||
return rootCmd.Execute()
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(rootCmd).Standalone()
|
||||
rootCmd.Flags().SetInterspersed(false)
|
||||
|
||||
rootCmd.Flags().BoolS("clear", "L", false, "Clear any persisted authentications and exit")
|
||||
rootCmd.Flags().StringS("config", "C", "", "Parse and check configuration file, do not execute command")
|
||||
rootCmd.Flags().BoolS("shell", "s", false, "Execute shell from $SHELL or /etc/passwd")
|
||||
rootCmd.Flags().BoolS("silent", "n", false, "Non interactive mode, fail if password entry is needed")
|
||||
rootCmd.Flags().StringS("user", "u", "root", "Execute command as specified user")
|
||||
|
||||
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
|
||||
"config": carapace.ActionFiles(),
|
||||
"user": os.ActionUsers(),
|
||||
})
|
||||
|
||||
carapace.Gen(rootCmd).PositionalAnyCompletion(
|
||||
bridge.ActionCarapaceBin(),
|
||||
)
|
||||
}
|
7
completers/doas_completer/main.go
Normal file
7
completers/doas_completer/main.go
Normal file
@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "github.com/carapace-sh/carapace-bin/completers/doas_completer/cmd"
|
||||
|
||||
func main() {
|
||||
cmd.Execute()
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user