mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-21 02:55:37 -08:00
fix(cli): avoid panicking when no argument is given (#2024)
This commit is contained in:
parent
b61ec064dd
commit
961c4db31b
|
@ -30,6 +30,10 @@ See the documentation to initialize your shell: https://ohmyposh.dev/docs/prompt
|
|||
},
|
||||
Args: cobra.OnlyValidArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) == 0 {
|
||||
_ = cmd.Help()
|
||||
return
|
||||
}
|
||||
runInit(args[0])
|
||||
},
|
||||
}
|
||||
|
|
|
@ -45,6 +45,10 @@ var printCmd = &cobra.Command{
|
|||
},
|
||||
Args: cobra.OnlyValidArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) == 0 {
|
||||
_ = cmd.Help()
|
||||
return
|
||||
}
|
||||
env := &environment.ShellEnvironment{
|
||||
Version: cliVersion,
|
||||
CmdFlags: &environment.Flags{
|
||||
|
|
Loading…
Reference in a new issue