Merge pull request #2704 from thomasqueirozb/users_uresult

Users: use UResult | #[macro_use] refactor
This commit is contained in:
Sylvestre Ledru 2021-10-06 21:29:21 +02:00 committed by GitHub
commit ba53844b19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 5 additions and 62 deletions

View file

@ -6,9 +6,6 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
#[macro_use]
extern crate uucore;
use platform_info::*;
use clap::{crate_version, App};

View file

@ -5,9 +5,6 @@
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
#[macro_use]
extern crate uucore;
use std::io::{stdin, Read};
use clap::App;

View file

@ -6,9 +6,6 @@
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
#[macro_use]
extern crate uucore;
use uu_base32::base_common;
pub use uu_base32::uu_app;

View file

@ -8,9 +8,6 @@
//spell-checker:ignore (args) lsbf msbf
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use uu_base32::base_common::{self, Config, BASE_CMD_PARSE_ERROR};

View file

@ -12,8 +12,6 @@
#[cfg(unix)]
extern crate unix_socket;
#[macro_use]
extern crate uucore;
// last synced with: cat (GNU coreutils) 8.13
use clap::{crate_version, App, Arg};

View file

@ -7,8 +7,6 @@
// spell-checker:ignore (ToDO) COMFOLLOW Chowner RFILE RFILE's derefer dgid nonblank nonprint nonprinting
#[macro_use]
extern crate uucore;
use uucore::display::Quotable;
pub use uucore::entries;
use uucore::error::{FromIo, UResult, USimpleError};

View file

@ -7,8 +7,6 @@
// spell-checker:ignore (ToDO) COMFOLLOW Passwd RFILE RFILE's derefer dgid duid groupname
#[macro_use]
extern crate uucore;
use uucore::display::Quotable;
pub use uucore::entries::{self, Group, Locate, Passwd};
use uucore::perms::{chown_base, options, IfFrom};

View file

@ -6,8 +6,6 @@
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
#[macro_use]
extern crate uucore;
use uucore::error::UError;
use uucore::error::UResult;
#[cfg(unix)]

View file

@ -5,9 +5,6 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use std::path::Path;
use uucore::display::print_verbatim;

View file

@ -6,9 +6,6 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use std::io::{self, Write};
use std::iter::Peekable;

View file

@ -5,9 +5,6 @@
//* For the full copyright and license information, please view the LICENSE
//* file that was distributed with this source code.
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use uucore::error::{UResult, USimpleError};
use uucore::InvalidEncodingHandling;

View file

@ -5,9 +5,6 @@
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
#[macro_use]
extern crate uucore;
use clap::App;
use uucore::error::UResult;

View file

@ -7,9 +7,6 @@
// spell-checker:ignore (ToDO) gethostid
#[macro_use]
extern crate uucore;
use clap::{crate_version, App};
use libc::c_long;
use uucore::error::UResult;

View file

@ -7,9 +7,6 @@
// spell-checker:ignore (ToDO) MAKEWORD addrs hashset
#[macro_use]
extern crate uucore;
use std::collections::hash_set::HashSet;
use std::net::ToSocketAddrs;
use std::str;

View file

@ -8,9 +8,6 @@
// spell-checker:ignore (paths) GPGHome
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use uucore::display::{println_verbatim, Quotable};
use uucore::error::{FromIo, UError, UResult};

View file

@ -5,9 +5,6 @@
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use std::env;
use std::io;

View file

@ -5,9 +5,6 @@
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
#[macro_use]
extern crate uucore;
use std::thread;
use std::time::Duration;

View file

@ -5,9 +5,6 @@
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
#[macro_use]
extern crate uucore;
use clap::App;
use uucore::error::UResult;

View file

@ -7,9 +7,6 @@
/* last synced with: unlink (GNU coreutils) 8.21 */
#[macro_use]
extern crate uucore;
use std::fs::remove_file;
use std::path::Path;

View file

@ -11,8 +11,6 @@
use chrono::{Local, TimeZone, Utc};
use clap::{crate_version, App, Arg};
#[macro_use]
extern crate uucore;
// import crate time from utmpx
pub use uucore::libc;
use uucore::libc::time_t;

View file

@ -11,6 +11,7 @@
use std::path::Path;
use clap::{crate_version, App, Arg};
use uucore::error::UResult;
use uucore::utmpx::{self, Utmpx};
static ABOUT: &str = "Print the user names of users currently logged in to the current host";
@ -29,7 +30,8 @@ If FILE is not specified, use {}. /var/log/wtmp as FILE is common.",
)
}
pub fn uumain(args: impl uucore::Args) -> i32 {
#[uucore_procs::gen_uumain]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage();
let after_help = get_long_usage();
@ -59,7 +61,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
println!("{}", users.join(" "));
}
0
Ok(())
}
pub fn uu_app() -> App<'static, 'static> {

View file

@ -9,8 +9,6 @@
#[macro_use]
extern crate clap;
#[macro_use]
extern crate uucore;
use clap::App;

View file

@ -12,8 +12,6 @@ use std::io::{self, Write};
#[macro_use]
extern crate clap;
#[macro_use]
extern crate uucore;
use clap::{App, Arg};
use uucore::error::{UResult, USimpleError};

View file

@ -101,7 +101,7 @@ pub fn gen_uumain(_args: TokenStream, stream: TokenStream) -> TokenStream {
Err(e) => {
let s = format!("{}", e);
if s != "" {
show_error!("{}", s);
uucore::show_error!("{}", s);
}
if e.usage() {
eprintln!("Try '{} --help' for more information.", uucore::execution_phrase());