use clap::crate_version macro instead of the env variable

This commit is contained in:
Sylvestre Ledru 2021-06-02 19:00:19 +02:00
parent 6aa53ead7c
commit d8c06dd6bb
79 changed files with 160 additions and 251 deletions

View file

@ -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);

View file

@ -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(

View file

@ -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))

View file

@ -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[..])

View file

@ -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(

View file

@ -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))

View file

@ -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))

View file

@ -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)

View file

@ -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[..])

View file

@ -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(

View file

@ -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)

View file

@ -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(

View file

@ -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(

View file

@ -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)

View file

@ -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;
@ -56,7 +56,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 = "
@ -398,7 +397,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)

View file

@ -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)

View file

@ -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);

View file

@ -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(

View file

@ -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(

View file

@ -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))

View file

@ -1,6 +1,6 @@
// spell-checker:ignore (vars) zlines
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::convert::TryFrom;
use std::ffi::OsString;
use std::io::{self, ErrorKind, Read, Seek, SeekFrom, Write};
@ -10,7 +10,6 @@ const EXIT_FAILURE: i32 = 1;
const EXIT_SUCCESS: i32 = 0;
const BUF_SIZE: usize = 65536;
const VERSION: &str = env!("CARGO_PKG_VERSION");
const ABOUT: &str = "\
Print the first 10 lines of each FILE to standard output.\n\
With more than one FILE, precede each with a header giving the file name.\n\
@ -38,7 +37,7 @@ use take::take_all_but;
fn app<'a>() -> App<'a, 'a> {
App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(USAGE)
.arg(

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg, ArgMatches};
use clap::{crate_version, App, Arg, ArgMatches};
use std::collections::hash_set::HashSet;
use std::net::ToSocketAddrs;
use std::str;
@ -21,7 +21,6 @@ use winapi::shared::minwindef::MAKEWORD;
use winapi::um::winsock2::{WSACleanup, WSAStartup};
static ABOUT: &str = "Display or set the system's host name.";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static OPT_DOMAIN: &str = "domain";
static OPT_IP_ADDRESS: &str = "ip-address";
@ -54,7 +53,7 @@ fn get_usage() -> String {
fn execute(args: impl uucore::Args) -> i32 {
let usage = get_usage();
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])
.arg(

View file

@ -18,7 +18,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::ffi::CStr;
use uucore::entries::{self, Group, Locate, Passwd};
pub use uucore::libc;
@ -71,7 +71,6 @@ mod audit {
}
static ABOUT: &str = "Display user and group information for the specified USER,\n or (when USER omitted) for the current user.";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static OPT_AUDIT: &str = "audit";
static OPT_EFFECTIVE_USER: &str = "effective-user";
@ -92,7 +91,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(

View file

@ -12,7 +12,7 @@ mod mode;
#[macro_use]
extern crate uucore;
use clap::{App, Arg, ArgMatches};
use clap::{crate_version, App, Arg, ArgMatches};
use file_diff::diff;
use filetime::{set_file_times, FileTime};
use uucore::entries::{grp2gid, usr2uid};
@ -64,7 +64,6 @@ impl Behavior {
static ABOUT: &str = "Copy SOURCE to DEST or multiple SOURCE(s) to the existing
DIRECTORY, while setting permission modes and owner/group";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static OPT_COMPARE: &str = "compare";
static OPT_BACKUP: &str = "backup";
@ -99,7 +98,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(

View file

@ -10,13 +10,12 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::cmp::{min, Ordering};
use std::fs::File;
use std::io::{stdin, BufRead, BufReader, Lines, Stdin};
static NAME: &str = "join";
static VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(Copy, Clone, PartialEq)]
enum FileNum {
@ -444,7 +443,7 @@ impl<'a> State<'a> {
pub fn uumain(args: impl uucore::Args) -> i32 {
let matches = App::new(NAME)
.version(VERSION)
.version(crate_version!())
.about(
"For each pair of input lines with identical join fields, write a line to
standard output. The default join field is the first, delimited by blanks.

View file

@ -10,13 +10,12 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use libc::{c_int, pid_t};
use std::io::Error;
use uucore::signals::ALL_SIGNALS;
use uucore::InvalidEncodingHandling;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Send signal to processes or list information about signals.";
static EXIT_OK: i32 = 0;
@ -45,7 +44,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let usage = format!("{} [OPTIONS]... PID...", executable!());
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])
.arg(

View file

@ -8,12 +8,11 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::fs::hard_link;
use std::io::Error;
use std::path::Path;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Call the link function to create a link named FILE2 to an existing FILE1.";
pub mod options {
@ -34,7 +33,7 @@ pub fn normalize_error_message(e: Error) -> 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(

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::borrow::Cow;
use std::ffi::OsStr;
@ -77,7 +77,6 @@ fn get_long_usage() -> String {
}
static ABOUT: &str = "change file owner and group";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static OPT_B: &str = "b";
static OPT_BACKUP: &str = "backup";
@ -98,7 +97,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let long_usage = get_long_usage();
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])
.after_help(&long_usage[..])

View file

@ -15,7 +15,7 @@ extern crate uucore;
use std::ffi::CStr;
use uucore::InvalidEncodingHandling;
use clap::App;
use clap::{crate_version, App};
extern "C" {
// POSIX requires using getlogin (or equivalent code)
@ -34,7 +34,6 @@ fn get_userlogin() -> Option<String> {
}
static SUMMARY: &str = "Print user's login name";
static VERSION: &str = env!("CARGO_PKG_VERSION");
fn get_usage() -> String {
String::from(executable!())
@ -47,7 +46,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let usage = get_usage();
let _ = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(SUMMARY)
.usage(&usage[..])
.get_matches_from(args);

View file

@ -16,7 +16,7 @@ extern crate lazy_static;
mod quoting_style;
mod version_cmp;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use globset::{self, Glob, GlobSet, GlobSetBuilder};
use lscolors::LsColors;
use number_prefix::NumberPrefix;
@ -45,7 +45,6 @@ use unicode_width::UnicodeWidthStr;
#[cfg(unix)]
use uucore::libc::{S_IXGRP, S_IXOTH, S_IXUSR};
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "
By default, ls will list the files and contents of any directories on
the command line, expect that it will ignore files and directories
@ -559,7 +558,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let usage = get_usage();
let app = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])

View file

@ -8,12 +8,11 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::fs;
use std::path::Path;
static ABOUT: &str = "Create the given DIRECTORY(ies) if they do not exist";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static OPT_MODE: &str = "mode";
static OPT_PARENTS: &str = "parents";
static OPT_VERBOSE: &str = "verbose";
@ -34,7 +33,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
// opts.optflag("Z", "context", "set SELinux security context" +
// " of each created directory to CTX"),
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])
.arg(

View file

@ -8,13 +8,12 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use libc::mkfifo;
use std::ffi::CString;
use uucore::InvalidEncodingHandling;
static NAME: &str = "mkfifo";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static USAGE: &str = "mkfifo [OPTION]... NAME...";
static SUMMARY: &str = "Create a FIFO with the given name.";
@ -32,7 +31,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let matches = App::new(executable!())
.name(NAME)
.version(VERSION)
.version(crate_version!())
.usage(USAGE)
.about(SUMMARY)
.arg(

View file

@ -12,14 +12,13 @@ extern crate uucore;
use std::ffi::CString;
use clap::{App, Arg, ArgMatches};
use clap::{crate_version, App, Arg, ArgMatches};
use libc::{dev_t, mode_t};
use libc::{S_IFBLK, S_IFCHR, S_IFIFO, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR};
use uucore::InvalidEncodingHandling;
static NAME: &str = "mknod";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Create the special file NAME of the given TYPE.";
static USAGE: &str = "mknod [OPTION]... NAME TYPE [MAJOR MINOR]";
static LONG_HELP: &str = "Mandatory arguments to long options are mandatory for short options too.
@ -91,7 +90,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
// opts.optopt("", "context", "like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX");
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.usage(USAGE)
.after_help(LONG_HELP)
.about(ABOUT)

View file

@ -11,7 +11,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::env;
use std::iter;
@ -21,7 +21,6 @@ use rand::Rng;
use tempfile::Builder;
static ABOUT: &str = "create a temporary file or directory.";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static DEFAULT_TEMPLATE: &str = "tmp.XXXXXXXXXX";
@ -42,7 +41,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(

View file

@ -21,7 +21,7 @@ use std::{
#[cfg(all(unix, not(target_os = "fuchsia")))]
extern crate nix;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use crossterm::{
event::{self, Event, KeyCode, KeyEvent, KeyModifiers},
execute, queue,
@ -49,7 +49,7 @@ const MULTI_FILE_TOP_PROMPT: &str = "::::::::::::::\n{}\n::::::::::::::\n";
pub fn uumain(args: impl uucore::Args) -> i32 {
let matches = App::new(executable!())
.about("A file perusal filter for CRT viewing.")
.version(env!("CARGO_PKG_VERSION"))
.version(crate_version!())
// The commented arguments below are unimplemented:
/*
.arg(

View file

@ -11,7 +11,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg, ArgMatches};
use clap::{crate_version, App, Arg, ArgMatches};
use std::env;
use std::fs;
use std::io::{self, stdin};
@ -42,7 +42,6 @@ pub enum OverwriteMode {
}
static ABOUT: &str = "Move SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static LONG_HELP: &str = "";
static OPT_BACKUP: &str = "backup";
@ -72,7 +71,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)
.after_help(&*format!("{}\n{}", LONG_HELP, backup_control::BACKUP_CONTROL_LONG_HELP))
.usage(&usage[..])

View file

@ -15,8 +15,7 @@ use std::ffi::CString;
use std::io::Error;
use std::ptr;
use clap::{App, AppSettings, Arg};
const VERSION: &str = env!("CARGO_PKG_VERSION");
use clap::{crate_version, App, AppSettings, Arg};
// XXX: PRIO_PROCESS is 0 on at least FreeBSD and Linux. Don't know about Mac OS X.
const PRIO_PROCESS: c_int = 0;
@ -49,7 +48,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let matches = App::new(executable!())
.setting(AppSettings::TrailingVarArg)
.version(VERSION)
.version(crate_version!())
.usage(&usage[..])
.arg(
Arg::with_name(options::ADJUSTMENT)

View file

@ -11,7 +11,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::iter::repeat;
@ -21,7 +21,6 @@ use uucore::InvalidEncodingHandling;
mod helper;
static NAME: &str = "nl";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static USAGE: &str = "nl [OPTION]... [FILE]...";
// A regular expression matching everything.
@ -91,7 +90,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let matches = App::new(executable!())
.name(NAME)
.version(VERSION)
.version(crate_version!())
.usage(USAGE)
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true))
.arg(

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, AppSettings, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use libc::{c_char, dup2, execvp, signal};
use libc::{SIGHUP, SIG_IGN};
use std::env;
@ -22,7 +22,6 @@ use std::path::{Path, PathBuf};
use uucore::fs::{is_stderr_interactive, is_stdin_interactive, is_stdout_interactive};
use uucore::InvalidEncodingHandling;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Run COMMAND ignoring hangup signals.";
static LONG_HELP: &str = "
If standard input is terminal, it'll be replaced with /dev/null.
@ -48,7 +47,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)

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::env;
#[cfg(target_os = "linux")]
@ -25,7 +25,6 @@ pub const _SC_NPROCESSORS_CONF: libc::c_int = 1001;
static OPT_ALL: &str = "all";
static OPT_IGNORE: &str = "ignore";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Print the number of cores available to the current process.";
fn get_usage() -> String {
@ -35,7 +34,7 @@ fn get_usage() -> 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(

View file

@ -11,7 +11,7 @@ extern crate uucore;
use crate::format::format_and_print;
use crate::options::*;
use crate::units::{Result, Transform, Unit};
use clap::{App, AppSettings, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use std::io::{BufRead, Write};
use uucore::ranges::Range;
@ -19,7 +19,6 @@ pub mod format;
mod options;
mod units;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Convert numbers from/to human-readable strings";
static LONG_HELP: &str = "UNIT options:
none no auto-scaling is done; suffixes will trigger an error
@ -149,7 +148,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[..])
.after_help(LONG_HELP)

View file

@ -42,10 +42,9 @@ use crate::parse_nrofbytes::parse_number_of_bytes;
use crate::partialreader::*;
use crate::peekreader::*;
use crate::prn_char::format_ascii_dump;
use clap::{self, AppSettings, Arg, ArgMatches};
use clap::{self, crate_version, AppSettings, Arg, ArgMatches};
use uucore::InvalidEncodingHandling;
static VERSION: &str = env!("CARGO_PKG_VERSION");
const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes
static ABOUT: &str = "dump files in octal and other formats";
@ -103,7 +102,6 @@ pub(crate) mod options {
pub const OUTPUT_DUPLICATES: &str = "output-duplicates";
pub const TRADITIONAL: &str = "traditional";
pub const WIDTH: &str = "width";
pub const VERSION: &str = "version";
pub const FILENAME: &str = "FILENAME";
}
@ -228,7 +226,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
.accept_any();
let clap_opts = clap::App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(USAGE)
.after_help(LONG_HELP)
@ -431,12 +429,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
.default_value("32")
.value_name("BYTES"),
)
.arg(
Arg::with_name(options::VERSION)
.long(options::VERSION)
.help("output version information and exit.")
.takes_value(false),
)
.arg(
Arg::with_name(options::TRADITIONAL)
.long(options::TRADITIONAL)
@ -459,11 +451,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
.clone() // Clone to reuse clap_opts to print help
.get_matches_from(args.clone());
if clap_matches.is_present(options::VERSION) {
println!("{} {}", executable!(), VERSION);
return 0;
}
let od_options = match OdOptions::new(clap_matches, args) {
Err(s) => {
show_usage_error!("{}", s);

View file

@ -10,13 +10,12 @@
#[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::iter::repeat;
use std::path::Path;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Write lines consisting of the sequentially corresponding lines from each
FILE, separated by TABs, to standard output.";
@ -39,7 +38,7 @@ fn read_line<R: Read>(
pub fn uumain(args: impl uucore::Args) -> i32 {
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.arg(
Arg::with_name(options::SERIAL)

View file

@ -12,7 +12,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::fs;
use std::io::{ErrorKind, Write};
use uucore::InvalidEncodingHandling;
@ -26,7 +26,6 @@ enum Mode {
}
static NAME: &str = "pathchk";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Check whether file names are valid or portable";
mod options {
@ -51,7 +50,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[..])
.arg(

View file

@ -19,13 +19,12 @@ use std::io::BufReader;
use std::fs::File;
use std::os::unix::fs::MetadataExt;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::path::PathBuf;
use uucore::InvalidEncodingHandling;
const BUFSIZE: usize = 1024;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "pinky - lightweight finger";
mod options {
@ -62,7 +61,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[..])

View file

@ -10,11 +10,10 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::env;
static ABOUT: &str = "Display the values of the specified environment VARIABLE(s), or (with no VARIABLE) display name and value pairs for them all.";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static OPT_NULL: &str = "null";
@ -28,7 +27,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(

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use regex::Regex;
use std::cmp;
use std::collections::{BTreeSet, HashMap, HashSet};
@ -20,7 +20,6 @@ use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
use uucore::InvalidEncodingHandling;
static NAME: &str = "ptx";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static BRIEF: &str = "Usage: ptx [OPTION]... [INPUT]... (without -G) or: \
ptx -G [OPTION]... [INPUT [OUTPUT]] \n Output a permuted index, \
including context, of the words in the input files. \n\n Mandatory \
@ -641,7 +640,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
// let mut opts = Options::new();
let matches = App::new(executable!())
.name(NAME)
.version(VERSION)
.version(crate_version!())
.usage(BRIEF)
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true))
.arg(

View file

@ -8,13 +8,12 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::env;
use std::io;
use std::path::{Path, PathBuf};
static ABOUT: &str = "Display the full filename of the current working directory.";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static OPT_LOGICAL: &str = "logical";
static OPT_PHYSICAL: &str = "physical";
@ -41,7 +40,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(

View file

@ -10,14 +10,13 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::fs;
use std::io::{stdout, Write};
use std::path::{Path, PathBuf};
use uucore::fs::{canonicalize, CanonicalizeMode};
const NAME: &str = "readlink";
const VERSION: &str = env!("CARGO_PKG_VERSION");
const ABOUT: &str = "Print value of a symbolic link or canonical file name.";
const OPT_CANONICALIZE: &str = "canonicalize";
const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing";
@ -37,7 +36,7 @@ fn get_usage() -> 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(

View file

@ -10,12 +10,11 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::path::{Path, PathBuf};
use uucore::fs::{canonicalize, CanonicalizeMode};
static ABOUT: &str = "print the resolved path";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static OPT_QUIET: &str = "quiet";
static OPT_STRIP: &str = "strip";
@ -31,7 +30,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(

View file

@ -10,13 +10,12 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::env;
use std::path::{Path, PathBuf};
use uucore::fs::{canonicalize, CanonicalizeMode};
use uucore::InvalidEncodingHandling;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Convert TO destination to the relative path from the FROM dir.
If FROM path is omitted, current working dir will be used.";
@ -37,7 +36,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(

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use remove_dir_all::remove_dir_all;
use std::collections::VecDeque;
use std::fs;
@ -38,7 +38,6 @@ struct Options {
}
static ABOUT: &str = "Remove (unlink) the FILE(s)";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static OPT_DIR: &str = "dir";
static OPT_INTERACTIVE: &str = "interactive";
static OPT_FORCE: &str = "force";
@ -79,7 +78,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let long_usage = get_long_usage();
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])
.after_help(&long_usage[..])

View file

@ -10,11 +10,10 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::fs;
use std::path::Path;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Remove the DIRECTORY(ies), if they are empty.";
static OPT_IGNORE_FAIL_NON_EMPTY: &str = "ignore-fail-on-non-empty";
static OPT_PARENTS: &str = "parents";
@ -35,7 +34,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(

View file

@ -6,7 +6,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, AppSettings, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use num_bigint::BigInt;
use num_traits::One;
use num_traits::Zero;
@ -15,7 +15,6 @@ use std::cmp;
use std::io::{stdout, Write};
use std::str::FromStr;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Display numbers from FIRST to LAST, in steps of INCREMENT.";
static OPT_SEPARATOR: &str = "separator";
static OPT_TERMINATOR: &str = "terminator";
@ -90,7 +89,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let usage = get_usage();
let matches = App::new(executable!())
.setting(AppSettings::AllowLeadingHyphen)
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])
.arg(

View file

@ -8,7 +8,7 @@
// spell-checker:ignore (words) writeback wipesync
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use rand::{Rng, ThreadRng};
use std::cell::{Cell, RefCell};
use std::fs;
@ -23,7 +23,6 @@ use uucore::InvalidEncodingHandling;
extern crate uucore;
static NAME: &str = "shred";
static VERSION_STR: &str = "1.0.0";
const BLOCK_SIZE: usize = 512;
const NAME_CHARSET: &str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.";
@ -278,7 +277,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let usage = get_usage();
let app = App::new(executable!())
.version(VERSION_STR)
.version(crate_version!())
.about(ABOUT)
.after_help(AFTER_HELP)
.usage(&usage[..])

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use rand::Rng;
use std::fs::File;
use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
@ -23,7 +23,6 @@ enum Mode {
}
static NAME: &str = "shuf";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static USAGE: &str = r#"shuf [OPTION]... [FILE]
or: shuf -e [OPTION]... [ARG]...
or: shuf -i LO-HI [OPTION]...
@ -59,7 +58,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let matches = App::new(executable!())
.name(NAME)
.version(VERSION)
.version(crate_version!())
.template(TEMPLATE)
.usage(USAGE)
.arg(

View file

@ -11,9 +11,8 @@ extern crate uucore;
use std::thread;
use std::time::Duration;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Pause for NUMBER seconds.";
static LONG_HELP: &str = "Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default),
'm' for minutes, 'h' for hours or 'd' for days. Unlike most implementations
@ -37,7 +36,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[..])
.after_help(LONG_HELP)

View file

@ -23,7 +23,7 @@ mod ext_sort;
mod merge;
mod numeric_str_cmp;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use custom_str_cmp::custom_str_cmp;
use ext_sort::ext_sort;
use fnv::FnvHasher;
@ -47,7 +47,6 @@ use uucore::InvalidEncodingHandling;
static NAME: &str = "sort";
static ABOUT: &str = "Display sorted concatenation of all FILE(s).";
static VERSION: &str = env!("CARGO_PKG_VERSION");
const LONG_HELP_KEYS: &str = "The key format is FIELD[.CHAR][OPTIONS][,FIELD[.CHAR]][OPTIONS].
@ -874,13 +873,13 @@ impl FieldSelector {
fn get_usage() -> String {
format!(
"{0} {1}
"{0}
Usage:
{0} [OPTION]... [FILE]...
Write the sorted concatenation of all FILE(s) to standard output.
Mandatory arguments for long options are mandatory for short options too.
With no FILE, or when FILE is -, read standard input.",
NAME, VERSION
NAME
)
}
@ -902,7 +901,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let mut settings: GlobalSettings = Default::default();
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])
.arg(

View file

@ -12,7 +12,7 @@ extern crate uucore;
mod platform;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::env;
use std::fs::File;
use std::io::{stdin, BufRead, BufReader, BufWriter, Read, Write};
@ -20,7 +20,6 @@ use std::path::Path;
use std::{char, fs::remove_file};
static NAME: &str = "split";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static OPT_BYTES: &str = "bytes";
static OPT_LINE_BYTES: &str = "line-bytes";
@ -56,7 +55,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let default_suffix_length_str = OPT_DEFAULT_SUFFIX_LENGTH.to_string();
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about("Create output files containing consecutive or interleaved sections of input")
.usage(&usage[..])
.after_help(&long_usage[..])

View file

@ -14,7 +14,7 @@ use uucore::fsext::{
};
use uucore::libc::mode_t;
use clap::{App, Arg, ArgMatches};
use clap::{crate_version, App, Arg, ArgMatches};
use std::borrow::Cow;
use std::convert::AsRef;
use std::os::unix::fs::{FileTypeExt, MetadataExt};
@ -82,7 +82,6 @@ macro_rules! print_adjusted {
}
static ABOUT: &str = "Display file or file system status.";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub mod options {
pub static DEREFERENCE: &str = "dereference";
@ -949,7 +948,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let long_usage = get_long_usage();
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])
.after_help(&long_usage[..])

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, AppSettings, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use std::convert::TryFrom;
use std::fs::File;
use std::io::{self, Write};
@ -21,7 +21,6 @@ use tempfile::tempdir;
use tempfile::TempDir;
use uucore::InvalidEncodingHandling;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str =
"Run COMMAND, with modified buffering operations for its standard streams.\n\n\
Mandatory arguments to long options are mandatory for short options too.";
@ -193,7 +192,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[..])
.after_help(LONG_HELP)

View file

@ -10,14 +10,13 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::fs::File;
use std::io::{stdin, Read, Result};
use std::path::Path;
use uucore::InvalidEncodingHandling;
static NAME: &str = "sum";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static USAGE: &str =
"[OPTION]... [FILE]...\nWith no FILE, or when FILE is -, read standard input.";
static SUMMARY: &str = "Checksum and count the blocks in a file.";
@ -101,7 +100,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let matches = App::new(executable!())
.name(NAME)
.version(VERSION)
.version(crate_version!())
.usage(USAGE)
.about(SUMMARY)
.arg(Arg::with_name(options::FILE).multiple(true).hidden(true))

View file

@ -12,13 +12,12 @@ extern crate libc;
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::path::Path;
static EXIT_ERR: i32 = 1;
static ABOUT: &str = "Synchronize cached writes to persistent storage";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub mod options {
pub static FILE_SYSTEM: &str = "file-system";
pub static DATA: &str = "data";
@ -168,7 +167,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(

View file

@ -10,13 +10,12 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::io::{stdin, stdout, BufReader, Read, Stdout, Write};
use std::{fs::File, path::Path};
use uucore::InvalidEncodingHandling;
static NAME: &str = "tac";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static USAGE: &str = "[OPTION]... [FILE]...";
static SUMMARY: &str = "Write each file to standard output, last line first.";
@ -34,7 +33,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let matches = App::new(executable!())
.name(NAME)
.version(VERSION)
.version(crate_version!())
.usage(USAGE)
.about(SUMMARY)
.arg(

View file

@ -8,7 +8,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use retain_mut::RetainMut;
use std::fs::OpenOptions;
use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write};
@ -17,7 +17,6 @@ use std::path::{Path, PathBuf};
#[cfg(unix)]
use uucore::libc;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Copy standard input to each FILE, and also to standard output.";
mod options {
@ -41,7 +40,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[..])
.after_help("If a FILE is -, it refers to a file named - .")

View file

@ -12,7 +12,7 @@ extern crate uucore;
extern crate clap;
use clap::{App, AppSettings, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::io::ErrorKind;
use std::process::{Command, Stdio};
use std::time::Duration;
@ -20,7 +20,6 @@ use uucore::process::ChildExt;
use uucore::signals::signal_by_name_or_value;
use uucore::InvalidEncodingHandling;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Start COMMAND, and kill it if still running after DURATION.";
fn get_usage() -> String {
@ -33,7 +32,6 @@ pub mod options {
pub static FOREGROUND: &str = "foreground";
pub static KILL_AFTER: &str = "kill-after";
pub static SIGNAL: &str = "signal";
pub static VERSION: &str = "version";
pub static PRESERVE_STATUS: &str = "preserve-status";
// Positional args.
@ -106,7 +104,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let usage = get_usage();
let app = App::new("timeout")
.version(VERSION)
.version(crate_version!())
.usage(&usage[..])
.about(ABOUT)
.arg(

View file

@ -13,14 +13,13 @@ pub extern crate filetime;
#[macro_use]
extern crate uucore;
use clap::{App, Arg, ArgGroup};
use clap::{crate_version, App, Arg, ArgGroup};
use filetime::*;
use std::fs::{self, File};
use std::io::Error;
use std::path::Path;
use std::process;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Update the access and modification times of each FILE to the current time.";
pub mod options {
// Both SOURCES and sources are needed as we need to be able to refer to the ArgGroup.
@ -57,7 +56,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(

View file

@ -16,14 +16,13 @@ extern crate uucore;
mod expand;
use bit_set::BitSet;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use fnv::FnvHashMap;
use std::io::{stdin, stdout, BufRead, BufWriter, Write};
use crate::expand::ExpandSet;
use uucore::InvalidEncodingHandling;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "translate or delete characters";
const BUFFER_LEN: usize = 1024;
@ -251,7 +250,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[..])

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::fs::{metadata, OpenOptions};
use std::io::ErrorKind;
use std::path::Path;
@ -52,7 +52,6 @@ impl TruncateMode {
}
static ABOUT: &str = "Shrink or extend the size of each file to the specified size.";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub mod options {
pub static IO_BLOCKS: &str = "io-blocks";
@ -94,7 +93,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let long_usage = get_long_usage();
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])
.after_help(&long_usage[..])

View file

@ -9,14 +9,13 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::{stdin, BufRead, BufReader, Read};
use std::path::Path;
use uucore::InvalidEncodingHandling;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static SUMMARY: &str = "Topological sort the strings in FILE.
Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline).
If FILE is not passed in, stdin is used instead.";
@ -32,7 +31,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
.accept_any();
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.usage(USAGE)
.about(SUMMARY)
.arg(

View file

@ -12,12 +12,11 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::ffi::CStr;
use uucore::fs::is_stdin_interactive;
use uucore::InvalidEncodingHandling;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Print the file name of the terminal connected to standard input.";
mod options {
@ -35,7 +34,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[..])
.arg(

View file

@ -13,10 +13,9 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use platform_info::*;
const VERSION: &str = env!("CARGO_PKG_VERSION");
const ABOUT: &str = "Print certain system information. With no OPTION, same as -s.";
pub mod options {
@ -49,7 +48,7 @@ const HOST_OS: &str = "Redox";
pub fn uumain(args: impl uucore::Args) -> i32 {
let usage = format!("{} [OPTION]...", executable!());
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])
.arg(Arg::with_name(options::ALL)

View file

@ -11,7 +11,7 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::fs::File;
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Stdout, Write};
use std::str::from_utf8;
@ -19,7 +19,6 @@ use unicode_width::UnicodeWidthChar;
use uucore::InvalidEncodingHandling;
static NAME: &str = "unexpand";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static USAGE: &str = "unexpand [OPTION]... [FILE]...";
static SUMMARY: &str = "Convert blanks in each FILE to tabs, writing to standard output.\n
With no FILE, or when FILE is -, read standard input.";
@ -97,7 +96,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let matches = App::new(executable!())
.name(NAME)
.version(VERSION)
.version(crate_version!())
.usage(USAGE)
.about(SUMMARY)
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true))

View file

@ -8,7 +8,7 @@
#[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, Result, Write};
use std::path::Path;
@ -16,7 +16,6 @@ use std::str::FromStr;
use strum_macros::{AsRefStr, EnumString};
static ABOUT: &str = "Report or omit repeated lines.";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub mod options {
pub static ALL_REPEATED: &str = "all-repeated";
pub static CHECK_CHARS: &str = "check-chars";
@ -240,7 +239,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let long_usage = get_long_usage();
let matches = App::new(executable!())
.version(VERSION)
.version(crate_version!())
.about(ABOUT)
.usage(&usage[..])
.after_help(&long_usage[..])

View file

@ -12,14 +12,13 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use libc::{lstat, stat, unlink};
use libc::{S_IFLNK, S_IFMT, S_IFREG};
use std::ffi::CString;
use std::io::{Error, ErrorKind};
use uucore::InvalidEncodingHandling;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Unlink the file at [FILE].";
static OPT_PATH: &str = "FILE";
@ -35,7 +34,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_PATH).hidden(true).multiple(true))

View file

@ -9,7 +9,7 @@
// spell-checker:ignore (ToDO) getloadavg upsecs updays nusers loadavg boottime uphours upmins
use chrono::{Local, TimeZone, Utc};
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
#[macro_use]
extern crate uucore;
@ -17,7 +17,6 @@ extern crate uucore;
pub use uucore::libc;
use uucore::libc::time_t;
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Display the current time, the length of time the system has been up,\n\
the number of users on the system, and the average number of jobs\n\
in the run queue over the last 1, 5 and 15 minutes.";
@ -40,7 +39,7 @@ fn get_usage() -> 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(

View file

@ -11,10 +11,9 @@
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use uucore::utmpx::{self, Utmpx};
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Print the user names of users currently logged in to the current host";
static ARG_FILES: &str = "files";
@ -36,7 +35,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[..])

View file

@ -15,7 +15,7 @@ use count_bytes::count_bytes_fast;
use countable::WordCountable;
use word_count::{TitledWordCount, WordCount};
use clap::{App, Arg, ArgMatches};
use clap::{crate_version, App, Arg, ArgMatches};
use thiserror::Error;
use std::fs::{self, File};
@ -84,7 +84,6 @@ impl Settings {
static ABOUT: &str = "Display newline, word, and byte counts for each FILE, and a total line if
more than one FILE is specified.";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub mod options {
pub static BYTES: &str = "bytes";
@ -136,7 +135,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(

View file

@ -12,7 +12,7 @@ extern crate uucore;
use uucore::libc::{ttyname, STDIN_FILENO, S_IWGRP};
use uucore::utmpx::{self, time, Utmpx};
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use std::borrow::Cow;
use std::ffi::CStr;
use std::os::unix::fs::MetadataExt;
@ -37,7 +37,6 @@ mod options {
pub const FILE: &str = "FILE"; // if length=1: FILE, if length=2: ARG1 ARG2
}
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Print information about users who are currently logged in.";
#[cfg(any(target_os = "linux"))]
@ -66,7 +65,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[..])