juhp / fbrnch

Tool to update fedora packages branches

Home Page:https://hackage.haskell.org/package/fbrnch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

parallel -B -x is broken

QuLogic opened this issue · comments

$ fbrnch parallel -B -h
Usage: fbrnch parallel [-n|--dry-run] [-t|--target TARGET] ([-b|--branch BRANCH]
                       | [-B|--all-branches] | [-x|--exclude-branch BRANCH])

...
  -x,--exclude-branch BRANCH
                           branch
...

but

$ fbrnch parallel -B -x master
Invalid option `-x'

Usage: fbrnch [--version] COMMAND
  This tool helps with updating and building package branches

or

$ fbrnch parallel -B --exclude-branch master
Invalid option `--exclude-branch'

Usage: fbrnch [--version] COMMAND
  This tool helps with updating and building package branches

This works though:

$ fbrnch parallel -x master
Building parallel 3 branches:
f33 f32 f31

It's not noted that -B and -x are exclusive, but the error message should probably be different.

-B, -x, and -b are currently exclusive.

Not sure if I can improve the error message easily - let me see/think on that:
the option handling is provided by the optparse-applicative library which while not perfect is quite nice.

fbrnch parallel -B -h

I agree this could be confusing but basically this is equivalent to fbrnch parallel --help.
Help doesn't take any given options into account.

I agree this could be confusing but basically this is equivalent to fbrnch parallel --help.
Help doesn't take any given options into account.

Oh, sorry, I didn't mean to be calling that out specifically, just that -x didn't mention exclusivity.

To clarify better (also I feel optparse-applicative could lay out options better)

... ([-b|--branch BRANCH]
| [-B|--all-branches] | [-x|--exclude-branch BRANCH])

is meant to imply that -b, -B, and -x are all exclusive.

I agree the error message could be clearer.
I may take a look at an alternative option processing library at some point - it might be a weakness of the Applicative approach.

(Also just a early historical note: that originally fbrnch defaulted to -B for all commands essentially, but I decided to make it an option to not be too surprising/big a change compared to fedpkg.)