-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP cli tool #44
base: main
Are you sure you want to change the base?
WIP cli tool #44
Conversation
|
||
return update_wrapper(new_func, f) | ||
|
||
def json_option(option_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this do? lets add a docstring with example
getstream/cli/video.py
Outdated
|
||
return cmd | ||
|
||
def add_option(cmd, param_name, param): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add_option_from_arg
is bit easier to understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about optional vs not optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
highly suggested to write a bunch of unit tests for this function (fastest way to make it 100%)
getstream/cli/video.py
Outdated
cmd = click.option(f'--{param_name}', type=int)(cmd) | ||
elif param.annotation == bool: | ||
cmd = click.option(f'--{param_name}', is_flag=True)(cmd) | ||
elif param.annotation == list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is probably not good enough: a list of strings or a list of numbers can be handled with click options multiple. A list of lists or structs needs to be provided as json encoded string
Examples:
Missing stuff:
Once we have this, we can have commands like these work out of the box and without any manual work