reactioncommerce / reaction-cli

A command line tool for working with Reaction Commerce.
33 stars 20 forks source link

id in addition to app / name arguments #30

Closed aaronjudd closed 6 years ago

aaronjudd commented 7 years ago

Suggest that there should be a --id, and ID argument in addition to --app or --name.

It feels as though some commands are using --app, others --name, and it's not always apparent which / why. ID might be less legible, but could be consistent.

jshimko commented 7 years ago

Yeah, I went back and forth a bit on that when I first wrote it. I ended up going with --name on the reaction apps ... commands because it felt like this might be a little confusing...

reaction apps create --app somename 

verses the way it currently is...

reaction apps create --name somename

But then the opposite was confusing for other non-app commands that referenced a specific app.
For example...

reaction domains add --name somename --domain example.com

# name of what? the domain or the app?

So I standardized the opposite for every other command since none of them felt natural with --name, but most were doing an operation on an --app

reaction domains add --app somename --domain example.com

# this feels a little clearer than --name

I'm totally open to usability discussion here though. Maybe the solution is just better feedback on common mistakes. Essentially, any time a command isn't 100% valid, kick back an example of a valid command of that type (something git does fairly well with their nested command structure).

And perhaps structure help output like:

global help

reaction --help

subcommand help

reaction apps --help

and then specific command help

reaction apps delete --help

And then just add better feedback for those common mistakes like missing required args or including invalid args.

To your original reason for opening the issue, I also don't see any reason we couldn't add an --id arg. I don't know how much it would get used, but it certainly doesn't hurt to have it available. If nothing else, that would allow the CLI to not have to parse the user's config file to get the _id that the API call needs. Think of all of those saved microseconds from skipping a file system read operation! :)

aaronjudd commented 6 years ago

Feel that the current --app and --name are working well. Closing.

Reaction CLI: 0.18.1