Skip to content

Commit

Permalink
Merge pull request #4805 from iambasanta/tr-move-help-strings-to-md-file
Browse files Browse the repository at this point in the history
tr: move help string to markdown file
  • Loading branch information
cakebaker authored Apr 30, 2023
2 parents e46b057 + 22490ae commit 599e7a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/uu/tr/src/tr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ use clap::{crate_version, Arg, ArgAction, Command};
use nom::AsBytes;
use operation::{translate_input, Sequence, SqueezeOperation, TranslateOperation};
use std::io::{stdin, stdout, BufReader, BufWriter};
use uucore::{format_usage, show};
use uucore::{format_usage, help_about, help_section, help_usage, show};

use crate::operation::DeleteOperation;
use uucore::display::Quotable;
use uucore::error::{UResult, USimpleError, UUsageError};

const ABOUT: &str = "Translate or delete characters";
const USAGE: &str = "{} [OPTION]... SET1 [SET2]";
const LONG_USAGE: &str = "\
Translate, squeeze, and/or delete characters from standard input, \
writing to standard output.";
const ABOUT: &str = help_about!("tr.md");
const AFTER_HELP: &str = help_section!("after help", "tr.md");
const USAGE: &str = help_usage!("tr.md");

mod options {
pub const COMPLEMENT: &str = "complement";
Expand All @@ -37,7 +35,7 @@ mod options {
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let args = args.collect_lossy();

let matches = uu_app().after_help(LONG_USAGE).try_get_matches_from(args)?;
let matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)?;

let delete_flag = matches.get_flag(options::DELETE);
let complement_flag = matches.get_flag(options::COMPLEMENT);
Expand Down
11 changes: 11 additions & 0 deletions src/uu/tr/tr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# tr

```
tr [OPTION]... SET1 [SET2]
```

Translate or delete characters

## After help

Translate, squeeze, and/or delete characters from standard input, writing to standard output.

0 comments on commit 599e7a0

Please sign in to comment.