agentm / project-m36

Project: M36 Relational Algebra Engine
The Unlicense
876 stars 47 forks source link

Document meaning of tutd (and other executable) flags #229

Closed kozross closed 5 years ago

kozross commented 5 years ago

When I run tutd --help, I see this:

Invalid option `--help'

Usage: tutd (([-d|--database-directory DIRECTORY] [-f|--fsync] |
            [-d|--database-directory DIRECTORY]) [--head ARG]
            [-e|--exec-tutd ARG] [--ghc-pkg-dir GHC_PACKAGE_DIRECTORY]
            [--disable-fscheck] | [-h|--host ARG] [-p|--port ARG]
            [-n|--database DATABASE_NAME] [--head ARG] [-e|--exec-tutd ARG]
            [--disable-fscheck])

Aside from --help being something that should be recognized (being pretty standard CLI fare), this doesn't really explain much. Some of these options are hard to see the meaning of (--head) or could mean several very different things. There's also quite a bit of option duplication - why does this happen?

This doesn't just apply to tutd, but it would be a good starting point for a clarification and fix.

agentm commented 5 years ago

Thanks for the ticket! The --help flag is now working and I fixed the metavars.

We use the optparse-applicative help generator, so we don't have complete control unless we replace it entirely. --database-directory is mutually exclusive with --host (since one is connecting either to a local database xor remote), so optparse-applicative tries to represent that using the "|" (or) bar.

kozross commented 5 years ago

@agentm Thanks for doing that. It seems like a serious deficiency in optparse-applicative if that's the case. I can report it upstream, but it'd help if I knew exactly what to complain about, since I've never used it.

agentm commented 5 years ago

Well, it's basically working as intended. optparse-applicative derives the extended help message from the option parser and some of our options are mutually exclusive. We could easily replace the extended help message in its entirety, if that's the route you would prefer.