feat(init): allow passing specific shell to setup command (#25)

This commit is contained in:
VERSE
2026-07-03 13:55:07 +07:00
committed by GitHub
parent 4ca744983c
commit ee1ef2dd73
+9 -3
View File
@@ -97,8 +97,9 @@ func init() {
} }
var setupCmd = &cobra.Command{ var setupCmd = &cobra.Command{
Use: "setup", Use: "setup [shell]",
Short: "Automatically setup iris shell integration and install binary", Short: "Automatically setup iris shell integration and install binary",
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
home, _ := os.UserHomeDir() home, _ := os.UserHomeDir()
@@ -122,8 +123,13 @@ var setupCmd = &cobra.Command{
return return
} }
shellPath := os.Getenv("SHELL") var shellName string
shellName := filepath.Base(shellPath) if len(args) > 0 {
shellName = args[0]
} else {
shellPath := os.Getenv("SHELL")
shellName = filepath.Base(shellPath)
}
var configFile string var configFile string
var evalCmd string var evalCmd string