mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 04:27:45 +00:00
Check argc instead of settings exclusive flag
This commit is contained in:
parent
025a0dfa9e
commit
710e2af5fd
2 changed files with 12 additions and 4 deletions
|
@ -5,7 +5,7 @@
|
||||||
// * For the full copyright and license information, please view the LICENSE
|
// * For the full copyright and license information, please view the LICENSE
|
||||||
// * file that was distributed with this source code.
|
// * file that was distributed with this source code.
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
use std::io::Write;
|
use std::{ffi::OsString, io::Write};
|
||||||
use uucore::error::{set_exit_code, UResult};
|
use uucore::error::{set_exit_code, UResult};
|
||||||
|
|
||||||
static ABOUT: &str = "\
|
static ABOUT: &str = "\
|
||||||
|
@ -26,6 +26,11 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
// and unwind through the standard library allocation handling machinery.
|
// and unwind through the standard library allocation handling machinery.
|
||||||
set_exit_code(1);
|
set_exit_code(1);
|
||||||
|
|
||||||
|
let args: Vec<OsString> = args.collect();
|
||||||
|
if args.len() > 2 {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if let Err(e) = command.try_get_matches_from_mut(args) {
|
if let Err(e) = command.try_get_matches_from_mut(args) {
|
||||||
let error = match e.kind() {
|
let error = match e.kind() {
|
||||||
clap::ErrorKind::DisplayHelp => command.print_help(),
|
clap::ErrorKind::DisplayHelp => command.print_help(),
|
||||||
|
@ -56,7 +61,6 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
Arg::new("help")
|
Arg::new("help")
|
||||||
.long("help")
|
.long("help")
|
||||||
.help("Print help information")
|
.help("Print help information")
|
||||||
.exclusive(true)
|
|
||||||
.action(ArgAction::Help),
|
.action(ArgAction::Help),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// * For the full copyright and license information, please view the LICENSE
|
// * For the full copyright and license information, please view the LICENSE
|
||||||
// * file that was distributed with this source code.
|
// * file that was distributed with this source code.
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
use std::io::Write;
|
use std::{ffi::OsString, io::Write};
|
||||||
use uucore::error::{set_exit_code, UResult};
|
use uucore::error::{set_exit_code, UResult};
|
||||||
|
|
||||||
static ABOUT: &str = "\
|
static ABOUT: &str = "\
|
||||||
|
@ -20,6 +20,11 @@ operation causes the program to return `1` instead.
|
||||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let mut command = uu_app();
|
let mut command = uu_app();
|
||||||
|
|
||||||
|
let args: Vec<OsString> = args.collect();
|
||||||
|
if args.len() > 2 {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if let Err(e) = command.try_get_matches_from_mut(args) {
|
if let Err(e) = command.try_get_matches_from_mut(args) {
|
||||||
let error = match e.kind() {
|
let error = match e.kind() {
|
||||||
clap::ErrorKind::DisplayHelp => command.print_help(),
|
clap::ErrorKind::DisplayHelp => command.print_help(),
|
||||||
|
@ -53,7 +58,6 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
Arg::new("help")
|
Arg::new("help")
|
||||||
.long("help")
|
.long("help")
|
||||||
.help("Print help information")
|
.help("Print help information")
|
||||||
.exclusive(true)
|
|
||||||
.action(ArgAction::Help),
|
.action(ArgAction::Help),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue