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

Fix author and version metadata in subcommands #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ fn main() {
// #[cfg(all(unix, any(target_os = "linux", target_os = "macos")))]
#[cfg(unix)]
fn real_main() -> Result<(), ProfError> {
let version = clap::crate_version!();
let authors = clap::crate_authors!(", ");

// create binary path argument
let binary_arg = Arg::with_name("binary")
.long("bin")
Expand Down Expand Up @@ -80,8 +83,8 @@ fn real_main() -> Result<(), ProfError> {
// create callgrind subcommand
let callgrind = SubCommand::with_name("callgrind")
.about("gets callgrind features")
.version("1.0")
.author("Suchin Gururangan")
.version(version)
.author(authors)
.arg(release.clone())
.arg(binary_arg.clone())
.arg(binargs_arg.clone())
Expand All @@ -91,8 +94,8 @@ fn real_main() -> Result<(), ProfError> {
// create cachegrind subcommand
let cachegrind = SubCommand::with_name("cachegrind")
.about("gets cachegrind features")
.version("1.0")
.author("Suchin Gururangan")
.version(version)
.author(authors)
.arg(release)
.arg(binary_arg)
.arg(binargs_arg.clone())
Expand All @@ -103,17 +106,17 @@ fn real_main() -> Result<(), ProfError> {
// create profiler subcommand
let profiler = SubCommand::with_name("profiler")
.about("gets callgrind features")
.version("1.0")
.author("Suchin Gururangan")
.version(version)
.author(authors)
.subcommand(callgrind)
.subcommand(cachegrind);

// create profiler application
let matches = App::new("cargo-profiler")
.bin_name("cargo")
.settings(&[AppSettings::SubcommandRequired])
.version("1.0")
.author("Suchin Gururangan")
.version(version)
.author(authors)
.about("Profile your binaries")
.subcommand(profiler)
.get_matches();
Expand Down