Usage message [options] could be better placed

Bug #1585909 reported by Mark Shuttleworth
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
High
Sergio Schvezov

Bug Description

I see this at the moment:

mark@mark-XPS-15-9550:~$ snapcraft reserve
Usage:
  snapcraft [options] [--enable-geoip --no-parallel-build]
  snapcraft [options] init
  snapcraft [options] pull [<part> ...] [--enable-geoip]
  snapcraft [options] build [<part> ...] [--no-parallel-build]
  snapcraft [options] stage [<part> ...]
  snapcraft [options] strip [<part> ...]
  snapcraft [options] clean [<part> ...] [--step <step>]
  snapcraft [options] snap [<directory> --output <snap-file>]
  snapcraft [options] cleanbuild
  snapcraft [options] login
  snapcraft [options] logout
  snapcraft [options] upload <snap-file>
  snapcraft [options] list-plugins
  snapcraft [options] help (topics | <plugin> | <topic>) [--devel]
  snapcraft (-h | --help)
  snapcraft --version

The successive [options] sections make this message much less readable. Can we drop the [options] piece up front and put explicit lists of options behind the commands, or alternatively, just document each command options in the specific help for the specific command?

In the end I would like to see:

mark@mark-XPS-15-9550:~$ snapcraft reserve
Usage:
  snapcraft [--enable-geoip --no-parallel-build]
  snapcraft init
  snapcraft pull [<part> ...] [--enable-geoip]
  snapcraft build [<part> ...] [--no-parallel-build]
  snapcraft stage [<part> ...]
  snapcraft strip [<part> ...]
  snapcraft clean [<part> ...] [--step <step>]
  snapcraft snap [<directory> --output <snap-file>]
  snapcraft cleanbuild
  snapcraft login
  snapcraft logout
  snapcraft upload <snap-file>
  snapcraft list-plugins
  snapcraft help (topics | <plugin> | <topic>) [--devel]
  snapcraft (-h | --help)
  snapcraft --version

Tags: snap-docs
Changed in snapcraft:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Sergio Schvezov (sergiusens)
milestone: none → 2.10
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

We are using this http://docopt.org/ which forces a couple of conventions on us. If this is required, we would need to migrate away from docopt

Changed in snapcraft:
milestone: 2.10 → none
Revision history for this message
Mark Shuttleworth (sabdfl) wrote : Re: [Bug 1585909] Re: Usage message [options] could be better placed

Nice site. I note that none of their examples say:

  program [OPTION] command [command-OPTIONS]

In other words, we're using their stuff in a way that is much uglier
than the way they advertise their stuff :)

What I object to is the huge [OPTION] and the ugly [command-OPTIONS].
What I would prefer is:

  program [command] [options]

So:

  Usage:
    snap [ -h | --help ]
    snap install [-f] [-t]

  Try 'snap help' or 'man snap-install'.

I'm sure this is achievable with docopt since their examples look more
like that.

Mark

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

I've reported before this and a few suggestions for --help here:

https://bugs.launchpad.net/bugs/1582506

Revision history for this message
Leo Arias (elopio) wrote :

The sad thing about those [options] is that in most of the cases it's just -h.
Maybe we can talk to the docopt guys and get tips or a patch upstream.

Revision history for this message
Mark Shuttleworth (sabdfl) wrote :

I really, really bet you don't need to patch it.

Revision history for this message
Leo Arias (elopio) wrote :

I'm going to raise the priority of this, because we keep adding commands to snapcraft and now the help is pretty ugly.

tags: added: snap-docs
Changed in snapcraft:
importance: Medium → High
Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Changed in snapcraft:
milestone: none → 2.30
status: Triaged → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.