#2527 closed enhancement (fixed)
xpra help: present less options when subcommand is wrong
Reported by: | stdedos | Owned by: | Antoine Martin |
---|---|---|---|
Priority: | minor | Milestone: | 4.0 |
Component: | core | Version: | 3.0.x |
Keywords: | Cc: |
Description
I usually don't remember all the xpra sub-commands. Apart from opening http://xpra.org/manual, or xpra --help | head
, I cannot "easily enough" see the options.
Plain xpra --help
is 597 lines, too big to navigate.
xpra help
gives:
$ xpra help xpra for python 2.7 is not installed retrying with python3 xpra initialization error: invalid mode 'help' $ xpra wrong xpra for python 2.7 is not installed retrying with python3 xpra initialization error: invalid mode 'wrong'
Proposal: make xpra help
or xpra wrong-command
to present:
$ xpra update Usage: xpra start [DISPLAY] xpra start-desktop [DISPLAY] xpra upgrade [DISPLAY] xpra attach [DISPLAY] xpra detach [DISPLAY] xpra screenshot filename [DISPLAY] xpra info [DISPLAY] xpra control DISPLAY command [arg1] [arg2].. xpra print DISPLAY filename xpra version [DISPLAY] xpra showconfig xpra list xpra sessions xpra launcher xpra stop [DISPLAY] xpra exit [DISPLAY] xpra list-mdns xpra mdns-gui xpra shadow [DISPLAY] See more options with `xpra --help`
For bonus points:
- Add a "did you mean" feature?
- Group similar-argument commands together, if that is not the case at this time.
Change History (7)
comment:1 Changed 13 months ago by
Status: | new → assigned |
---|
comment:2 Changed 13 months ago by
I am only proposing it because I think it used to be like that (a year ago? a year and a half?). I don't know if you switched argparse systems, which then made it be like that and "cannot be done".
Feel free to ignore this if some of the above are not true.
comment:3 Changed 13 months ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:4 Changed 13 months ago by
Fixed in r24825:
Xpra-Python3-x86_64_4.0-r24825\xpra_cmd" sh invalid subcommand 'sh' Usage: xpra shadow [DISPLAY] xpra (This xpra installation does not support starting local servers.) xpra attach [DISPLAY] xpra detach [DISPLAY] xpra info [DISPLAY] xpra version [DISPLAY] xpra stop [DISPLAY] xpra exit [DISPLAY] xpra screenshot filename [DISPLAY] xpra control DISPLAY command [arg1] [arg2].. xpra print DISPLAY filename xpra showconfig xpra list xpra sessions xpra launcher xpra list-mdns xpra mdns-gui xpra see 'man xpra' or 'xpra --help' for more details
Three nitpicks:
- First capital in
invalid
,see
- Empty
xpra
(except if you want to emphasize that plain xpra is a valid command i.e. opens the GUI) xpra (This xpra installation
I am not sure why would you write it like that:
trunk/src/xpra/scripts/parsing.py:209
def get_usage(): command_options = [] if supports_server: command_options = ["start [DISPLAY]", "start-desktop [DISPLAY]", "upgrade [DISPLAY]", ] + command_options if supports_shadow: command_options.append("shadow [DISPLAY]") if not supports_server: command_options.append("(This xpra installation does not support starting local servers.)")
and not e.g.
def get_usage(): command_options = [] if not supports_server: command_options.append("(This xpra installation does not support starting local servers.)") else: # supports_server command_options = ["start [DISPLAY]", "start-desktop [DISPLAY]", "upgrade [DISPLAY]", ] + command_options if supports_shadow: command_options.append("shadow [DISPLAY]")
I also don't see what is the usage of ] + command_options
.
comment:5 Changed 13 months ago by
First capital in invalid, see
Empty xpra (except if you want to emphasize that plain xpra is a valid command i.e. opens the GUI)
I do.
I am not sure why would you write it like that:
Because this code evolved from somewhere else and I was trying to minimize the changes, see r24807.
r24841 addresses that, and more.
comment:7 Changed 12 months ago by
I guess this is not going in v3?
No, this is not a bug fix.
This would be suitable for milestone/3.1 however.
Not sure how easy it is to hook into the command line parsing code. We'll see.