mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge pull request #4777 from Joining7943/tail-change-text-static-to-const
'tail': Change static global variables to const
This commit is contained in:
commit
82eb04c5a9
3 changed files with 38 additions and 39 deletions
|
@ -24,22 +24,22 @@ const USAGE: &str = help_usage!("tail.md");
|
||||||
|
|
||||||
pub mod options {
|
pub mod options {
|
||||||
pub mod verbosity {
|
pub mod verbosity {
|
||||||
pub static QUIET: &str = "quiet";
|
pub const QUIET: &str = "quiet";
|
||||||
pub static VERBOSE: &str = "verbose";
|
pub const VERBOSE: &str = "verbose";
|
||||||
}
|
}
|
||||||
pub static BYTES: &str = "bytes";
|
pub const BYTES: &str = "bytes";
|
||||||
pub static FOLLOW: &str = "follow";
|
pub const FOLLOW: &str = "follow";
|
||||||
pub static LINES: &str = "lines";
|
pub const LINES: &str = "lines";
|
||||||
pub static PID: &str = "pid";
|
pub const PID: &str = "pid";
|
||||||
pub static SLEEP_INT: &str = "sleep-interval";
|
pub const SLEEP_INT: &str = "sleep-interval";
|
||||||
pub static ZERO_TERM: &str = "zero-terminated";
|
pub const ZERO_TERM: &str = "zero-terminated";
|
||||||
pub static DISABLE_INOTIFY_TERM: &str = "-disable-inotify"; // NOTE: three hyphens is correct
|
pub const DISABLE_INOTIFY_TERM: &str = "-disable-inotify"; // NOTE: three hyphens is correct
|
||||||
pub static USE_POLLING: &str = "use-polling";
|
pub const USE_POLLING: &str = "use-polling";
|
||||||
pub static RETRY: &str = "retry";
|
pub const RETRY: &str = "retry";
|
||||||
pub static FOLLOW_RETRY: &str = "F";
|
pub const FOLLOW_RETRY: &str = "F";
|
||||||
pub static MAX_UNCHANGED_STATS: &str = "max-unchanged-stats";
|
pub const MAX_UNCHANGED_STATS: &str = "max-unchanged-stats";
|
||||||
pub static ARG_FILES: &str = "files";
|
pub const ARG_FILES: &str = "files";
|
||||||
pub static PRESUME_INPUT_PIPE: &str = "-presume-input-pipe"; // NOTE: three hyphens is correct
|
pub const PRESUME_INPUT_PIPE: &str = "-presume-input-pipe"; // NOTE: three hyphens is correct
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
|
@ -470,12 +470,11 @@ pub fn parse_args(args: impl uucore::Args) -> UResult<Settings> {
|
||||||
|
|
||||||
pub fn uu_app() -> Command {
|
pub fn uu_app() -> Command {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub static POLLING_HELP: &str = "Disable 'inotify' support and use polling instead";
|
const POLLING_HELP: &str = "Disable 'inotify' support and use polling instead";
|
||||||
#[cfg(all(unix, not(target_os = "linux")))]
|
#[cfg(all(unix, not(target_os = "linux")))]
|
||||||
pub static POLLING_HELP: &str = "Disable 'kqueue' support and use polling instead";
|
const POLLING_HELP: &str = "Disable 'kqueue' support and use polling instead";
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
pub static POLLING_HELP: &str =
|
const POLLING_HELP: &str = "Disable 'ReadDirectoryChanges' support and use polling instead";
|
||||||
"Disable 'ReadDirectoryChanges' support and use polling instead";
|
|
||||||
|
|
||||||
Command::new(uucore::util_name())
|
Command::new(uucore::util_name())
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
|
|
|
@ -5,20 +5,20 @@
|
||||||
|
|
||||||
// spell-checker:ignore (ToDO) kqueue
|
// spell-checker:ignore (ToDO) kqueue
|
||||||
|
|
||||||
pub static DASH: &str = "-";
|
pub const DASH: &str = "-";
|
||||||
pub static DEV_STDIN: &str = "/dev/stdin";
|
pub const DEV_STDIN: &str = "/dev/stdin";
|
||||||
pub static STDIN_HEADER: &str = "standard input";
|
pub const STDIN_HEADER: &str = "standard input";
|
||||||
pub static NO_FILES_REMAINING: &str = "no files remaining";
|
pub const NO_FILES_REMAINING: &str = "no files remaining";
|
||||||
pub static NO_SUCH_FILE: &str = "No such file or directory";
|
pub const NO_SUCH_FILE: &str = "No such file or directory";
|
||||||
pub static BECOME_INACCESSIBLE: &str = "has become inaccessible";
|
pub const BECOME_INACCESSIBLE: &str = "has become inaccessible";
|
||||||
pub static BAD_FD: &str = "Bad file descriptor";
|
pub const BAD_FD: &str = "Bad file descriptor";
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub static BACKEND: &str = "inotify";
|
pub const BACKEND: &str = "inotify";
|
||||||
#[cfg(all(unix, not(target_os = "linux")))]
|
#[cfg(all(unix, not(target_os = "linux")))]
|
||||||
pub static BACKEND: &str = "kqueue";
|
pub const BACKEND: &str = "kqueue";
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
pub static BACKEND: &str = "ReadDirectoryChanges";
|
pub const BACKEND: &str = "ReadDirectoryChanges";
|
||||||
pub static FD0: &str = "/dev/fd/0";
|
pub const FD0: &str = "/dev/fd/0";
|
||||||
pub static IS_A_DIRECTORY: &str = "Is a directory";
|
pub const IS_A_DIRECTORY: &str = "Is a directory";
|
||||||
pub static DEV_TTY: &str = "/dev/tty";
|
pub const DEV_TTY: &str = "/dev/tty";
|
||||||
pub static DEV_PTMX: &str = "/dev/ptmx";
|
pub const DEV_PTMX: &str = "/dev/ptmx";
|
||||||
|
|
|
@ -36,15 +36,15 @@ use tail::chunks::BUFFER_SIZE as CHUNK_BUFFER_SIZE;
|
||||||
))]
|
))]
|
||||||
use tail::text;
|
use tail::text;
|
||||||
|
|
||||||
static FOOBAR_TXT: &str = "foobar.txt";
|
const FOOBAR_TXT: &str = "foobar.txt";
|
||||||
static FOOBAR_2_TXT: &str = "foobar2.txt";
|
const FOOBAR_2_TXT: &str = "foobar2.txt";
|
||||||
static FOOBAR_WITH_NULL_TXT: &str = "foobar_with_null.txt";
|
const FOOBAR_WITH_NULL_TXT: &str = "foobar_with_null.txt";
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
static FOLLOW_NAME_TXT: &str = "follow_name.txt";
|
const FOLLOW_NAME_TXT: &str = "follow_name.txt";
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
static FOLLOW_NAME_SHORT_EXP: &str = "follow_name_short.expected";
|
const FOLLOW_NAME_SHORT_EXP: &str = "follow_name_short.expected";
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
static FOLLOW_NAME_EXP: &str = "follow_name.expected";
|
const FOLLOW_NAME_EXP: &str = "follow_name.expected";
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
const DEFAULT_SLEEP_INTERVAL_MILLIS: u64 = 1000;
|
const DEFAULT_SLEEP_INTERVAL_MILLIS: u64 = 1000;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue