mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
bug(seq) - Allow 'seq 6 -1 0'
Was failing with ``` Found argument '-1' which wasn't expected, or isn't valid in this context ``` otherwise
This commit is contained in:
parent
dbc716546b
commit
469abf2427
2 changed files with 7 additions and 1 deletions
|
@ -8,7 +8,7 @@ extern crate clap;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate uucore;
|
extern crate uucore;
|
||||||
|
|
||||||
use clap::{App, Arg};
|
use clap::{App, AppSettings, Arg};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::io::{stdout, Write};
|
use std::io::{stdout, Write};
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ fn escape_sequences(s: &str) -> String {
|
||||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
let usage = get_usage();
|
let usage = get_usage();
|
||||||
let matches = App::new(executable!())
|
let matches = App::new(executable!())
|
||||||
|
.setting(AppSettings::AllowLeadingHyphen)
|
||||||
.version(VERSION)
|
.version(VERSION)
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
.usage(&usage[..])
|
.usage(&usage[..])
|
||||||
|
@ -84,6 +85,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
Arg::with_name(ARG_NUMBERS)
|
Arg::with_name(ARG_NUMBERS)
|
||||||
.multiple(true)
|
.multiple(true)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
|
.allow_hyphen_values(true)
|
||||||
.max_values(3),
|
.max_values(3),
|
||||||
)
|
)
|
||||||
.get_matches_from(args);
|
.get_matches_from(args);
|
||||||
|
|
|
@ -14,6 +14,10 @@ fn test_count_down() {
|
||||||
.args(&["--", "5", "-1", "1"])
|
.args(&["--", "5", "-1", "1"])
|
||||||
.run()
|
.run()
|
||||||
.stdout_is("5\n4\n3\n2\n1\n");
|
.stdout_is("5\n4\n3\n2\n1\n");
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["5", "-1", "1"])
|
||||||
|
.run()
|
||||||
|
.stdout_is("5\n4\n3\n2\n1\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue