mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 20:17:45 +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:
commit
5d9585a743
2 changed files with 11 additions and 3 deletions
7
src/uu/logname/logname.md
Normal file
7
src/uu/logname/logname.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# logname
|
||||||
|
|
||||||
|
```
|
||||||
|
logname
|
||||||
|
```
|
||||||
|
|
||||||
|
Print user's login name
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
use clap::{crate_version, Command};
|
use clap::{crate_version, Command};
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use uucore::{error::UResult, show_error};
|
use uucore::{error::UResult, format_usage, help_about, help_usage, show_error};
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// POSIX requires using getlogin (or equivalent code)
|
// 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]
|
#[uucore::main]
|
||||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
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 {
|
pub fn uu_app() -> Command {
|
||||||
Command::new(uucore::util_name())
|
Command::new(uucore::util_name())
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.override_usage(uucore::execution_phrase())
|
.override_usage(format_usage(USAGE))
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
.infer_long_args(true)
|
.infer_long_args(true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue