Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

rkt: adopt CLI framework #632

Closed
jonboulle opened this issue Mar 17, 2015 · 9 comments
Closed

rkt: adopt CLI framework #632

jonboulle opened this issue Mar 17, 2015 · 9 comments

Comments

@jonboulle
Copy link
Contributor

As touched on in #183 and #630 (and probably elsewhere), we should just evaluate and adopt a framework for the rkt CLI so we can provide a better and more consistent UX experience.

Two key suggestions so far have been:

@blalor
Copy link

blalor commented Apr 19, 2015

If you're still evaluating frameworks, I'm a big fan of github.com/jessevdk/go-flags.

@jonboulle
Copy link
Contributor Author

thanks for the tip!

On Sun, Apr 19, 2015 at 3:25 AM, Brian Lalor notifications@github.com
wrote:

If you're still evaluating frameworks, I'm a big fan of
github.com/jessevdk/go-flags.


Reply to this email directly or view it on GitHub
#632 (comment).

@samsabed
Copy link

@jonboulle what do you think of amending how image options are specified, both the pass thru run time options and the options that apply to an image (aka --mount --signature )
#896

@sgotti
Copy link
Contributor

sgotti commented Jun 4, 2015

Following this, #896 and other issues/PR I'd like to summarize the various requirements that I saw until now and some additional one introduced by me that problably will be proposed in a future.

  1. Commands should be able to handle flags: --something, arguments IMAGE and the special argument --- for rkt run. The arguments should keep their order.
  2. Ability to merge global and parent command flags (see rkt: merge global flags into command flags #183). For example in rkt command subcommand, the subcommand should see its flags, the parent command's flags and the globalFlags (with additional colliding flags detection?).
  3. Print all commands (also subcommands) in the main help stage0: move image-related commands into single subcommand #933 (comment)
  4. Handle getopt like short and long flags ?
  5. Print globalFlags also in command help ?
  6. Handle unambiguous not fully typed commands (like rkt im c for rkt image cat-manifest) and/or command suggestions?
  7. bash, zsh completion ?

Some comments:

  • The use of subcommands can be misleading due to arguments that can be interpreted as a subcommand instead of a command argument. If this is going to be a problem, I'd propose that a command that has some subcommands should not execute any function but It'll only provide common flags for all the subcommands.
  • As I can see, cobra isn't probably supporting 1 (due to ---) (Cli framework #896) and should be investigated if the help can be tuned to support 3.
  • https://github.com/codegangsta/cli could be another one to try, I'm not sure if it can be tuned to provide 3 as it has specific helps for app, command and subcommand.
  • Another solution will be to get the best of the known framework and just improve rkt command handling (like it was already done) to support these requirements. For 4 the flag library could be swapped with an external one like https://github.com/ogier/pflag (the same used by cobra) if it doesn't introduces problems with ---.

@jonboulle
Copy link
Contributor Author

@sgotti good summary. Are you volunteering to take this on? ;-)

The use of subcommands can be misleading due to arguments that can be interpreted as a subcommand instead of a command argument.

Do you mean within a subcommand or just the inconsistency of some sub-commands being multi-level and others not?

@sgotti
Copy link
Contributor

sgotti commented Jun 8, 2015

@sgotti good summary. Are you volunteering to take this on? ;-)

@jonboulle Yeah, I'd like to take a look at it. Currently I'm experimenting with cobra but trying to take a different approach than #896.

I'd like to hear from you all if the above requirements looks good for everyone and if there're some additional one that I forgot to write. Do you have someone to add to the discussion?

The use of subcommands can be misleading due to arguments that can be interpreted as a subcommand instead of a command argument.

Do you mean within a subcommand or just the inconsistency of some sub-commands being multi-level and others not?

Sorry, I wasn't very clear. I meant to say that if we have rkt command ARG and rkt command subcommand ARG it will clash if someone calls rkt command ARG when ARG == subcommand. This is probably a corner case and I'd like to understand how current cli frameworks handles it.

@jonboulle
Copy link
Contributor Author

@robszumski PTAL at #632 (comment) ?

@sgotti the reqs lgtm, I basically agree with your ordering too

@robszumski
Copy link
Contributor

@jonboulle That list seems good to me

@jonboulle
Copy link
Contributor Author

Fixed by Simone's diligent work in #1028

@jonboulle jonboulle modified the milestones: v0.7.0, v1.0.0 Jun 18, 2015
@lucab lucab unassigned sgotti Apr 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants