unix-opts icon indicating copy to clipboard operation
unix-opts copied to clipboard

Would it make sense to default `arg-parser` to `#'identity`?

Open kat-co opened this issue 5 years ago • 2 comments

This seems like the expected behavior in most flag libraries, and also the most common use-case.

kat-co avatar Oct 28 '19 19:10 kat-co

mmh the default behavior is an option that doesn't take an argument, such as

    (:name :version
           :long "version"
           :description "Print version and exit.")

we add :arg-parser only when we expect one. So we need to give a parser name. I don't see, with this semantic, how we can inform :arg-parser to default to identity. Maybe :parse-option t, and :arg-parser would come as a complement ?

vindarel avatar Nov 06 '19 00:11 vindarel

I think it is better to be a bit more explicit about this, also as they mean quite different things. I don't really like the idea of allowing t as an alias for #'identity, it isn't that much shorter and you probably and you will probably forget what the t stands for every time you encounter it. What about warning when a option has a meta-var set but not a arg-parser?

libre-man avatar May 23 '20 12:05 libre-man