Skip to content

Commit

Permalink
Merge pull request #4562 from miles170/factor-move-help-strings-to-md…
Browse files Browse the repository at this point in the history
…-file

factor: move help strings to markdown file
  • Loading branch information
cakebaker authored Mar 21, 2023
2 parents b8f2f29 + 1d58362 commit 2a92e43
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/uu/factor/factor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# factor

```
factor [NUMBER]...
```

Print the prime factors of the given NUMBER(s).
If none are specified, read from standard input.
7 changes: 4 additions & 3 deletions src/uu/factor/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ use clap::{crate_version, Arg, ArgAction, Command};
pub use factor::*;
use uucore::display::Quotable;
use uucore::error::UResult;
use uucore::{show_error, show_warning};
use uucore::{format_usage, help_about, help_usage, show_error, show_warning};

mod miller_rabin;
pub mod numeric;
mod rho;
pub mod table;

static ABOUT: &str = r#"Print the prime factors of the given NUMBER(s).
If none are specified, read from standard input."#;
const ABOUT: &str = help_about!("factor.md");
const USAGE: &str = help_usage!("factor.md");

mod options {
pub static NUMBER: &str = "NUMBER";
Expand Down Expand Up @@ -84,6 +84,7 @@ pub fn uu_app() -> Command {
Command::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.override_usage(format_usage(USAGE))
.infer_long_args(true)
.arg(Arg::new(options::NUMBER).action(ArgAction::Append))
}

0 comments on commit 2a92e43

Please sign in to comment.