Skip to content

Wrong parsing of argument when passing an option #611

Closed

Description

@nir0s

This is what happens to me.

cfy blueprints upload /home/nir0s/repos/cloudify/simple-python-webserver-blueprint/blueprint.yaml --validate
Usage: cfy [OPTIONS] BLUEPRINT_PATH

Error: Got unexpected extra arguments (h o m e / n i r 0 s / r e p o s / c l o u d i f y / s i m p l e - p y t h o n - w e b s e r v e r - b l u e p r i n t / b l u e p r i n t . y a m l)

The command's code is:

@blueprints.command(name='upload')
@click.argument('blueprint-path', nargs=1, required=True)
@cfy.options.blueprint_id()
@cfy.options.blueprint_filename()
@cfy.options.validate
def upload(blueprint_path,
           blueprint_id,
           blueprint_filename,
           validate):
    """Upload a blueprint to the manager
    """
    ...

and cfy.options.validate is this:

        self.validate = click.option(
            '--validate',
            is_flag=True,
            help=helptexts.VALIDATE_BLUEPRINT)
...

Where this command is a part of a group called blueprints which doesn't implement any special

A few things to note:

  • When I don't provide the --validate flag, it parses well.
  • When I provide something that doesn't start with /, it also parses well.
  • I can't use the File type provided by click to verify the path because it can also be a url
  • I'm running Python 2.7.1
  • I tried Click 4 and updated 6.6 and it gave me the same error.

Activity

  1. fdavis commented on May 15, 2018

    @fdavis
    Contributor

    I believe that / is accepted to be more compatible with windows tools so we may need a way to escape that

  2. davidism commented on Feb 28, 2022

    @davidism
    Member

    I can't reproduce this issue using the provided example.

  3. locked as resolved and limited conversation to collaborators on Mar 15, 2022
  4. added
    parsingParsing, parameters, commands, chaining, context
    on Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    parsingParsing, parameters, commands, chaining, context

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions