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

Print crate dependencies #15

Merged
merged 3 commits into from
Jul 29, 2018
Merged

Print crate dependencies #15

merged 3 commits into from
Jul 29, 2018

Conversation

pravic
Copy link
Collaborator

@pravic pravic commented Jul 24, 2018

cc #14

Note that it requires merge and publish of the https://github.com/g-k/g-k-crates-io-client first (and change of Cargo.toml).

This PR introduces a new option named --dependencies that prints the crate's dependencies (of the latest version):

$ cargo show time --dependencies

id: time
name: time
description: Utilities for working with time-related functions in Rust.
...
max_version: 0.1.40
...
dependencies:
libc ^0.2.1
log ^0.4
redox_syscall ^0.1
winapi ^0.3.0
winapi ^0.3.0
rustc-serialize ^0.3

Copy link
Owner

@g-k g-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good. Much cleaner with the map_err, ?, and eprintln. 👍

Left a comment about quieter output if you want to do that, otherwise just need to switch to the published crates client version like you mentioned.

Cargo.toml Outdated

[[bin]]
name = "cargo-show"
path = "src/main.rs"

[dependencies]
docopt = "0.8.0"
g-k-crates-io-client = "0.9.0"
# g-k-crates-io-client = "0.9.0"
g-k-crates-io-client = { git = "https://github.com/pravic/g-k-crates-io-client", branch = "update" }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merged your PR and published 0.16.0: https://crates.io/crates/g-k-crates-io-client/0.16.0 so this can be updated to that version.

// e.g. crate name not found
println_stderr!("Error fetching data for {}: {}", crate_name, e);
// print crate's metadata
println!("{}", meta);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you'd rather have quieter output, I'd be OK with just printing just the id or name or both with the dependents instead of the full metadata.

@g-k
Copy link
Owner

g-k commented Jul 25, 2018

I also need to remember to document how --json and --dependencies works.

@pravic
Copy link
Collaborator Author

pravic commented Jul 25, 2018

I don't know how to combine 2 json responses into one output. May be --dependencies --json will print output from the /crates/$krate/$version/dependencies only?

I mean,
cargo show krate --json will print a response from the /crates/$krate
cargo show krate --dependencies --json will print another response from the /crates/$krate/$version/dependencies.

As for the brief output.. It is better to make it in another PR I think.

@pravic
Copy link
Collaborator Author

pravic commented Jul 25, 2018

Also we need to distinguish dev (build-time) from normal and optional from direct dependencies.

This?

dependencies:
serde_derive ^1.0 (opt)
serde_derive ^1.0 (dev)

@g-k
Copy link
Owner

g-k commented Jul 29, 2018

Thanks! This looks good. I opened issues for deciding what to do about the other stuff.

@g-k g-k merged commit 98c9762 into g-k:master Jul 29, 2018
@pravic pravic deleted the print-deps branch July 29, 2018 09:36
@g-k g-k mentioned this pull request Jul 31, 2018
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.

2 participants