mirror of
https://github.com/wavetermdev/inshellisense.git
synced 2026-08-05 13:43:30 -07:00
fix: tweak cli exposed surface
Signed-off-by: Chapman Pendery <cpendery@vt.edu>
This commit is contained in:
+3
-3
@@ -15,16 +15,16 @@ func init() {
|
||||
|
||||
var bindCmd = &cobra.Command{
|
||||
Use: "bind [shell]",
|
||||
Short: "adds keybindings to the selected shell",
|
||||
Short: "adds keybindings to the selected shell " + shell.SupportedShellsText,
|
||||
Args: func(_ *cobra.Command, args []string) error {
|
||||
if len(args) < 1 {
|
||||
return fmt.Errorf("you must select one of the supported shells: [%s]", strings.Join(shell.SupportedShells, ","))
|
||||
return fmt.Errorf("you must select one of the supported shells: %s", shell.SupportedShellsText)
|
||||
} else if len(args) > 1 {
|
||||
return fmt.Errorf("you can only bind to 1 shell at a time")
|
||||
}
|
||||
userSelectedShell := strings.TrimSpace(args[0])
|
||||
if !slices.Contains(shell.SupportedShells, userSelectedShell) {
|
||||
return fmt.Errorf("%s is not one of the supported shells: [%s]", userSelectedShell, strings.Join(shell.SupportedShells, ","))
|
||||
return fmt.Errorf("%s is not one of the supported shells: %s", userSelectedShell, shell.SupportedShellsText)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
||||
+5
-4
@@ -21,9 +21,10 @@ clac provides inshellisense for the command line to make developers
|
||||
more productive
|
||||
|
||||
complete documentation is available at https://github.com/cpendery/clac`,
|
||||
SilenceUsage: true,
|
||||
Args: cobra.ArbitraryArgs,
|
||||
RunE: rootExec,
|
||||
SilenceUsage: true,
|
||||
Args: cobra.ArbitraryArgs,
|
||||
RunE: rootExec,
|
||||
CompletionOptions: cobra.CompletionOptions{HiddenDefaultCmd: true},
|
||||
}
|
||||
outputCmd bool
|
||||
enableLogging bool
|
||||
@@ -31,7 +32,7 @@ complete documentation is available at https://github.com/cpendery/clac`,
|
||||
|
||||
func init() {
|
||||
rootCmd.Flags().BoolVarP(&outputCmd, "output-cmd", "o", false, "outputs the last cmd from a clac execution")
|
||||
rootCmd.Flags().BoolVarP(&enableLogging, "logging", "l", false, "enable logging to the `clac.log` file")
|
||||
rootCmd.Flags().BoolVarP(&enableLogging, "logging", "l", false, "enable logging to clac.log")
|
||||
}
|
||||
|
||||
func rootExec(cmd *cobra.Command, args []string) error {
|
||||
|
||||
+3
-1
@@ -6,12 +6,14 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/adrg/xdg"
|
||||
)
|
||||
|
||||
var (
|
||||
SupportedShells = []string{"bash", "windows-powershell", "powershell"}
|
||||
SupportedShells = []string{"bash", "zsh", "windows-powershell", "powershell"}
|
||||
SupportedShellsText = "[" + strings.Join(SupportedShells, ", ") + "]"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user