You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.0 KiB
67 lines
2.0 KiB
3 years ago
|
From 946a6a3547d1f6ca7347bed9d77c750d686ad505 Mon Sep 17 00:00:00 2001
|
||
|
From: Fabio Valentini <decathorpe@gmail.com>
|
||
|
Date: Mon, 22 Nov 2021 20:58:46 +0100
|
||
|
Subject: [PATCH] port to clap 3.0.0-beta.5
|
||
|
|
||
|
---
|
||
|
src/main.rs | 2 +-
|
||
|
src/options.rs | 11 +++++------
|
||
|
2 files changed, 6 insertions(+), 7 deletions(-)
|
||
|
|
||
|
diff --git a/src/main.rs b/src/main.rs
|
||
|
index d45672f..0b86049 100644
|
||
|
--- a/src/main.rs
|
||
|
+++ b/src/main.rs
|
||
|
@@ -1,6 +1,6 @@
|
||
|
#![forbid(unsafe_code)]
|
||
|
use anyhow::Result;
|
||
|
-use clap::Clap;
|
||
|
+use clap::Parser;
|
||
|
use dua::{ByteFormat, TraversalSorting};
|
||
|
use std::{fs, io, io::Write, path::PathBuf, process};
|
||
|
|
||
|
diff --git a/src/options.rs b/src/options.rs
|
||
|
index d8167c5..dce3af6 100644
|
||
|
--- a/src/options.rs
|
||
|
+++ b/src/options.rs
|
||
|
@@ -1,4 +1,4 @@
|
||
|
-use clap::Clap;
|
||
|
+use clap::Parser;
|
||
|
use dua::ByteFormat as LibraryByteFormat;
|
||
|
use std::path::PathBuf;
|
||
|
use std::str::FromStr;
|
||
|
@@ -50,10 +50,9 @@ impl From<ByteFormat> for LibraryByteFormat {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
-#[derive(Debug, Clap)]
|
||
|
+#[derive(Debug, Parser)]
|
||
|
#[clap(name = "dua", about = "A tool to learn about disk usage, fast!", version = clap::crate_version!())]
|
||
|
-#[clap(setting = clap::AppSettings::ColoredHelp)]
|
||
|
-#[clap(setting = clap::AppSettings::GlobalVersion)]
|
||
|
+#[clap(setting = clap::AppSettings::PropagateVersion)]
|
||
|
#[clap(override_usage = "dua [FLAGS] [OPTIONS] [SUBCOMMAND] [input]...")]
|
||
|
pub struct Args {
|
||
|
#[clap(subcommand)]
|
||
|
@@ -85,7 +84,7 @@ pub struct Args {
|
||
|
/// GiB - only gibibytes
|
||
|
/// MB - only megabytes
|
||
|
/// MiB - only mebibytes
|
||
|
- #[clap(short = 'f', long, case_insensitive = true, possible_values(&ByteFormat::VARIANTS))]
|
||
|
+ #[clap(short = 'f', long, case_insensitive = true, possible_values(ByteFormat::VARIANTS))]
|
||
|
pub format: Option<ByteFormat>,
|
||
|
|
||
|
/// Display apparent size instead of disk usage.
|
||
|
@@ -105,7 +104,7 @@ pub struct Args {
|
||
|
pub input: Vec<PathBuf>,
|
||
|
}
|
||
|
|
||
|
-#[derive(Debug, Clap)]
|
||
|
+#[derive(Debug, Parser)]
|
||
|
pub enum Command {
|
||
|
/// Launch the terminal user interface
|
||
|
#[cfg(any(feature = "tui-unix", feature = "tui-crossplatform"))]
|
||
|
--
|
||
|
2.33.1
|
||
|
|