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

Update to clap 3.1 #52

Merged
merged 2 commits into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ readme = "README.md"

[dependencies]
atty = "0.2"
clap = { version = "3.0", features = ["derive", "wrap_help"] }
clap = { version = "3.1", features = ["derive", "wrap_help"] }
rustc-demangle = "0.1"
tempdir = "0.3"

Expand Down
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
)]

use atty::Stream::Stderr;
use clap::{AppSettings, IntoApp, Parser};
use clap::{AppSettings, CommandFactory, Parser};
use rustc_demangle::demangle;
use std::collections::HashMap as Map;
use std::env;
Expand Down Expand Up @@ -46,7 +46,7 @@ OPTIONS:
bin_name = "cargo",
author,
version,
setting = AppSettings::DisableHelpSubcommand,
disable_help_subcommand = true
)]
#[allow(dead_code)]
enum Opt {
Expand All @@ -58,8 +58,8 @@ enum Opt {
help_template = TEMPLATE,
override_usage = "cargo llvm-lines [OPTIONS] -- [RUSTC OPTIONS]",
setting = AppSettings::DeriveDisplayOrder,
setting = AppSettings::DisableHelpFlag,
setting = AppSettings::DisableVersionFlag,
disable_help_flag = true,
disable_version_flag = true,
)]
LlvmLines {
/// Set column by which to sort output table.
Expand Down Expand Up @@ -131,7 +131,7 @@ fn main() {
} = Opt::parse();

if help {
let _ = Opt::into_app()
let _ = Opt::command()
.get_subcommands_mut()
.next()
.unwrap()
Expand All @@ -141,7 +141,7 @@ fn main() {

if version {
let mut stdout = io::stdout();
let _ = stdout.write_all(Opt::into_app().render_version().as_bytes());
let _ = stdout.write_all(Opt::command().render_version().as_bytes());
return;
}

Expand Down Expand Up @@ -503,5 +503,5 @@ fn ignore_cargo_err(line: &str) -> bool {

#[test]
fn test_cli() {
Opt::into_app().debug_assert();
Opt::command().debug_assert();
}