-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
Parse complex optargs with sequential types #682
Conversation
5fffc8a
to
41824a3
Compare
boot/core/build.boot
Outdated
(boot.util/info "Testing against version %s\n" (App/config "BOOT_VERSION")) | ||
(comp (runtests) | ||
(deftask integration-test [] | ||
(set-env! :source-paths #{"integration-test"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am always tripping on this one. It is not working, will fix it.
dd0b064
to
1600b5f
Compare
Don't understand why the tests are failing in this very weird way: FAIL in boot.cli-test/cli-tests (cli_test.clj:43)
parse-cli
[fix #578] split arguments with two different separators using vector optarg.
expected: {:parent [prj "1.3" "parent"]}
actual: {:parent [ prj "1.3" "parent"]}
diff: - {:parent [prj]}
+ {:parent [ prj]} What is the space there I can't understand, but I will 👍 |
32b5af4
to
1bf6038
Compare
1bf6038
to
63fc8b1
Compare
This patch enables to parse options using complex optargs like SYM:VER=PATH with types that are not nested but straight up sequential, like [sym str str].
63fc8b1
to
750f1e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I haven't needed something but given that tests are added and this doesn't break existing behavior we're probably fine to add it.
Two minor suggestions / questions.
Also there is some documentation which seems to suggest that this existed before? Or maybe I'm confusing things? At the end here: https://github.com/boot-clj/boot/wiki/Task-Options-DSL#complex-options
Please make sure this is up to date & add an example if it feels appropriate.
CHANGES.md
Outdated
@@ -34,6 +34,7 @@ and `technomancy` for the above explanation. | |||
- Bump [pomegranate](https://github.com/cemerick/pomegranate) and [dynapath](https://github.com/tobias/dynapath) to `1.0.0`. [#612][612] | |||
- Digest `java.io.File` instead `String` path of jar at sift-action `:add-jar` method [#678][678] | |||
- Add warning about improper use of repl :eval option [#666][666] | |||
- Parse complex optargs with sequential types [682][682] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add an example here what was previously possible and whats possible now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I will add one
But the typical usage is: | ||
|
||
((parse-fn SYM:VER=PATH) \"prj:1.3=parent\") => [prj 1.3 parent]" | ||
[optarg] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this also work?
((parse-fn SYM:VER=PATH=) \"prj:1.3=parent=more-stuff\")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably no because the parsing needs A-Z
interleaved by symbols at the moment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err, I made a typo I meant this:
((parse-fn SYM:VER=PATH=MORE) \"prj:1.3=parent=more-stuff\")
Question is if this pattern can repeat indefinitely or if there is some limit to it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it works, I tried it by having a test, one second I am going to push it
750f1e4
to
c84db02
Compare
This is actually just a small test plus some test refactoring that will introduce the concept of integration vs unit test (now done with boot-alt-test).
868f8dd
to
8b5ff32
Compare
8b5ff32
to
e98a79d
Compare
@@ -34,6 +34,7 @@ and `technomancy` for the above explanation. | |||
- Bump [pomegranate](https://github.com/cemerick/pomegranate) and [dynapath](https://github.com/tobias/dynapath) to `1.0.0`. [#612][612] | |||
- Digest `java.io.File` instead `String` path of jar at sift-action `:add-jar` method [#678][678] | |||
- Add warning about improper use of repl :eval option [#666][666] | |||
- Parse complex optargs with sequential types, see [wiki section][sequential-optargs] [#682][682] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's perfect 👌
I need to revisit my workflow for merging PRs bit annoyed that this is picked up as closed instead of merged now. 😏 |
This patch enables to parse options using complex optargs like
SYM:VER=PATH
with types that are not nested but straight up sequential, like
[sym str str]
.