easyoptions icon indicating copy to clipboard operation
easyoptions copied to clipboard

DEAD PROJECT

Open fatso83 opened this issue 5 years ago • 1 comments

It would be nice if someone tried to claim a new ruby gem for this, as most forks just float around on GitHub with no chance of being merged. Renato hasn't had a presence on GitHub for the last three years :( https://github.com/renatosilva?tab=overview&from=2016-05-01&to=2017-05-31

fatso83 avatar Oct 11 '19 12:10 fatso83

On Fri, 11 Oct 2019, Carl-Erik Kopseng wrote:

It would be nice if someone tried to claim a new ruby gem for this, as most forks just float around on GitHub with no chance of being merged.

As I see it, there are 3 major issues.

  1. I don't know about the Ruby side, but the Shell side needs quite a bit of work. Although it's nice to have a common declarative block for both languages, requiring Ruby in order to run a shell script makes this a non-starter for wider adoption, so it's unlikely to receive much support.

  2. The approach of trying to find a valid path to the file containing the script itself and then re-reading it is both fraught (it can fail in unexpected ways, based on how the user invokes the script), and means you can't have multiple sets of options in different contexts in one file. Both Ruby and Shell support "here docs", which is promising approach.

  3. Inferring logic based on English results in stilted English, and lacks expressiveness. This should be reversed: the help text should be extracted from a programmatic data structure. This approach would also allow other structures to be generated, such as a Bash "tab completion" command.

I would like to see a standardized way to declare options that's usable in multiple languages, and while I'd like it to be simple to use for the simple cases, I'd want it extensible enough to cope to complex cases.

I would hope a future version could add the abilities to:

  • restrict the acceptable values for an option, including
    • must match a given regex
    • must be an integer between low & high limits
    • must be an existing file (or directory)
    • must be a nonexistent file in an existing directory
    • must be a valid date and/or time, convertible to a Unix time-stamp
    • when passed to a client callback, it must return true
  • specify groups of options as mutually exclusive
  • Have smart naming for "invertible" options; --do-foo adds --dont-foo, --can-bar adds --cant-bar, --with-baz adds --without-baz, and otherwise --whatever adds --no-whatever.
  • vary the number of parameters consumed by an option, not just fixed as 0 or 1
  • split the declaration of options from the act of parsing the command line, so that multiple modules can declare flags that they're interested in (not just main), and multiple command arrays can be parsed with the same options. In particular, to make it usable inside a shell function to parse its options, without the overhead of rebuilding the control structure every time the function is called.

kurahaupo avatar Oct 27 '19 07:10 kurahaupo