-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dynamic command options #5
Comments
In the last example, scim create user --user-name foo --email "[email protected],primary=true" --email "value [email protected]" I wonder if there is a risk to be ambiguous without forcing key:value data. I ignore your usecase but using a file could be another way to explore: scim create user < user_definition with
|
Yep, that was a typo. I meant
Currently scim2-cli uses the standard input, but expects JSON: $ scim2 create user << EOL
{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"userName": "[email protected]"
} I think JSON is still relevant for advanced payloads, but the |
The dot separator for sub-attributes might be hard to use because of pallets/click#2768, I think we will go with
|
From a user point of view, there are plenty hyphens to parse when writing the command line:
Note that I did not check how |
I like the >>> "name:formatted_name".isidentifier()
False I am not sure about why click has this limitation, since non-identifiers decls are still usable (although less convenient): >>> def foobar(**kwargs):
... print(kwargs["name:formatted_name"])
>>> foobar(**{"name:formatted_name": "George Abitbol"})
George Abitbol |
pydanclick is a good lead for externalizing the command management but I encountered some issues that makes it not fitted at the moment. |
The cleanest syntax I can think of is probably: scim create user --user-name "foobar" \
--emails --emails-value "[email protected]" --primary "true" \
--emails --emails-value "[email protected]" Here |
For the sake of usage convenience, scim2-cli should provide custom commands for every models, for example on
create
andreplace
command:scim create user --user-name foo --name.formatted-name bar
There will be difficulties to build a simple API for multiple complex attributes, for instance I am not sure if click allows this usage:
scim create user --user-name foo --email.0.value [email protected] --email.0.primary true --email.1.value [email protected]
At least for a start we can offer this API:
scim create user --user-name foo --email "[email protected],primary=true" --email "[email protected]"
The text was updated successfully, but these errors were encountered: