Skip to content

Commit

Permalink
Fix commands with arguments that start with "-"
Browse files Browse the repository at this point in the history
Parameters that start with "-" are interpreted as a new argument. argparse.REMAINDER forces it to interpret all everything left in the command as a list of strings instead of new arguments. Fixes issue conda#177
  • Loading branch information
JTignor-Raltron committed Jan 26, 2024
1 parent 1df31c6 commit e625b3b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion menuinst/_legacy/cwp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main():
"--no-console", action="store_true", help="Create subprocess with CREATE_NO_WINDOW flag."
)
parser.add_argument("prefix", help="Prefix to be 'activated' before calling `args`.")
parser.add_argument("args", nargs="*", help="Command (and arguments) to be executed.")
parser.add_argument("args", nargs=argparse.REMAINDER, help="Command (and arguments) to be executed.")
parsed_args = parser.parse_args()

no_console = parsed_args.no_console
Expand Down

0 comments on commit e625b3b

Please sign in to comment.