Skip to content

Commit

Permalink
runcon: move help strings to markdown file (#4774)
Browse files Browse the repository at this point in the history
  • Loading branch information
m11o authored Apr 24, 2023
1 parent 698bdf5 commit d18ccc6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
18 changes: 18 additions & 0 deletions src/uu/runcon/runcon.md
Original file line number Diff line number Diff line change
@@ -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.
17 changes: 4 additions & 13 deletions src/uu/runcon/src/runcon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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";
Expand Down

0 comments on commit d18ccc6

Please sign in to comment.