Skip to content

Commit

Permalink
:p: Fix -v usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnjack committed Nov 28, 2023
1 parent 4553dbf commit 4776436
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/cmd_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var rootCmd = &cobra.Command{
Example: `invenv -- somepath/myscript.py
invenv -n -- somepath/myscript.py --version
invenv -r req.txt -- DEBUG=1 somepath/myscript.py`,
Args: cobra.MinimumNArgs(1),
Short: "a tool to automatically create and run your Python scripts in a virtual environment with installed dependencies. See https://github.com/jsnjack/invenv",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
Expand Down Expand Up @@ -62,6 +61,11 @@ invenv -r req.txt -- DEBUG=1 somepath/myscript.py`,
return nil
}

if len(args) == 0 {
cmd.SilenceUsage = false
return fmt.Errorf("no script name provided")
}

envVars, scriptName, scriptArgs := organizeArgs(args)
if scriptName == "" {
cmd.SilenceUsage = false
Expand Down

0 comments on commit 4776436

Please sign in to comment.