You've already forked uutils-args
mirror of
https://github.com/uutils/uutils-args.git
synced 2026-06-10 16:13:08 -07:00
move version_handling to help module
This commit is contained in:
@@ -314,17 +314,3 @@ fn argument_expression(arg: &Argument) -> TokenStream {
|
||||
_ => panic!("WWWOWOWOWOW"),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn version_handling(version_flags: &Flags) -> TokenStream {
|
||||
if version_flags.is_empty() {
|
||||
return quote!();
|
||||
}
|
||||
|
||||
let pat = version_flags.pat();
|
||||
|
||||
quote!(
|
||||
if let #pat = arg {
|
||||
return Ok(Some(Argument::Version));
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -162,3 +162,17 @@ fn read_help_file(file: &str) -> (TokenStream, TokenStream) {
|
||||
get_after_event(pulldown_cmark::Event::Rule, &contents),
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn version_handling(version_flags: &Flags) -> TokenStream {
|
||||
if version_flags.is_empty() {
|
||||
return quote!();
|
||||
}
|
||||
|
||||
let pat = version_flags.pat();
|
||||
|
||||
quote!(
|
||||
if let #pat = arg {
|
||||
return Ok(Some(Argument::Version));
|
||||
}
|
||||
)
|
||||
}
|
||||
+2
-4
@@ -6,11 +6,9 @@ mod help;
|
||||
mod markdown;
|
||||
|
||||
use action::{parse_action_attr, ActionAttr, ActionType};
|
||||
use argument::{
|
||||
long_handling, parse_argument, positional_handling, short_handling, version_handling,
|
||||
};
|
||||
use argument::{long_handling, parse_argument, positional_handling, short_handling};
|
||||
use attributes::ValueAttr;
|
||||
use help::{help_handling, help_string, parse_help_attr, parse_version_attr};
|
||||
use help::{help_handling, help_string, parse_help_attr, parse_version_attr, version_handling};
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use quote::quote;
|
||||
|
||||
Reference in New Issue
Block a user