Skip to content
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

-h for help not working #31

Closed
networkjanitor opened this issue Nov 24, 2018 · 3 comments
Closed

-h for help not working #31

networkjanitor opened this issue Nov 24, 2018 · 3 comments

Comments

@networkjanitor
Copy link

The main help has the line

Use fdroidcl <command> -h for more info

at the bottom of the output.

However the -h flag is not respected by almost all of the commands:

$ fdroidcl update -h
Downloading https://f-droid.org/repo/index-v1.jar... not modified
$ fdroidcl show -h
show: could not find app with ID '-h'
$ fdroidcl install -h
install: could not find app with ID '-h'
$ fdroidcl uninstall -h
Uninstalling -h
uninstall: could not uninstall -h: not installed
$ fdroidcl download -h
download: could not find app with ID '-h'
$ fdroidcl devices -h
<serialno> - <device>
$ fdroidcl list -h
list: invalid argument
$ fdroidcl defaults -h
defaults: no arguments allowed
$ fdroidcl version -h
version: no arguments allowed

Only search prints out the usage information ... along with every single package it can find, spamming the usage information away with it.

$ fdroidcl search -h
Usage:
  -c string
    	Filter apps by category
  -d int
    	Select apps last updated in the last <n> days; a negative value drops them instead
  -i	Filter installed apps
  -o string
    	Sort order (added, updated)
  -q	Print package names only
  -u	Filter apps with updates

<long list of all available packages>

Version:

$ fdroidcl version
v0.4.0
@mvdan
Copy link
Owner

mvdan commented Dec 4, 2018

Sounds like buggy code. Happy to accept a patch - otherwise I'll look at this at some point soon.

@googl
Copy link

googl commented Dec 17, 2018

https://godoc.org/github.com/pborman/getopt may help. I recall a conversation that this is best practice for presenting options. Should also allow one to not have to put options in a specific order.

@mvdan
Copy link
Owner

mvdan commented Dec 19, 2018

There are dozens of third-party packages out there for flag parsing - there really isn't a best practice. I personally prefer sticking with the standard library whenever possible, and it works fine here. The bug here is in my code, not in a library.

@mvdan mvdan closed this as completed in dea404c Jan 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants