Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed

Conversation

lread
Copy link
Contributor

@lread lread commented Dec 1, 2019

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

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 l3nz#94
@lread
Copy link
Contributor Author

lread commented Dec 1, 2019

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

#95

#96

  • pros
    • is cleaner
    • will handle expanding and aligning any multiline text found in options
    • will suffer no marker collisions
  • cons
    • maybe a bit more complicated
    • touches clojure.tools.cli internals which were formerly a black box for cli-matic.

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
Copy link
Contributor Author

lread commented Dec 15, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Ftr] Support multi-line for option :as
2 participants