l3nz / cli-matic

Compact, hands-free [sub]command line parsing library for Clojure.
Eclipse Public License 2.0
361 stars 29 forks source link

Allow multiline values for :as in options via customized :summary-fn #96

Closed lread closed 4 years ago

lread commented 4 years ago

The value for :as acts as an option's description. Like the :app and :command :description, :as now optionally supports multiline text via a vector of strings.

Notes: Cli-matic takes advantage of clojure.tools.cli to format options for display in help. Ideally clojure.tools.cli would accept multiline descriptions for options, but it does not.

We take advantage of clojure.tools.cli's :summary-fn to override default handling and support multilines.

This work includes the strengthening of the spec for descriptions. A description must be a non-blank string - or - a collection of strings that includes at least one non-blank string.

I also moved the beef of get-clojure-options under utils to localize interactions with clojure.tools.cli

Fixes #94

lread commented 4 years ago

I think this might be a better approach than #95, but each has its pros and cons.

95

96

These 2 PRs do share some common changes, to see what is different between them here's comparison of 95 vs 95.

I'll let you decide which to merge and which to reject.

lread commented 4 years ago

Hi @l3nz, is there anything more you'd like me to do on this?

An alternative would be to propose a change to https://github.com/clojure/tools.cli itself. I expect the specification of multiline values as vectors would remain in the domain of cli-matic, but clojure.tools.cli could be altered to handle newlines in options.