Skip to content

Update clap to 3.1 #141

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
76 changes: 27 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ name = "snm"

[dependencies]
anyhow = "1.0.52"
clap = "3.0.0-beta.5"
clap_generate = "3.0.0-beta.5"
clap = { version = "3.1.9", features = ["cargo", "derive", "env"] }
clap_complete = "3.1.1"
console = "0.15.0"
dirs-next = "2.0.0"
indicatif = "0.16.2"
Expand Down
12 changes: 6 additions & 6 deletions src/commands/completions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::cli::{Cli, Config};
use clap::{crate_name, IntoApp, Parser};
use clap_generate::{generate, generators};
use clap_complete::{generate, shells};
use snm_core::{shell::ShellKind, SnmRes};

#[derive(Debug, Parser)]
Expand All @@ -13,21 +13,21 @@ pub struct Completions {
impl super::Command for Completions {
fn init(self, _: Config) -> SnmRes<()> {
let name = crate_name!();
let mut app = Cli::into_app();
let mut app = Cli::command();
let mut stdout = std::io::stdout();

match &self.shell {
ShellKind::Bash => {
generate(generators::Bash, &mut app, name, &mut stdout);
generate(shells::Bash, &mut app, name, &mut stdout);
}
ShellKind::Zsh => {
generate(generators::Zsh, &mut app, name, &mut stdout);
generate(shells::Zsh, &mut app, name, &mut stdout);
}
ShellKind::Fish => {
generate(generators::Fish, &mut app, name, &mut stdout);
generate(shells::Fish, &mut app, name, &mut stdout);
}
ShellKind::Pwsh => {
generate(generators::PowerShell, &mut app, name, &mut stdout);
generate(shells::PowerShell, &mut app, name, &mut stdout);
}
};

Expand Down