mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
fix ~ fixes for newly added utilities
This commit is contained in:
parent
44981cab01
commit
813b477859
4 changed files with 12 additions and 12 deletions
|
@ -42,12 +42,12 @@ const ENCODINGS: &[(&str, Format)] = &[
|
||||||
("base2m", Format::Base2Msbf),
|
("base2m", Format::Base2Msbf),
|
||||||
];
|
];
|
||||||
|
|
||||||
fn get_usage() -> String {
|
fn usage() -> String {
|
||||||
format!("{0} [OPTION]... [FILE]", executable!())
|
format!("{0} [OPTION]... [FILE]", execution_phrase!())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uu_app() -> App<'static, 'static> {
|
pub fn uu_app() -> App<'static, 'static> {
|
||||||
let mut app = base_common::base_app(executable!(), crate_version!(), ABOUT);
|
let mut app = base_common::base_app(&util_name!(), crate_version!(), ABOUT);
|
||||||
for encoding in ENCODINGS {
|
for encoding in ENCODINGS {
|
||||||
app = app.arg(Arg::with_name(encoding.0).long(encoding.0));
|
app = app.arg(Arg::with_name(encoding.0).long(encoding.0));
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ pub fn uu_app() -> App<'static, 'static> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_cmd_args(args: impl uucore::Args) -> (Config, Format) {
|
fn parse_cmd_args(args: impl uucore::Args) -> (Config, Format) {
|
||||||
let usage = get_usage();
|
let usage = usage();
|
||||||
let matches = uu_app().usage(&usage[..]).get_matches_from(
|
let matches = uu_app().usage(&usage[..]).get_matches_from(
|
||||||
args.collect_str(InvalidEncodingHandling::ConvertLossy)
|
args.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||||
.accept_any(),
|
.accept_any(),
|
||||||
|
@ -75,7 +75,7 @@ fn parse_cmd_args(args: impl uucore::Args) -> (Config, Format) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
let name = executable!();
|
let name = util_name!();
|
||||||
let (config, format) = parse_cmd_args(args);
|
let (config, format) = parse_cmd_args(args);
|
||||||
// Create a reference to stdin so we can return a locked stdin from
|
// Create a reference to stdin so we can return a locked stdin from
|
||||||
// parse_base_cmd_args
|
// parse_base_cmd_args
|
||||||
|
@ -88,7 +88,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
config.wrap_cols,
|
config.wrap_cols,
|
||||||
config.ignore_garbage,
|
config.ignore_garbage,
|
||||||
config.decode,
|
config.decode,
|
||||||
name,
|
&name,
|
||||||
);
|
);
|
||||||
|
|
||||||
0
|
0
|
||||||
|
|
|
@ -396,7 +396,7 @@ fn cat_files(files: Vec<String>, options: &OutputOptions) -> UResult<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
// each next line is expected to display "cat: …"
|
// each next line is expected to display "cat: …"
|
||||||
let line_joiner = format!("\n{}: ", executable!());
|
let line_joiner = format!("\n{}: ", util_name!());
|
||||||
|
|
||||||
Err(uucore::error::USimpleError::new(
|
Err(uucore::error::USimpleError::new(
|
||||||
error_messages.len() as i32,
|
error_messages.len() as i32,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#![allow(clippy::upper_case_acronyms)]
|
#![allow(clippy::upper_case_acronyms)]
|
||||||
|
|
||||||
use uucore::{executable, show_error, show_usage_error, show_warning};
|
use uucore::{execution_phrase, show_error, show_usage_error, show_warning, util_name};
|
||||||
|
|
||||||
use clap::{App, Arg};
|
use clap::{App, Arg};
|
||||||
use selinux::{OpaqueSecurityContext, SecurityContext};
|
use selinux::{OpaqueSecurityContext, SecurityContext};
|
||||||
|
@ -56,7 +56,7 @@ fn get_usage() -> String {
|
||||||
"{0} [OPTION]... CONTEXT FILE... \n \
|
"{0} [OPTION]... CONTEXT FILE... \n \
|
||||||
{0} [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE... \n \
|
{0} [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE... \n \
|
||||||
{0} [OPTION]... --reference=RFILE FILE...",
|
{0} [OPTION]... --reference=RFILE FILE...",
|
||||||
executable!()
|
execution_phrase!()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uu_app() -> App<'static, 'static> {
|
pub fn uu_app() -> App<'static, 'static> {
|
||||||
App::new(executable!())
|
App::new(util_name!())
|
||||||
.version(VERSION)
|
.version(VERSION)
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -563,7 +563,7 @@ fn process_file(
|
||||||
if options.verbose {
|
if options.verbose {
|
||||||
println!(
|
println!(
|
||||||
"{}: Changing security context of: {}",
|
"{}: Changing security context of: {}",
|
||||||
executable!(),
|
util_name!(),
|
||||||
file_full_name.to_string_lossy()
|
file_full_name.to_string_lossy()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1046,7 +1046,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uu_app() -> clap::App<'static, 'static> {
|
pub fn uu_app() -> clap::App<'static, 'static> {
|
||||||
clap::App::new(executable!())
|
clap::App::new(util_name!())
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
.arg(
|
.arg(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue