1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #4805 from iambasanta/tr-move-help-strings-to-md-file

tr: move help string to markdown file
This commit is contained in:
Daniel Hofstetter 2023-04-30 14:26:22 +02:00 committed by GitHub
commit 599e7a0645
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View file

@ -13,17 +13,15 @@ use clap::{crate_version, Arg, ArgAction, Command};
use nom::AsBytes; use nom::AsBytes;
use operation::{translate_input, Sequence, SqueezeOperation, TranslateOperation}; use operation::{translate_input, Sequence, SqueezeOperation, TranslateOperation};
use std::io::{stdin, stdout, BufReader, BufWriter}; 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 crate::operation::DeleteOperation;
use uucore::display::Quotable; use uucore::display::Quotable;
use uucore::error::{UResult, USimpleError, UUsageError}; use uucore::error::{UResult, USimpleError, UUsageError};
const ABOUT: &str = "Translate or delete characters"; const ABOUT: &str = help_about!("tr.md");
const USAGE: &str = "{} [OPTION]... SET1 [SET2]"; const AFTER_HELP: &str = help_section!("after help", "tr.md");
const LONG_USAGE: &str = "\ const USAGE: &str = help_usage!("tr.md");
Translate, squeeze, and/or delete characters from standard input, \
writing to standard output.";
mod options { mod options {
pub const COMPLEMENT: &str = "complement"; pub const COMPLEMENT: &str = "complement";
@ -37,7 +35,7 @@ mod options {
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let args = args.collect_lossy(); 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 delete_flag = matches.get_flag(options::DELETE);
let complement_flag = matches.get_flag(options::COMPLEMENT); let complement_flag = matches.get_flag(options::COMPLEMENT);

11
src/uu/tr/tr.md Normal file
View file

@ -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.