Skip to content

Consider better default error message when option value missing #137

@lread

Description

@lread

Currently

Babashka cli generates the following error when an option value is missing:

(require '[babashka.cli :as cli])

(cli/parse-opts ["--foo"] {:spec {:foo {:coerce :string}}})
;; => Execution error (ExceptionInfo) at babashka.cli/parse-opts$fn (cli.cljc:331).
;;    Coerce failure: cannot transform (implicit) true to string

Perhaps we can do better?

On other projects, I've detected this error and presented it to the user as:

Option specified without value

I think this is more user-friendly.

Next

If you think this is viable and worth pursuing, I am happy to flesh out the idea with changes/tests, and if all is good, a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions