Skip to content

Commit fca8ea1

Browse files
committed
Updated deps
1 parent b13a69a commit fca8ea1

File tree

5 files changed

+46
-57
lines changed

5 files changed

+46
-57
lines changed

Cargo.lock

+25-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ rust-version = "1.58.1"
1616

1717
[dependencies]
1818
anyhow = "1.0.56"
19-
clap = "3.1.6"
20-
clap_complete = "3.1.1"
19+
clap = "4.0.7"
20+
clap_complete = "4.0.2"
2121
crossterm = "0.25.0"
2222
indicatif = "0.17.1"
2323
reqwest = { version = "0.11.9", default-features = false, features = [
@@ -41,5 +41,5 @@ assert_cmd = "2.0.4"
4141
predicates = "2.1.1"
4242

4343
[build-dependencies]
44-
clap = "3.1.6"
45-
clap_complete = "3.1.1"
44+
clap = "4.0.7"
45+
clap_complete = "4.0.2"

src/cli.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use clap::{AppSettings, Arg, Command};
1+
use clap::{Arg, Command};
22

3-
pub fn build_cli() -> Command<'static> {
3+
pub fn build_cli() -> Command {
44
Command::new(env!("CARGO_PKG_NAME"))
55
.version(env!("CARGO_PKG_VERSION"))
66
.about(env!("CARGO_PKG_DESCRIPTION"))
@@ -120,7 +120,6 @@ pub fn build_cli() -> Command<'static> {
120120
.about("Generate completion scripts for command line usage.")
121121
.disable_version_flag(true)
122122
.hide(true)
123-
.setting(AppSettings::DeriveDisplayOrder)
124123
.arg(Arg::new("bash").short('b').long("bash"))
125124
.arg(Arg::new("zsh").short('z').long("zsh"))
126125
.arg(Arg::new("powershell").short('p').long("powershell")),

src/commands.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use anyhow::Context;
1515
use util::{Client, ClientProduction};
1616

1717
pub fn handle(matches: &clap::ArgMatches, io: &mut dyn Io) -> anyhow::Result<()> {
18-
let mut client = ClientProduction::new(matches.is_present("testmode"))?;
18+
let mut client = ClientProduction::new(matches.contains_id("testmode"))?;
1919

2020
// Authorize the client and raise error if not logged in when required
2121
match matches.subcommand() {
@@ -39,38 +39,38 @@ pub fn handle(matches: &clap::ArgMatches, io: &mut dyn Io) -> anyhow::Result<()>
3939

4040
match matches.subcommand() {
4141
Some(("login", args)) => {
42-
let interactive_mode = !args.is_present("non-interactive");
42+
let interactive_mode = !args.contains_id("non-interactive");
4343
login::login(io, &mut client, interactive_mode)?;
4444
}
4545
Some(("download", args)) => download::download_or_update(
4646
io,
4747
&mut client,
48-
args.value_of("course"),
49-
args.is_present("currentdir"),
48+
args.get_one("course").copied(),
49+
args.contains_id("currentdir"),
5050
)?,
5151
Some(("update", args)) => {
52-
update::update(io, &mut client, args.is_present("currentdir"))?;
52+
update::update(io, &mut client, args.contains_id("currentdir"))?;
5353
}
5454
Some(("organization", args)) => {
55-
let interactive_mode = !args.is_present("non-interactive");
55+
let interactive_mode = !args.contains_id("non-interactive");
5656
organization::organization(io, &mut client, interactive_mode)?
5757
}
5858
Some(("courses", _)) => courses::list_courses(io, &mut client)?,
5959
Some(("submit", args)) => {
60-
submit::submit(io, &mut client, args.value_of("exercise"))?;
60+
submit::submit(io, &mut client, args.get_one("exercise").copied())?;
6161
}
6262
Some(("exercises", args)) => {
63-
if let Some(c) = args.value_of("course") {
63+
if let Some(c) = args.get_one("course").copied() {
6464
exercises::list_exercises(io, &mut client, c)?;
6565
} else {
6666
io.println("argument for course not found", PrintColor::Normal)?;
6767
}
6868
}
6969
Some(("test", args)) => {
70-
test::test(io, args.value_of("exercise"))?;
70+
test::test(io, args.get_one("exercise").copied())?;
7171
}
7272
Some(("paste", args)) => {
73-
paste::paste(io, &mut client, args.value_of("exercise"))?;
73+
paste::paste(io, &mut client, args.get_one("exercise").copied())?;
7474
}
7575
Some(("logout", _)) => logout::logout(io, &mut client)?,
7676
Some(("fetchupdate", _)) => {

src/main.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn main() {
3434
&mut buffer,
3535
&mut stdout,
3636
&mut stdin,
37-
matches.is_present("testmode"),
37+
matches.contains_id("testmode"),
3838
);
3939
if let Err(err) = run(&mut io, &matches) {
4040
let error_string = err
@@ -49,7 +49,7 @@ fn main() {
4949
}
5050

5151
fn run(io: &mut IoProduction, matches: &ArgMatches) -> anyhow::Result<()> {
52-
match matches.occurrences_of("no-update") {
52+
match matches.get_count("no-update") {
5353
0 => {
5454
let os = std::env::consts::OS;
5555
if os == "windows" {
@@ -63,11 +63,11 @@ fn run(io: &mut IoProduction, matches: &ArgMatches) -> anyhow::Result<()> {
6363
}
6464

6565
fn generate_completions(matches: &ArgMatches) {
66-
let shell = if matches.is_present("bash") {
66+
let shell = if matches.contains_id("bash") {
6767
Shell::Bash
68-
} else if matches.is_present("zsh") {
68+
} else if matches.contains_id("zsh") {
6969
Shell::Zsh
70-
} else if matches.is_present("powershell") {
70+
} else if matches.contains_id("powershell") {
7171
Shell::PowerShell
7272
} else {
7373
return;

0 commit comments

Comments
 (0)