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

imp(macros): add subcommand expr macro #1523

Merged
merged 2 commits into from
Oct 31, 2019
Merged

imp(macros): add subcommand expr macro #1523

merged 2 commits into from
Oct 31, 2019

Conversation

shua
Copy link

@shua shua commented Jul 21, 2019

Was using some hacks to use both the macros and subcommands with hyphens in their names (example based on a cli tool I use a lot: https://concourse-ci.org/setting-pipelines.html)

clap_app!(fly =>
  (subcommand: clap_app! { @app (SubCommand::with_name("get-pipeline"))
    (alias: "gp")
    ...
  })
  (subcommand: SubCommand::with_name("list-pipelines").alias("lp"))
)

Added some parsing rules to allow alternative parsing of expr subcommand names similar to that used for (@arg ("non-ident-name"): --("non-ident-flag"):

clap_app!(fly =>
  (@subcommand ("get-pipeline") =>
    (alias: "gp")
    ...
  )
  (@subcommand ("list-pipelines") => (alias: "lp"))
)

and

clap_app!(@subcommand ("set-pipeline") => (alias: "sp"))

@kbknapp
Copy link
Member

kbknapp commented Oct 30, 2019

Could you rebase onto the latest master (which is now at v3-beta). Thanks!

@shua
Copy link
Author

shua commented Oct 30, 2019

@kbknapp dunzo, waiting to see if I have received the appveyor+travis blessing.

@kbknapp
Copy link
Member

kbknapp commented Oct 30, 2019

@shua Sorry for the headache...there was some confusion due to my absence over the past few months...

v3-master "just now" became master in prep for a beta release. This PR was autoclosed when the v3-master branch went away. This will need one final rebase onto master 😟 Again, apologies

@kbknapp kbknapp reopened this Oct 30, 2019
@shua
Copy link
Author

shua commented Oct 30, 2019

as a heads up, travis checks are failing for rust v1.33.0 with

error[E0658]: use of unstable library feature 'iter_copied' (see issue #57127)
   --> /home/travis/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/toml-0.5.4/src/de.rs:435:30
    |
435 |                             .copied()
    |                              ^^^^^^
error[E0658]: use of unstable library feature 'iter_copied' (see issue #57127)
   --> /home/travis/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/toml-0.5.4/src/de.rs:575:22
    |
575 |                     .copied()
    |                      ^^^^^^
error: aborting due to 2 previous errors

(eg https://travis-ci.org/clap-rs/clap/jobs/604794320#L538 or https://travis-ci.org/clap-rs/clap/jobs/604736365#L535 )
and mine is no different

Success and ✔️ tests pass for other versions tested though (beta/nightly/stable)

@shua
Copy link
Author

shua commented Oct 30, 2019

@kbknapp ^ I suspect master would not pass travis-ci checks right now due to some transient toml dependency using an unstable feature.

@CreepySkeleton
Copy link
Contributor

@shua Perhaps you can restrict toml version on your end

@kbknapp
Copy link
Member

kbknapp commented Oct 30, 2019

I think we're going to just up the minimum supported Rust to 1.36 which should take care of it. See #1590 which should unblock this PR.

@kbknapp kbknapp merged commit 269a5d2 into clap-rs:master Oct 31, 2019
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.

3 participants