1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

Merge pull request #4587 from piotrkwiecinski/logname-move-string-to-md-file

logname: move help strings to markdown file
This commit is contained in:
Daniel Hofstetter 2023-03-23 13:43:12 +01:00 committed by GitHub
commit 5d9585a743
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -0,0 +1,7 @@
# logname
```
logname
```
Print user's login name

View file

@ -11,7 +11,7 @@
use clap::{crate_version, Command};
use std::ffi::CStr;
use uucore::{error::UResult, show_error};
use uucore::{error::UResult, format_usage, help_about, help_usage, show_error};
extern "C" {
// POSIX requires using getlogin (or equivalent code)
@ -29,7 +29,8 @@ fn get_userlogin() -> Option<String> {
}
}
static ABOUT: &str = "Print user's login name";
const ABOUT: &str = help_about!("logname.md");
const USAGE: &str = help_usage!("logname.md");
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
@ -48,7 +49,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command {
Command::new(uucore::util_name())
.version(crate_version!())
.override_usage(uucore::execution_phrase())
.override_usage(format_usage(USAGE))
.about(ABOUT)
.infer_long_args(true)
}