Skip to content

Support provided argument list instead of sys.argv to make it easier …#3

Open
thors wants to merge 1 commit intoslank:masterfrom
thors:improve-wrapability
Open

Support provided argument list instead of sys.argv to make it easier …#3
thors wants to merge 1 commit intoslank:masterfrom
thors:improve-wrapability

Conversation

@thors
Copy link

@thors thors commented Sep 13, 2017

…to wrap the cli

Example of how I'd like to implement a wrapper:

    ap = argparse.ArgumentParser()
    ap.add_argument('--tag_dimension', default=[], action='append', help='EC2 instance tags to add')
    ap.add_argument('--dimensions', default="", help='fixed dimensions')
    (myargs,restargs) = ap.parse_known_args()
    new_dimensions=""
    for tag in myargs.tag_dimension:
        new_dimensions="," + tag + "=" + get_tag_value(tag)
    if len(myargs.dimensions) > 0:
        myargs.dimensions = myargs.dimensions + new_dimensions
    else:
        myargs.dimensions = new_dimensions[1:]
    if len(myargs.dimensions) > 0:
        restargs = ["--dimensions",myargs.dimensions] + restargs
    n2cw.cli.cli(restargs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants