mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #2334 from sylvestre/crate_version
use crate_version!() instead of reading the env + rustfmt
This commit is contained in:
@@ -11,15 +11,14 @@ extern crate uucore;
|
||||
|
||||
use platform_info::*;
|
||||
|
||||
use clap::App;
|
||||
use clap::{crate_version, App};
|
||||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static ABOUT: &str = "Display machine architecture";
|
||||
static SUMMARY: &str = "Determine architecture name for current machine.";
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(SUMMARY)
|
||||
.get_matches_from(args);
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::path::{is_separator, PathBuf};
|
||||
use uucore::InvalidEncodingHandling;
|
||||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static SUMMARY: &str = "Print NAME with any leading directory components removed
|
||||
If specified, also remove a trailing SUFFIX";
|
||||
|
||||
@@ -42,7 +41,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
// Argument parsing
|
||||
//
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(SUMMARY)
|
||||
.usage(&usage[..])
|
||||
.arg(
|
||||
|
||||
@@ -16,7 +16,7 @@ extern crate unix_socket;
|
||||
extern crate uucore;
|
||||
|
||||
// last synced with: cat (GNU coreutils) 8.13
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::fs::{metadata, File};
|
||||
use std::io::{self, Read, Write};
|
||||
use thiserror::Error;
|
||||
@@ -38,7 +38,6 @@ use unix_socket::UnixStream;
|
||||
use uucore::InvalidEncodingHandling;
|
||||
|
||||
static NAME: &str = "cat";
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static SYNTAX: &str = "[OPTION]... [FILE]...";
|
||||
static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output
|
||||
With no FILE, or when FILE is -, read standard input.";
|
||||
@@ -173,7 +172,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
|
||||
let matches = App::new(executable!())
|
||||
.name(NAME)
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.usage(SYNTAX)
|
||||
.about(SUMMARY)
|
||||
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true))
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::fs;
|
||||
use std::os::unix::fs::{MetadataExt, PermissionsExt};
|
||||
use std::path::Path;
|
||||
@@ -21,7 +21,6 @@ use uucore::mode;
|
||||
use uucore::InvalidEncodingHandling;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static ABOUT: &str = "Change the mode of each FILE to MODE.
|
||||
With --reference, change the mode of each FILE to that of RFILE.";
|
||||
|
||||
@@ -63,7 +62,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let after_help = get_long_usage();
|
||||
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.usage(&usage[..])
|
||||
.after_help(&after_help[..])
|
||||
|
||||
@@ -14,7 +14,7 @@ use uucore::fs::resolve_relative_path;
|
||||
use uucore::libc::{gid_t, uid_t};
|
||||
use uucore::perms::{wrap_chown, Verbosity};
|
||||
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
|
||||
use walkdir::WalkDir;
|
||||
|
||||
@@ -26,7 +26,6 @@ use std::path::Path;
|
||||
use uucore::InvalidEncodingHandling;
|
||||
|
||||
static ABOUT: &str = "change file owner and group";
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
pub mod options {
|
||||
pub mod verbosity {
|
||||
@@ -75,7 +74,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.usage(&usage[..])
|
||||
.arg(
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::ffi::CString;
|
||||
use std::io::Error;
|
||||
use std::path::Path;
|
||||
@@ -18,7 +18,6 @@ use std::process::Command;
|
||||
use uucore::libc::{self, chroot, setgid, setgroups, setuid};
|
||||
use uucore::{entries, InvalidEncodingHandling};
|
||||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static NAME: &str = "chroot";
|
||||
static ABOUT: &str = "Run COMMAND with root directory set to NEWROOT.";
|
||||
static SYNTAX: &str = "[OPTION]... NEWROOT [COMMAND [ARG]...]";
|
||||
@@ -37,7 +36,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
.accept_any();
|
||||
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.usage(SYNTAX)
|
||||
.arg(Arg::with_name(options::NEWROOT).hidden(true).required(true))
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::fs::File;
|
||||
use std::io::{self, stdin, BufReader, Read};
|
||||
use std::path::Path;
|
||||
@@ -20,7 +20,6 @@ use uucore::InvalidEncodingHandling;
|
||||
const CRC_TABLE_LEN: usize = 256;
|
||||
const CRC_TABLE: [u32; CRC_TABLE_LEN] = generate_crc_table();
|
||||
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
const NAME: &str = "cksum";
|
||||
const SYNTAX: &str = "[OPTIONS] [FILE]...";
|
||||
const SUMMARY: &str = "Print CRC and size for each file";
|
||||
@@ -187,7 +186,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
|
||||
let matches = App::new(executable!())
|
||||
.name(NAME)
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(SUMMARY)
|
||||
.usage(SYNTAX)
|
||||
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true))
|
||||
|
||||
@@ -16,9 +16,8 @@ use std::io::{self, stdin, BufRead, BufReader, Stdin};
|
||||
use std::path::Path;
|
||||
use uucore::InvalidEncodingHandling;
|
||||
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
use clap::{crate_version, App, Arg, ArgMatches};
|
||||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static ABOUT: &str = "compare two sorted files line by line";
|
||||
static LONG_HELP: &str = "";
|
||||
|
||||
@@ -140,7 +139,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
.accept_any();
|
||||
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.usage(&usage[..])
|
||||
.after_help(LONG_HELP)
|
||||
|
||||
+2
-3
@@ -25,7 +25,7 @@ use winapi::um::fileapi::GetFileInformationByHandle;
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
use clap::{crate_version, App, Arg, ArgMatches};
|
||||
use filetime::FileTime;
|
||||
use quick_error::ResultExt;
|
||||
use std::collections::HashSet;
|
||||
@@ -213,7 +213,6 @@ pub struct Options {
|
||||
verbose: bool,
|
||||
}
|
||||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static ABOUT: &str = "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.";
|
||||
static LONG_HELP: &str = "";
|
||||
static EXIT_OK: i32 = 0;
|
||||
@@ -294,7 +293,7 @@ static DEFAULT_ATTRIBUTES: &[Attribute] = &[
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.after_help(&*format!("{}\n{}", LONG_HELP, backup_control::BACKUP_CONTROL_LONG_HELP))
|
||||
.usage(&usage[..])
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
use clap::{crate_version, App, Arg, ArgMatches};
|
||||
use regex::Regex;
|
||||
use std::cmp::Ordering;
|
||||
use std::io::{self, BufReader};
|
||||
@@ -19,7 +19,6 @@ use crate::csplit_error::CsplitError;
|
||||
use crate::split_name::SplitName;
|
||||
use uucore::InvalidEncodingHandling;
|
||||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static SUMMARY: &str = "split a file into sections determined by context lines";
|
||||
static LONG_HELP: &str = "Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output.";
|
||||
|
||||
@@ -713,7 +712,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
.accept_any();
|
||||
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(SUMMARY)
|
||||
.usage(&usage[..])
|
||||
.arg(
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
extern crate uucore;
|
||||
|
||||
use bstr::io::BufReadExt;
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
|
||||
use std::path::Path;
|
||||
@@ -24,7 +24,6 @@ use uucore::InvalidEncodingHandling;
|
||||
mod searcher;
|
||||
|
||||
static NAME: &str = "cut";
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static SYNTAX: &str =
|
||||
"[-d] [-s] [-z] [--output-delimiter] ((-f|-b|-c) {{sequence}}) {{sourcefile}}+";
|
||||
static SUMMARY: &str =
|
||||
@@ -400,7 +399,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
|
||||
let matches = App::new(executable!())
|
||||
.name(NAME)
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.usage(SYNTAX)
|
||||
.about(SUMMARY)
|
||||
.after_help(LONG_HELP)
|
||||
|
||||
@@ -14,7 +14,7 @@ extern crate uucore;
|
||||
use chrono::{DateTime, FixedOffset, Local, Offset, Utc};
|
||||
#[cfg(windows)]
|
||||
use chrono::{Datelike, Timelike};
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
use libc::{clock_settime, timespec, CLOCK_REALTIME};
|
||||
use std::fs::File;
|
||||
@@ -37,7 +37,6 @@ const SECOND: &str = "second";
|
||||
const NS: &str = "ns";
|
||||
|
||||
const NAME: &str = "date";
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
const ABOUT: &str = "print or set the system date and time";
|
||||
|
||||
const OPT_DATE: &str = "date";
|
||||
@@ -144,7 +143,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
NAME
|
||||
);
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.usage(&syntax[..])
|
||||
.arg(
|
||||
|
||||
+2
-3
@@ -12,7 +12,7 @@ extern crate uucore;
|
||||
use uucore::fsext::statfs_fn;
|
||||
use uucore::fsext::{read_fs_list, FsUsage, MountInfo};
|
||||
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
|
||||
use number_prefix::NumberPrefix;
|
||||
use std::cell::Cell;
|
||||
@@ -30,7 +30,6 @@ use uucore::libc::{c_char, fsid_t, uid_t};
|
||||
#[cfg(windows)]
|
||||
use std::path::Path;
|
||||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static ABOUT: &str = "Show information about the file system on which each FILE resides,\n\
|
||||
or all file systems by default.";
|
||||
|
||||
@@ -260,7 +259,7 @@ fn use_size(free_size: u64, total_size: u64) -> String {
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.usage(&usage[..])
|
||||
.arg(
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::path::Path;
|
||||
use uucore::InvalidEncodingHandling;
|
||||
|
||||
static ABOUT: &str = "strip last component from file name";
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
mod options {
|
||||
pub const ZERO: &str = "zero";
|
||||
@@ -43,7 +42,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
.about(ABOUT)
|
||||
.usage(&usage[..])
|
||||
.after_help(&after_help[..])
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.arg(
|
||||
Arg::with_name(options::ZERO)
|
||||
.long(options::ZERO)
|
||||
|
||||
+2
-3
@@ -10,7 +10,7 @@ extern crate uucore;
|
||||
|
||||
use chrono::prelude::DateTime;
|
||||
use chrono::Local;
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::collections::HashSet;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
@@ -58,7 +58,6 @@ mod options {
|
||||
pub const FILE: &str = "FILE";
|
||||
}
|
||||
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
const NAME: &str = "du";
|
||||
const SUMMARY: &str = "estimate file space usage";
|
||||
const LONG_HELP: &str = "
|
||||
@@ -414,7 +413,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(SUMMARY)
|
||||
.usage(&usage[..])
|
||||
.after_help(LONG_HELP)
|
||||
|
||||
@@ -12,14 +12,13 @@
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
use clap::{crate_version, App, Arg, ArgMatches};
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
|
||||
use std::iter::repeat;
|
||||
use std::str::from_utf8;
|
||||
use unicode_width::UnicodeWidthChar;
|
||||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static ABOUT: &str = "Convert tabs in each FILE to spaces, writing to standard output.
|
||||
With no FILE, or when FILE is -, read standard input.";
|
||||
|
||||
@@ -111,7 +110,7 @@ impl Options {
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.usage(&usage[..])
|
||||
.after_help(LONG_HELP)
|
||||
|
||||
@@ -13,7 +13,7 @@ use std::error::Error;
|
||||
use std::io::{self, stdin, stdout, BufRead, Write};
|
||||
|
||||
mod factor;
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
pub use factor::*;
|
||||
|
||||
mod miller_rabin;
|
||||
@@ -21,7 +21,6 @@ pub mod numeric;
|
||||
mod rho;
|
||||
pub mod table;
|
||||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static SUMMARY: &str = "Print the prime factors of the given NUMBER(s).
|
||||
If none are specified, read from standard input.";
|
||||
|
||||
@@ -38,7 +37,7 @@ fn print_factors_str(num_str: &str, w: &mut impl io::Write) -> Result<(), Box<dy
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(SUMMARY)
|
||||
.arg(Arg::with_name(options::NUMBER).multiple(true))
|
||||
.get_matches_from(args);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::cmp;
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, stdout, Write};
|
||||
@@ -32,7 +32,6 @@ mod linebreak;
|
||||
mod parasplit;
|
||||
|
||||
static ABOUT: &str = "Reformat paragraphs from input files (or stdin) to stdout.";
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static MAX_WIDTH: usize = 2500;
|
||||
|
||||
static OPT_CROWN_MARGIN: &str = "crown-margin";
|
||||
@@ -79,7 +78,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.usage(&usage[..])
|
||||
.arg(
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, BufRead, BufReader, Read};
|
||||
use std::path::Path;
|
||||
@@ -19,7 +19,6 @@ use uucore::InvalidEncodingHandling;
|
||||
const TAB_WIDTH: usize = 8;
|
||||
|
||||
static NAME: &str = "fold";
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static SYNTAX: &str = "[OPTION]... [FILE]...";
|
||||
static SUMMARY: &str = "Writes each file (or standard input if no files are given)
|
||||
to standard output whilst breaking long lines";
|
||||
@@ -39,7 +38,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let (args, obs_width) = handle_obsolete(&args[..]);
|
||||
let matches = App::new(executable!())
|
||||
.name(NAME)
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.usage(SYNTAX)
|
||||
.about(SUMMARY)
|
||||
.arg(
|
||||
|
||||
@@ -12,9 +12,8 @@
|
||||
extern crate uucore;
|
||||
use uucore::entries::{get_groups, gid2grp, Locate, Passwd};
|
||||
|
||||
use clap::{App, Arg};
|
||||
use clap::{crate_version, App, Arg};
|
||||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static ABOUT: &str = "display current group names";
|
||||
static OPT_USER: &str = "user";
|
||||
|
||||
@@ -26,7 +25,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
let usage = get_usage();
|
||||
|
||||
let matches = App::new(executable!())
|
||||
.version(VERSION)
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.usage(&usage[..])
|
||||
.arg(Arg::with_name(OPT_USER))
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user