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

No top level :flags config leads to sub-command population errors #5

Open
bnert opened this issue Dec 21, 2023 · 0 comments
Open

No top level :flags config leads to sub-command population errors #5

bnert opened this issue Dec 21, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@bnert
Copy link
Collaborator

bnert commented Dec 21, 2023

Example:

(ns example.core
  (:require
    [packard.core :as commander]))

(def cmds
  {:usage "thing"
   :commands
   {:sub-cmd {:usage "thing sub-cmd [opts]"
              :flags {:verbose? ["v" "verbose" {:as :bool}]}}})

(defn -main [& args]
  (commander/exec cmds args))

When the above is invoked like $ clj -M -m example.core sub-cmd help, the output will not fill in flags.

However, if the above is modified to:

(ns example.core
  (:require
    [packard.core :as commander]))

(def cmds
  {:usage "thing"
   :flags {}
   :commands
   {:sub-cmd {:usage "thing sub-cmd [opts]"
              :flags {:verbose? ["v" "verbose" {:as :bool}]}}})

(defn -main [& args]
  (commander/exec cmds args))

It works as expected.

@bnert bnert added the bug Something isn't working label Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant