Skip to content

Commit

Permalink
Merge pull request #34 from Anaconda-Platform/fix-env-spec-name
Browse files Browse the repository at this point in the history
Make -n arg required for add-env-spec remove-env-spec
  • Loading branch information
havocp committed Mar 6, 2017
2 parents 940d8f9 + f67fc7f commit 60dc348
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions anaconda_project/commands/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ def add_prepare_args(preset, include_command=True):
action='store',
help="A command name from anaconda-project.yml (env spec for this command will be used)")

def add_env_spec_name_arg(preset):
def add_env_spec_name_arg(preset, required):
preset.add_argument('-n',
'--name',
metavar='ENVIRONMENT_SPEC_NAME',
required=required,
action='store',
help="Name of the environment spec from anaconda-project.yml")

Expand Down Expand Up @@ -217,12 +218,12 @@ def add_package_args(preset):
preset = subparsers.add_parser('add-env-spec', help="Add a new environment spec to the project")
add_directory_arg(preset)
add_package_args(preset)
add_env_spec_name_arg(preset)
add_env_spec_name_arg(preset, required=True)
preset.set_defaults(main=environment_commands.main_add)

preset = subparsers.add_parser('remove-env-spec', help="Remove an environment spec from the project")
add_directory_arg(preset)
add_env_spec_name_arg(preset)
add_env_spec_name_arg(preset, required=True)
preset.set_defaults(main=environment_commands.main_remove)

preset = subparsers.add_parser('list-env-specs', help="List all environment specs for the project")
Expand All @@ -231,7 +232,7 @@ def add_package_args(preset):

preset = subparsers.add_parser('export-env-spec', help="Save an environment spec as a conda environment file")
add_directory_arg(preset)
add_env_spec_name_arg(preset)
add_env_spec_name_arg(preset, required=False)
preset.add_argument('filename', metavar='ENVIRONMENT_FILE')
preset.set_defaults(main=environment_commands.main_export)

Expand Down

0 comments on commit 60dc348

Please sign in to comment.