port to clap 3.0.0-beta.5

This commit is contained in:
Fabio Valentini 2021-11-22 21:19:01 +01:00
parent 0a4313d831
commit c1d21151ec
No known key found for this signature in database
GPG Key ID: 5AC5F572E5D410AF
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,66 @@
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

View File

@ -6,7 +6,7 @@
Name: rust-%{crate}
Version: 2.11.1
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Tool to conveniently learn about the disk usage of directories
# Upstream license specification: MIT
@ -18,6 +18,8 @@ Source: %{crates_source}
# * bump tui from 0.14 to 0.15
# * bump tui-react from 0.14 to 0.15
Patch0: dua-cli-fix-metadata.diff
# * port to clap 3.0.0-beta.5
Patch1: 0001-port-to-clap-3.0.0-beta.5.patch
ExclusiveArch: %{rust_arches}
%if %{__cargo_skip_build}
@ -191,6 +193,9 @@ which use "unicode-segmentation" feature of "%{crate}" crate.
%endif
%changelog
* Mon Nov 22 2021 Fabio Valentini <decathorpe@gmail.com> - 2.11.1-5
- Port to clap 3.0.0-beta.5.
* Mon Aug 23 2021 Fabio Valentini <decathorpe@gmail.com> - 2.11.1-4
- Bump tui, tui-react, and crosstermion versions.