mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #4585 from piotrkwiecinski/id-move-string-to-md-file
id: move help strings to a markdown file
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# id
|
||||
|
||||
```
|
||||
id [OPTION]... [USER]...
|
||||
```
|
||||
|
||||
Print user and group information for each specified `USER`,
|
||||
or (when `USER` omitted) for the current user.
|
||||
|
||||
## After help
|
||||
|
||||
The id utility displays the user and group names and numeric IDs, of the
|
||||
calling process, to the standard output. If the real and effective IDs are
|
||||
different, both are displayed, otherwise only the real ID is displayed.
|
||||
|
||||
If a user (login name or user ID) is specified, the user and group IDs of
|
||||
that user are displayed. In this case, the real and effective IDs are
|
||||
assumed to be the same.
|
||||
+5
-16
@@ -45,7 +45,7 @@ use uucore::error::{set_exit_code, USimpleError};
|
||||
pub use uucore::libc;
|
||||
use uucore::libc::{getlogin, uid_t};
|
||||
use uucore::process::{getegid, geteuid, getgid, getuid};
|
||||
use uucore::{format_usage, show_error};
|
||||
use uucore::{format_usage, help_about, help_section, help_usage, show_error};
|
||||
|
||||
macro_rules! cstr2cow {
|
||||
($v:expr) => {
|
||||
@@ -53,9 +53,9 @@ macro_rules! cstr2cow {
|
||||
};
|
||||
}
|
||||
|
||||
static ABOUT: &str = "Print user and group information for each specified USER,
|
||||
or (when USER omitted) for the current user.";
|
||||
const USAGE: &str = "{} [OPTION]... [USER]...";
|
||||
const ABOUT: &str = help_about!("id.md");
|
||||
const USAGE: &str = help_usage!("id.md");
|
||||
const AFTER_HELP: &str = help_section!("after help", "id.md");
|
||||
|
||||
#[cfg(not(feature = "selinux"))]
|
||||
static CONTEXT_HELP_TEXT: &str = "print only the security context of the process (not enabled)";
|
||||
@@ -76,15 +76,6 @@ mod options {
|
||||
pub const ARG_USERS: &str = "USER";
|
||||
}
|
||||
|
||||
fn get_description() -> &'static str {
|
||||
"The id utility displays the user and group names and numeric IDs, of the \
|
||||
calling process, to the standard output. If the real and effective IDs are \
|
||||
different, both are displayed, otherwise only the real ID is displayed.\n\n\
|
||||
If a user (login name or user ID) is specified, the user and group IDs of \
|
||||
that user are displayed. In this case, the real and effective IDs are \
|
||||
assumed to be the same."
|
||||
}
|
||||
|
||||
struct Ids {
|
||||
uid: u32, // user id
|
||||
gid: u32, // group id
|
||||
@@ -121,9 +112,7 @@ struct State {
|
||||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let matches = uu_app()
|
||||
.after_help(get_description())
|
||||
.try_get_matches_from(args)?;
|
||||
let matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)?;
|
||||
|
||||
let users: Vec<String> = matches
|
||||
.get_many::<String>(options::ARG_USERS)
|
||||
|
||||
Reference in New Issue
Block a user