libre-man / unix-opts

Unix-style command line options parser
MIT License
107 stars 13 forks source link

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

Open kat-co opened 5 years ago

kat-co commented 5 years ago

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

vindarel commented 5 years ago

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 ?

libre-man commented 4 years ago

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?