These are chat archives for kbknapp/clap-rs

4th
Sep 2017
lakinwecker
@lakinwecker
Sep 04 2017 17:42
New to clap, tried using the format from the examples and it complains of: error[E0599]: no method named value_of found for type clap::App<'_, '_> in the current scope
Using version 2.26.0
Kevin K.
@kbknapp
Sep 04 2017 18:47
You'll have to first call one of the App::get_matches methods which returns an ArgMatches struct which contains the value_of methods
lakinwecker
@lakinwecker
Sep 04 2017 18:48
ah. Thanks
I missed that this was the last call in the example. Thanks!
Kevin K.
@kbknapp
Sep 04 2017 18:48
No problem! :)
lakinwecker
@lakinwecker
Sep 04 2017 18:50
Yup, works great. That should have been obvious.
:facepalm:
Kevin K.
@kbknapp
Sep 04 2017 18:51
No worries, happens to me all the time!
lakinwecker
@lakinwecker
Sep 04 2017 18:52
I'm using clap in an example program for a small lib I'm building. When I include it as a dev dependency building that example in release mode takes forever. Is that normal?
Kevin K.
@kbknapp
Sep 04 2017 18:53
Hardware depending, but clap normally shouldn't take very long to build even in release mode
lakinwecker
@lakinwecker
Sep 04 2017 18:54
Finished release [optimized + debuginfo] target(s) in 136.13 secs                                                                                                                                                                     
Finished dev [unoptimized + debuginfo] target(s) in 1.49 secs
I guess that's not forever. Just seems really long for such a small sample program. I can live with it though
Maybe it's because I have debug symbols on. I'll try without
Kevin K.
@kbknapp
Sep 04 2017 18:55
I'd be curious to know which crate is actually taking that time
lakinwecker
@lakinwecker
Sep 04 2017 18:55
Is there an easy way for me to produce that?
Kevin K.
@kbknapp
Sep 04 2017 18:55
No, debug symbols shouldn't really add much time at all
cargo build --example count --release
Kevin K.
@kbknapp
Sep 04 2017 18:57
Using the -Ztime-passes on a nightly compiler may give you the info, or you can build with RUST_THREADS=1 and just watch for whichever dep takes the longest
lakinwecker
@lakinwecker
Sep 04 2017 18:57
Finished release [optimized] target(s) in 112.45 secs
That's without symbols.
Kevin K.
@kbknapp
Sep 04 2017 18:58
Also note, an intial build will take longer than additional builds by a significant margine
lakinwecker
@lakinwecker
Sep 04 2017 18:58
Using RUST_THREADS=1 clap is the longest, but only by a few seconds. (3-4s) but then the final build for the program sits for 100s or so
Yeah, these builds are after a cargo clean if that's expected then I'll just live with it
Kevin K.
@kbknapp
Sep 04 2017 19:00
Interesting. Yeah clap should only take 10-20 seconds to build including deps
lakinwecker
@lakinwecker
Sep 04 2017 19:00
➜ RUST_THREADS=1 cargo build --example count --release Compiling ansi_term v0.9.0 Compiling unicode-width v0.1.4 Compiling vec_map v0.8.0 Compiling bitflags v0.9.1 Compiling unicode-segmentation v1.2.0 Compiling strsim v0.6.0 Compiling lazy_static v0.2.8 Compiling libc v0.2.30 Compiling atty v0.2.2 Compiling term_size v0.3.0 Compiling memchr v1.0.1 Compiling memmap v0.5.2 Compiling textwrap v0.7.0 Compiling nom v3.2.0 Compiling clap v2.26.0 Compiling pgn-lexer v0.1.0 (file:///home/lakin/Personal-Repos/pgn-lexer) Finished release [optimized] target(s) in 114.22 secs
Kevin K.
@kbknapp
Sep 04 2017 19:00
You can try something like cargo-graph and see a list of deps
Maybe there's a new dep deep in the graph that takes a while?
lakinwecker
@lakinwecker
Sep 04 2017 19:01
That paste didn't work out, but it sits building nom for 2-3s, clap for 4-5s and then on the pgn-lexer line for 100s. I'll try cargo-graph.
No need for me to take up any more of your time. Thanks for building awesome software for rust.
Kevin K.
@kbknapp
Sep 04 2017 19:01
nom might be culprit as that looks new
lakinwecker
@lakinwecker
Sep 04 2017 19:01
I really appreciate it
The test case I was doing early, was in between the time I asked my initial question and you answered it, I removed clap from the example, but left it in the dependencies. It had a long build time.
Kevin K.
@kbknapp
Sep 04 2017 19:02
Aww shucks 😁 my pleasure! I'll try to take a look at it later today
lakinwecker
@lakinwecker
Sep 04 2017 19:02
In that case, when I removed clap from the dependencies it built immediately
Nom was part of the dependencies the entire time. That was my quick experimental test that caused me to suspect clap at first. But unsure. I'll try cargo-graph in a bit
Kevin K.
@kbknapp
Sep 04 2017 19:03
Sounds good! If you find a particular crate causing it I'd like to know, as if its a non-essential crate I can add it to a non-default feature
lakinwecker
@lakinwecker
Sep 04 2017 19:04
will do
Kevin K.
@kbknapp
Sep 04 2017 19:04
So improve compile times in the common case
Thanks!
lakinwecker
@lakinwecker
Sep 04 2017 21:58
I don't see how cargo graph will help that much
At least, I haven't figured out how to get it to show the dev dependencies
Kevin K.
@kbknapp
Sep 04 2017 22:45
Mainly I was curious if a new dep had been added deeply in the graph. There should be an option to include dev dependencies, but since I'm not at a computer I can't remember exactly
Now for it to work you will have had to start a build that includes dev depends so that your `cargo
Cargo.lock includes them (which is what cargo-graph reads
lakinwecker
@lakinwecker
Sep 04 2017 22:46
hrmm.
Yeah, it's only showing the direct dependencies
cargo graph --help isn't listing a way to force it to show the dev dependencies. Cargo.lock has the dev dependencies listed in it
Kevin K.
@kbknapp
Sep 04 2017 22:48
Could be a bug, but it's hard to say right now
lakinwecker
@lakinwecker
Sep 04 2017 22:48
yeah, no worries. If you're not a a computer I won't bug you.
Kevin K.
@kbknapp
Sep 04 2017 22:48
If you could post a bug report to that repo with some examples that'd help
No worries! I'll actually be out until tomorrow some time, I'll try to check it then
lakinwecker
@lakinwecker
Sep 04 2017 22:48
a bug report against cargo-graph?
Kevin K.
@kbknapp
Sep 04 2017 22:50
Yeah, if it's ignoring dev deps even if you've specified some do the options like --dev-dependencies=true (can't remember if that is exactly the command) it's a bug
lakinwecker
@lakinwecker
Sep 04 2017 23:02
the bug is that I can't find that option in the help
I'll try that specifically
--dev-deps=true
No, it's documented, I just can't read
lakinwecker
@lakinwecker
Sep 04 2017 23:08
Graph generated.