mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
uucore: make help_{about,usage} fail if no text is found
This commit is contained in:
parent
64cb591e3b
commit
0b89a734b6
1 changed files with 6 additions and 0 deletions
|
@ -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()
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue