Skip to content

Commit

Permalink
uucore: make help_{about,usage} fail if no text is found
Browse files Browse the repository at this point in the history
  • Loading branch information
tertsdiepraam committed Feb 6, 2024
1 parent 64cb591 commit 0b89a73
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/uucore_procs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ pub fn help_about(input: TokenStream) -> TokenStream {
let input: Vec<TokenTree> = input.into_iter().collect();
let filename = get_argument(&input, 0, "filename");
let text: String = uuhelp_parser::parse_about(&read_help(&filename));
if text.is_empty() {
panic!("About text not found! Make sure the markdown format is correct");
}
TokenTree::Literal(Literal::string(&text)).into()
}

Expand All @@ -77,6 +80,9 @@ pub fn help_usage(input: TokenStream) -> TokenStream {
let input: Vec<TokenTree> = input.into_iter().collect();
let filename = get_argument(&input, 0, "filename");
let text: String = uuhelp_parser::parse_usage(&read_help(&filename));
if text.is_empty() {
panic!("Usage text not found! Make sure the markdown format is correct");
}
TokenTree::Literal(Literal::string(&text)).into()
}

Expand Down

0 comments on commit 0b89a73

Please sign in to comment.