mirror of
https://github.com/uutils/coreutils
synced 2024-11-15 01:17:09 +00:00
doc: add and change documentation of uucore (#6551)
This commit is contained in:
parent
39a38013dc
commit
aac09b8a8f
3 changed files with 11 additions and 9 deletions
|
@ -154,6 +154,7 @@ mod ut {
|
|||
pub use libc::USER_PROCESS;
|
||||
}
|
||||
|
||||
/// A login record
|
||||
pub struct Utmpx {
|
||||
inner: utmpx,
|
||||
}
|
||||
|
@ -213,6 +214,7 @@ impl Utmpx {
|
|||
pub fn into_inner(self) -> utmpx {
|
||||
self.inner
|
||||
}
|
||||
/// check if the record is a user process
|
||||
pub fn is_user_process(&self) -> bool {
|
||||
!self.user().is_empty() && self.record_type() == USER_PROCESS
|
||||
}
|
||||
|
|
|
@ -26,12 +26,12 @@
|
|||
//! Here's an overview of the macros sorted by purpose
|
||||
//!
|
||||
//! - Print errors
|
||||
//! - From types implementing [`crate::error::UError`]: [`show!`],
|
||||
//! [`show_if_err!`]
|
||||
//! - From custom messages: [`show_error!`]
|
||||
//! - Print warnings: [`show_warning!`]
|
||||
//! - From types implementing [`crate::error::UError`]: [`crate::show!`],
|
||||
//! [`crate::show_if_err!`]
|
||||
//! - From custom messages: [`crate::show_error!`]
|
||||
//! - Print warnings: [`crate::show_warning!`]
|
||||
//! - Terminate util execution
|
||||
//! - Crash program: [`crash!`], [`crash_if_err!`]
|
||||
//! - Crash program: [`crate::crash!`], [`crate::crash_if_err!`]
|
||||
|
||||
// spell-checker:ignore sourcepath targetpath rustdoc
|
||||
|
||||
|
@ -99,8 +99,8 @@ macro_rules! show(
|
|||
|
||||
/// Display an error and set global exit code in error case.
|
||||
///
|
||||
/// Wraps around [`show!`] and takes a [`crate::error::UResult`] instead of a
|
||||
/// [`crate::error::UError`] type. This macro invokes [`show!`] if the
|
||||
/// Wraps around [`crate::show!`] and takes a [`crate::error::UResult`] instead of a
|
||||
/// [`crate::error::UError`] type. This macro invokes [`crate::show!`] if the
|
||||
/// [`crate::error::UResult`] is an `Err`-variant. This can be invoked directly
|
||||
/// on the result of a function call, like in the `install` utility:
|
||||
///
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
//! * When `Err` is returned, the code corresponding with the error is used as exit code and the
|
||||
//! error message is displayed.
|
||||
//!
|
||||
//! Additionally, the errors can be displayed manually with the [`show`] and [`show_if_err`] macros:
|
||||
//! Additionally, the errors can be displayed manually with the [`crate::show`] and [`crate::show_if_err`] macros:
|
||||
//! ```ignore
|
||||
//! let res = Err(USimpleError::new(1, "Error!!"));
|
||||
//! show_if_err!(res);
|
||||
|
@ -41,7 +41,7 @@
|
|||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! **Note**: The [`show`] and [`show_if_err`] macros set the exit code of the program using
|
||||
//! **Note**: The [`crate::show`] and [`crate::show_if_err`] macros set the exit code of the program using
|
||||
//! [`set_exit_code`]. See the documentation on that function for more information.
|
||||
//!
|
||||
//! # Guidelines
|
||||
|
|
Loading…
Reference in a new issue