From d18ccc6a2a202caebfcddcc79b153a4bfb7af357 Mon Sep 17 00:00:00 2001 From: Masahito Osako <43847020+m11o@users.noreply.github.com> Date: Mon, 24 Apr 2023 15:01:28 +0900 Subject: [PATCH] runcon: move help strings to markdown file (#4774) --- src/uu/runcon/runcon.md | 18 ++++++++++++++++++ src/uu/runcon/src/runcon.rs | 17 ++++------------- 2 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 src/uu/runcon/runcon.md diff --git a/src/uu/runcon/runcon.md b/src/uu/runcon/runcon.md new file mode 100644 index 00000000000..1911c50447c --- /dev/null +++ b/src/uu/runcon/runcon.md @@ -0,0 +1,18 @@ +# runcon + +``` +runcon [CONTEXT COMMAND [ARG...]] +runcon [-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] COMMAND [ARG...]"; +``` + +Run command with specified security context under SELinux enabled systems. + +## After Help + +Run COMMAND with completely-specified CONTEXT, or with current or transitioned security context modified by one or more of LEVEL, ROLE, TYPE, and USER. + +If none of --compute, --type, --user, --role or --range is specified, then the first argument is used as the complete context. + +Note that only carefully-chosen contexts are likely to successfully run. + +With neither CONTEXT nor COMMAND are specified, then this prints the current security context. diff --git a/src/uu/runcon/src/runcon.rs b/src/uu/runcon/src/runcon.rs index 4ee3c6eba9a..a22bff47020 100644 --- a/src/uu/runcon/src/runcon.rs +++ b/src/uu/runcon/src/runcon.rs @@ -5,7 +5,7 @@ use uucore::error::{UResult, UUsageError}; use clap::{crate_version, Arg, ArgAction, Command}; use selinux::{OpaqueSecurityContext, SecurityClass, SecurityContext}; -use uucore::format_usage; +use uucore::{format_usage, help_about, help_section, help_usage}; use std::borrow::Cow; use std::ffi::{CStr, CString, OsStr, OsString}; @@ -18,18 +18,9 @@ mod errors; use errors::error_exit_status; use errors::{Error, Result, RunconError}; -const ABOUT: &str = "Run command with specified security context."; -const USAGE: &str = "\ - {} [CONTEXT COMMAND [ARG...]] - {} [-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] COMMAND [ARG...]"; -const DESCRIPTION: &str = "Run COMMAND with completely-specified CONTEXT, or with current or \ - transitioned security context modified by one or more of \ - LEVEL, ROLE, TYPE, and USER.\n\n\ - If none of --compute, --type, --user, --role or --range is specified, \ - then the first argument is used as the complete context.\n\n\ - Note that only carefully-chosen contexts are likely to successfully run.\n\n\ - With neither CONTEXT nor COMMAND are specified, \ - then this prints the current security context."; +const ABOUT: &str = help_about!("runcon.md"); +const USAGE: &str = help_usage!("runcon.md"); +const DESCRIPTION: &str = help_section!("after help", "runcon.md"); pub mod options { pub const COMPUTE: &str = "compute";