Conversation
|
I think |
|
|
||
| ### Changed | ||
|
|
||
| - `code42 profile create` now uses required `--name`, `--server` and `--username` flags instead of positional arguments. |
There was a problem hiding this comment.
Just confirmed. code42 high-risk-employee add-risk-tags and remove-risk-tags have also changed.
There was a problem hiding this comment.
And the usage for adding / removing risk-tags
| self._settings[u"nargs"] = nargs | ||
|
|
||
| def set_required(self, required=False): | ||
| def set_required(self, required): |
There was a problem hiding this comment.
This method could probably just be make_required()
There was a problem hiding this comment.
This was already in place -- and you could use it to set something that would normally be required to not be required. Keeping as-is seems more flexible imo.
src/code42cli/args.py
Outdated
| # this is a positional arg, treat it as a required cli arg. | ||
| option_names = [param_name] | ||
| return ArgConfig(*option_names, default=default) | ||
| if num_positional_args > 1: |
There was a problem hiding this comment.
I think you could do an elif and an else for the parent block instead of a nested if block here.
| required = True | ||
| else: | ||
| option_names = [param_name] | ||
| return ArgConfig(*option_names, default=default, required=required) |
There was a problem hiding this comment.
I am trying to test the single arg case to make sure that still works but it seems to now. I can't do code42 high-risk-employee add juliya.smith+partners@code42.com
It is making me do code42 high-risk-employee add --username juliya.smith+partners@code42.com
There was a problem hiding this comment.
hmmm thanks, I'll look into this
There was a problem hiding this comment.
this is because im not excluding sdk and profile, good find, thanks
antazoey
left a comment
There was a problem hiding this comment.
Some stuff is not working yet. I am happy we're doing this.
| Command( | ||
| u"add-risk-tags", | ||
| u"Associates risk tags with a user.", | ||
| u"code42 high-risk-employee add-risk-tags --username <username> --risk-tag <risk-tags>", |
There was a problem hiding this comment.
Do you think code42 high-risk-employee add-risk-tags --username --tags <risk-tags would be better? difference between it's less redundant than saying risk-tag over again. The word risk happens three times for this command
There was a problem hiding this comment.
yeah i do like that
src/code42cli/cmds/profile.py
Outdated
| u"Create profile settings. The first profile created will be the default.", | ||
| u"{} {}".format(usage_prefix, u"create <profile-name> <server-address> <username>"), | ||
| u"{} {}".format( | ||
| usage_prefix, u"create --name <name> --server <server-address> --username <username>" |
There was a problem hiding this comment.
Would name confuse anyone? Would anyone mistake this for their human name?
There was a problem hiding this comment.
i can switch the <name> to <profile-name> but dont think the flag name has to change
redo the internals of the cli so that only commands that have exactly one required argument use positional arguments.
commands with multiple required arguments will now be flagged.
profile createis the only command affected by this change.