combu/
pub_macros.rs

1//! export macros for combu
2//! combuのためのエクスポート用マクロ集
3
4#[macro_export]
5/// Creates new Vector.
6macro_rules! v {
7	($($t:tt)*) => {
8		$crate::vector!($($t)*)
9	};
10}
11
12#[macro_export]
13/// Creates new Vector.
14macro_rules! vector {
15	(::<$ptype:ty>,$(,)*$($t:tt)*)=>{
16		$crate::vector!($($t)*;:$ptype)
17	};
18	(=>$ptype:ty,$(,)*$($t:tt)*)=>{
19		$crate::vector!($($t)*;=>$ptype)
20	};
21	(None$($(;)?$(::)?<$type:ty>)?) => {
22		$crate::Vector$(::<$type>)?(None)
23	};
24	(None$($(;)?::$type:ty)?) => {
25		$crate::Vector$(::<$type>)?(None)
26	};
27	(None$($(;)?:$type:ty)?) => {
28		$crate::Vector$(::<$type>)?(None)
29	};
30	($($(;)?:$type:ty)?) => {
31		$crate::Vector$(::<$type>)?(None)
32	};
33	($($(;)?$(::)?<$type:ty>$(,)?)?) => {
34		$crate::Vector$(::<$type>)?(None)
35	};
36	($elem:expr; $n:expr$(;:$type:ty)?)=>{
37		$crate::Vector$(::<$type>)?(Some(vec![$elem,$n]))
38	};
39	($elem:expr; $n:expr$(;$(::)?<$type:ty>)?)=>{
40		$crate::Vector$(::<$type>)?(Some(vec![$elem,$n]))
41	};
42	($elem:expr; $n:expr;$(=>$type:ty)?)=>{
43		$crate::Vector$(::<$type>)?(Some(vec![$elem.into(),$n]))
44	};
45	($($x:expr),+ $(,)*$(;:$type:ty)?)=>{
46		$crate::Vector$(::<$type>)?(Some(vec![$($x),+]))
47	};
48	($($x:expr),+ $(,)*$(;::$type:ty)?)=>{
49		$crate::Vector$(::<$type>)?(Some(vec![$($x),+]))
50	};
51	($($x:expr),+ $(,)*$(;$(::)?<$type:ty>)?)=>{
52		$crate::Vector$(::<$type>)?(Some(vec![$($x),+]))
53	};
54	($($x:expr),+ $(,)*;$(=>$type:ty)?)=>{
55		$crate::Vector$(::<$type>)?(Some(vec![$($x.into()),+]))
56	};
57}
58
59#[macro_export]
60/// Returns char from ident
61macro_rules! char {
62	(0) => {
63		'0'
64	};
65	(1) => {
66		'1'
67	};
68	(2) => {
69		'2'
70	};
71	(3) => {
72		'3'
73	};
74	(4) => {
75		'4'
76	};
77	(5) => {
78		'5'
79	};
80	(6) => {
81		'6'
82	};
83	(7) => {
84		'7'
85	};
86	(8) => {
87		'8'
88	};
89	(9) => {
90		'9'
91	};
92	(a) => {
93		'a'
94	};
95	(b) => {
96		'b'
97	};
98	(c) => {
99		'c'
100	};
101	(d) => {
102		'd'
103	};
104	(e) => {
105		'e'
106	};
107	(f) => {
108		'f'
109	};
110	(g) => {
111		'g'
112	};
113	(h) => {
114		'h'
115	};
116	(i) => {
117		'i'
118	};
119	(j) => {
120		'j'
121	};
122	(k) => {
123		'k'
124	};
125	(l) => {
126		'l'
127	};
128	(m) => {
129		'm'
130	};
131	(n) => {
132		'n'
133	};
134	(o) => {
135		'o'
136	};
137	(p) => {
138		'p'
139	};
140	(q) => {
141		'q'
142	};
143	(r) => {
144		'r'
145	};
146	(s) => {
147		's'
148	};
149	(t) => {
150		't'
151	};
152	(u) => {
153		'u'
154	};
155	(v) => {
156		'v'
157	};
158	(w) => {
159		'w'
160	};
161	(x) => {
162		'x'
163	};
164	(y) => {
165		'y'
166	};
167	(z) => {
168		'z'
169	};
170	(A) => {
171		'A'
172	};
173	(B) => {
174		'B'
175	};
176	(C) => {
177		'C'
178	};
179	(D) => {
180		'D'
181	};
182	(E) => {
183		'E'
184	};
185	(F) => {
186		'F'
187	};
188	(G) => {
189		'G'
190	};
191	(H) => {
192		'H'
193	};
194	(I) => {
195		'I'
196	};
197	(J) => {
198		'J'
199	};
200	(K) => {
201		'K'
202	};
203	(L) => {
204		'L'
205	};
206	(M) => {
207		'M'
208	};
209	(N) => {
210		'N'
211	};
212	(O) => {
213		'O'
214	};
215	(P) => {
216		'P'
217	};
218	(Q) => {
219		'Q'
220	};
221	(R) => {
222		'R'
223	};
224	(S) => {
225		'S'
226	};
227	(T) => {
228		'T'
229	};
230	(U) => {
231		'U'
232	};
233	(V) => {
234		'V'
235	};
236	(W) => {
237		'W'
238	};
239	(X) => {
240		'X'
241	};
242	(Y) => {
243		'Y'
244	};
245	(Z) => {
246		'Z'
247	};
248	(+)=>{
249		'+'
250	};
251	(*)=>{
252		'*'
253	};
254	(@)=>{
255		'@'
256	};
257	(%)=>{
258		'%'
259	};
260	(&)=>{
261		'&'
262	};
263	($)=>{
264		'$'
265	};
266	(#)=>{
267		'#'
268	};
269	(!)=>{
270		'!'
271	};
272	(-)=>{
273		'-'
274	};
275	(=)=>{
276		'='
277	};
278	(^)=>{
279		'^'
280	};
281	(~) => {
282		'~'
283	};
284	(|)=>{
285		'|'
286	};
287	(:) => {
288		':'
289	};
290	(;) => {
291		';'
292	};
293	(_) => {
294		'_'
295	};
296	(?) => {
297		'?'
298	};
299	(<) => {
300		'<'
301	};
302	(>) => {
303		'>'
304	};
305	(.) => {
306		'.'
307	};
308	(,) => {
309		','
310	};
311	($expr:expr)=>{
312		$expr
313	};
314}
315
316#[macro_export]
317/// Checks context macro.
318macro_rules! check {
319	(error)=>{
320		$crate::check_error!();
321	};
322	(error, $($t:tt)*)=>{
323		$crate::check_error!($($t)*);
324	};
325	(help, $cmd:ident, $ctx:ident)=>{
326		$crate::check!(help,$cmd,$ctx,$crate::command::presets::func::help_tablize_with_alias_dedup);
327	};
328	(help,$cmd:ident,$ctx:ident,$func:path)=>{
329		$crate::check!(help,$cmd,$ctx,{
330			println!("{}",$func(&$cmd,&$ctx));
331			return $crate::done!();
332		})
333	};
334	(license,$cmd:ident,$ctx:ident)=>{
335		$crate::check!(license,$cmd,$ctx,{
336			println!("{}",$cmd.license.output(&$cmd,&$ctx).unwrap());
337			return $crate::done!();
338		})
339	};
340	($member:ident,$cmd:ident,$ctx:ident) => {
341		$crate::check!($member,$cmd,$ctx,{
342			println!("{}",$cmd.$member);
343			return $crate::done!();
344		})
345	};
346	($member:ident,$cmd:ident,$ctx:ident,$func:path)=>{
347		$crate::check!($member,$cmd,$ctx,{
348			println!("{}",$func(&$cmd,&$ctx));
349			return $crate::done!()
350		})
351	};
352	($member:ident,$cmd:ident,$ctx:ident,{$($t:tt)*})=>{
353		if($ctx.is_flag_true(stringify!($member),&$cmd)){
354			$($t)*
355		}
356	};
357}
358
359#[macro_export]
360/// List check macro
361macro_rules! checks {
362	 ($cmd:ident,$ctx:ident,[$($ct:ident),*$(,)?]) => {
363		  $($crate::check!($ct,$cmd,$ctx);)*
364	 };
365	 ([$($ct:ident),*$(,)?],$cmd:ident,$ctx:ident)=>{
366		 $($crate::check!($ct,$cmd,$ctx);)*
367	 };
368}
369
370#[macro_export]
371/// Macro for parse error check
372macro_rules! check_error {
373	($ctx:ident)=>{
374		$crate::check_error!($ctx,{
375			println!("{}", $crate::parser::preset::gen_error_description(error_info));
376			return $crate::done!();
377		})
378	};
379	($cmd:ident,$ctx:ident)=>{
380		$crate::check_error!($cmd,$ctx,>error_info,{
381			println!("{}", $crate::parser::preset::gen_error_description(error_info));
382			println!("{}",$crate::command::presets::func::help_tablize_with_alias_dedup(&$cmd,&$ctx));
383			return $crate::done!();
384		})
385	};
386	($ctx:ident,{$($t:tt)*})=>{
387		$crate::check_error!($ctx,>error_info,{$($t)*})
388	};
389	($cmd:ident,$ctx:ident,{$($t:tt)*})=>{
390		$crate::check_error!($cmd,$ctx,>error_info,{$($t)*})
391	};
392	($ctx:ident, >$error_info:ident, {$($t:tt)*}) => {
393		if let Some($error_info) = $ctx.first_error() {
394			$($t)*
395		}
396	};
397	($cmd:ident, $ctx:ident,>$error_info:ident,{$($t:tt)*})=>{
398		if let Some($error_info) = $ctx.first_error(){
399			$($t)*
400		}
401	}
402}
403
404#[macro_export]
405/// Checks context has help flag. If the context has help flag, return ShowHelpRequest.
406macro_rules! check_help {
407	($($t:tt)*)=>{
408		$crate::check!(help,$($t)*);
409	}
410}
411
412#[macro_export]
413/// Checks context has version flag. If the context has help flag, show version and exit.
414macro_rules! check_version {
415	($context:ident,$current_command:ident) => {
416		$crate::check!(version, $context, $current_command)
417	};
418}
419
420#[macro_export]
421/// Checks context has authors flag. If the context has author flag, show authors and exit.
422macro_rules! check_authors {
423	($context:ident,$current_command:ident) => {
424		$crate::check!(authors, $context, $current_command)
425	};
426}
427
428#[macro_export]
429/// Gets license file path of crate from cargo.toml.
430macro_rules! crate_license_file {
431	() => {
432		env!("CARGO_PKG_LICENSE_FILE")
433	};
434}
435
436#[macro_export]
437/// Gets license of crate from cargo.toml.
438macro_rules! crate_license {
439	() => {
440		env!("CARGO_PKG_LICENSE")
441	};
442}
443
444#[macro_export]
445/// Gets license information from cargo.toml.
446macro_rules! include_license_file {
447	() => {
448		include_str!($crate: crate_license_file)
449	};
450}
451
452#[macro_export]
453/// Checks context has license flag. If the context has license flag, exec $license_func and return done.
454macro_rules! check_license {
455	($ctx:ident,$cmd:ident) => {
456		$crate::ckeck!(license, $ctx, $cmd)
457	};
458	($context:ident,$current_command:ident, $license_func:path) => {
459		$crate::check!(license, $context, $current_command, $license_func)
460	};
461}
462
463#[macro_export]
464/// Checks context has license flag. If the context has license flag, show authors and exit.
465macro_rules! check_copyright {
466	($context:ident,$current_command:ident) => {
467		$crate::check!(copyright, $context, $current_command);
468	};
469}
470
471#[macro_export]
472/// Checks context has values of the preset flags.
473macro_rules! check_preset_flags {
474	($cmd:ident$(,)?$ctx:ident$(,)?) => {
475		$crate::checks!($cmd, $ctx, [error, help, version, license, authors]);
476	};
477}
478
479#[macro_export]
480/// action_result type annotation
481macro_rules! action_result {
482	() => {
483		Result<$crate::ActionResult,$crate::ActionError>
484	};
485}
486
487#[macro_export]
488/// Simple Alias of Ok(Done)
489macro_rules! done {
490	() => {
491		Ok($crate::ActionResult::Done)
492	};
493}
494
495#[macro_export]
496/// alias of Ok(ActionResult::Result(cmd, ctx))
497macro_rules! result {
498	($cmd:expr, $ctx:expr) => {
499		Ok($crate::ActionResult::Result($cmd, $ctx))
500	};
501}
502
503#[macro_export]
504/// Gets crate name from cargo.toml.
505macro_rules! crate_name {
506	() => {
507		env!("CARGO_PKG_NAME")
508	};
509}
510
511#[macro_export]
512/// Gets crate's authors from cargo.toml.
513macro_rules! crate_authors {
514	() => {
515		env!("CARGO_PKG_AUTHORS")
516	};
517}
518
519#[macro_export]
520///Gets crate's version from cargo.toml.
521macro_rules! crate_version {
522	() => {
523		env!("CARGO_PKG_VERSION")
524	};
525}
526
527#[macro_export]
528///Gets crate's description from cargo.toml.
529macro_rules! crate_description {
530	() => {
531		env!("CARGO_PKG_DESCRIPTION")
532	};
533}
534
535#[macro_export]
536/// Macro for convinience to create root command.
537macro_rules! root_from_crate {
538	() => {
539		Command::with_base(
540			$crate::crate_name!(),
541			$crate::crate_authors!(),
542			$crate::crate_version!(),
543			$crate::crate_description!(),
544			None
545			),
546	};
547	($action:expr)=>{
548		Command::with_base(
549			$crate::crate_name!(),
550			$crate::crate_authors!(),
551			$crate::crate_version!(),
552			$crate::crate_description!(),
553			Some($action))
554	}
555}
556
557#[macro_export]
558/// Macro for preset root.
559macro_rules! preset_root {
560	() => {
561		$crate::command::presets::root_with_base(
562			$crate::crate_name!(),
563			$crate::crate_authors!(),
564			$crate::crate_version!(),
565			$crate::crate_description!(),
566			None
567			),
568	};
569	($action:expr)=>{
570		$crate::command::presets::root_with_base(
571			$crate::crate_name!(),
572			$crate::crate_authors!(),
573			$crate::crate_version!(),
574			$crate::crate_description!(),
575			Some($action))
576	}
577}
578
579#[macro_export]
580/// Preset for help request to parent command
581macro_rules! parent_help_request_action {
582	($func:ident) => {
583		|cmd, mut ctx| -> action_result!() {
584			let help_str = if ctx.args.is_empty() {
585				$func(&cmd, &ctx)
586			} else {
587				// argsを辿って対象のサブコマンドを特定
588				let mut tail_cmd = cmd;
589				for arg in &ctx.args {
590					match tail_cmd.take_sub(&arg) {
591						Some(sub) => {
592							ctx.routes.push(tail_cmd.name.clone());
593							ctx.common_flags.push(tail_cmd.c_flags);
594							tail_cmd = sub;
595						}
596						_ => {
597							// マッチしないものはとりあえず無視
598						}
599					}
600				}
601				$func(&tail_cmd, &ctx)
602			};
603			println!("{}", help_str);
604			$crate::done!()
605		}
606	};
607}
608
609#[macro_export]
610/// Preset for definition function that can use help request action
611macro_rules! define_parent_help_request_action {
612	($func_name:ident,$help_func:ident)=>{
613		$crate::define_parent_help_request_action!(name=>$func_name,help_func=>$help_func);
614	};
615	(name=>$func_name:ident, help_func=>$help_func:ident) => {
616		fn $func_name(cmd: $crate::Command, mut ctx: $crate::Context) -> action_result!() {
617			let help_str = if ctx.args.is_empty() {
618				$help_func(&cmd, &ctx)
619			} else {
620				// argsを辿って対象のサブコマンドを特定
621				let mut tail_cmd = cmd;
622				for arg in &ctx.args {
623					match tail_cmd.take_sub(&arg) {
624						Some(sub) => {
625							ctx.routes.push(tail_cmd.name.clone());
626							ctx.common_flags.push(tail_cmd.c_flags);
627							tail_cmd = sub;
628						}
629						_ => {
630							// マッチしないものはとりあえず無視
631						}
632					}
633				}
634				$help_func(&tail_cmd, &ctx)
635			};
636			println!("{}", help_str);
637			crate::done!()
638		}
639	};
640}
641
642#[macro_export]
643/// Preset of definition of help command action
644macro_rules! define_help_command_action {
645	($action_name:ident, $req_action_name:ident, $help_func:ident) => {
646		fn $action_name(mut cmd: $crate::Command, ctx: $crate::Context) -> action_result!() {
647			check_help!(cmd, ctx, $help_func);
648			cmd.action = Some($req_action_name);
649			Ok($crate::ActionResult::ParentActionRequest(cmd, ctx))
650		}
651		$crate::define_parent_help_request_action!($req_action_name, $help_func);
652	};
653}
654
655#[macro_export]
656/// preset of help command action
657macro_rules! help_command_action {
658	($func:ident) => {
659		|mut cmd, ctx| -> action_result!() {
660			$crate::check_help!(cmd, ctx, $func);
661			cmd.action = Some($crate::parent_help_request_action!($func));
662			Ok($crate::ActionResult::ParentActionRequest(cmd, ctx))
663		}
664	};
665}
666
667#[macro_export]
668/// Build helper for action
669macro_rules! action {
670	(check_preset_flags,{$($t:tt)*})=>{
671		$crate::action!(cmd,ctx,check_preset_flags,{$($t)*})
672	};
673	($cmd:ident,$ctx:ident,check_preset_flags,{$($t:tt)*}) => {
674		$crate::action!($cmd,$ctx,{
675			check_preset_flags!($cmd, $ctx);
676			$($t)*
677		})
678	};
679	($cmd:ident,$ctx:ident,[$ct:ident],{$($t:tt)*})=>{
680		$crate::action!($cmd,$ctx,core,{
681			$crate::check!($ct,$cmd,$ctx);
682			$($t)*
683		})
684	};
685	($cmd:ident,$ctx:ident,[$($ct:ident),*],{$($t:tt)*})=>{
686		$crate::action!($cmd,$ctx,core,{
687			$($crate::check!($ct,$cmd,$ctx);)*
688			$($t)*
689		})
690	};
691	($cmd:ident,$ctx:ident,s,{$($t:tt)*})=>{
692		$crate::action!($cmd,$ctx,{$($t)*})
693	};
694	($cmd:ident,$ctx:ident,base,{$($t:tt)*})=>{
695		$crate::action!($cmd,$ctx,{$($t)*})
696	};
697	($cmd:ident,$ctx:ident,{$($t:tt)*})=>{
698		$crate::action!($cmd,$ctx,core,{$($t)*})
699	};
700	($cmd:ident,$ctx:ident,core,{$($t:tt)*})=>{
701		|$cmd:Command, $ctx: Context|->action_result!(){
702			$($t)*
703		}
704	};
705	({$($t:tt)*})=>{
706		$crate::action(cmd,ctx,core,{$($t)*})
707	};
708	($($t:tt)*)=>{
709		$crate::action(cmd,ctx,core,{$($t)*})
710	}
711}
712
713#[macro_export]
714/// Build helper for action
715macro_rules! def_action_func {
716	($func_name:ident,$cmd:ident,$ctx:ident,check_preset_flags,{$($t:tt)*}) => {
717		$crate::def_action_func!($func_name,$cmd,$ctx,core,{
718			check_preset_flags!($cmd,$ctx);
719			$($t)*
720		})
721	};
722	($func_name:ident,$cmd:ident,$ctx:ident,[$ct:ident],{$($t:tt)*}) => {
723		$crate::def_action_func!($func_name,$cmd,$ctx,core,{
724			$crate::check!($ct,$cmd,$ctx);
725			$($t)*
726		});
727	};
728	($func_name:ident,$cmd:ident,$ctx:ident,[$($ct:ident),*],{$($t:tt)*}) => {
729		$crate::def_action_func!($func_name,$cmd,$ctx,core,{
730			$crate::checks!([$($ct),*],$cmd,$ctx);
731			$($t)*
732		});
733	};
734	($func_name:ident,$cmd:ident,$ctx:ident,core,{$($t:tt)*}) => {
735		fn $func_name($cmd:$crate::Command,$ctx:$crate::Context)->$crate::action_result!(){
736			$($t)*
737		}
738	};
739	($func_name:ident,$cmd:ident,$ctx:ident,base,{$($t:tt)*}) => {
740		$crate::def_action_func!($func_name,$cmd,$ctx,core,$($t)*)
741	};
742	($func_name:ident,$cmd:ident,$ctx:ident,core,$($t:tt)*) => {
743		$crate::def_action_func!($func_name,$cmd,$ctx,{$($t)*})
744	};
745	($func_name:ident,{$($t:tt)*})=>{
746		$crate::def_action_func($func_name,core,{$($t)*})
747	};
748	($func_name:ident,$type:ident,$($t:tt)*)=>{
749		$crate::def_action_func!($func_name,cmd,ctx,$type,$($t)*)
750	};
751	($func_name:ident,$($t:tt)*)=>{
752		$crate::def_action_func($func_name,core,{$($t)*})
753	};
754}
755
756#[macro_export]
757/// Default value for presets. (Alias)
758macro_rules! default_value {
759	($($t:tt)*) => {
760		$crate::default_val!($($t)*)
761	};
762}
763
764#[macro_export]
765/// Default value for presets.
766macro_rules! default_val {
767	(description$(.$ident:ident)+) => {
768		$crate::default_description!($($ident).+)
769	};
770	(name$(.$ident:ident)+) => {
771		$crate::default_name!($($ident).+)
772	};
773	(flag.$ident:ident.alias.short)=>{
774		$crate::default_flag_short_alias!($ident)
775	};
776	($ident:ident.flag.alias.short)=>{
777		$crate::default_flag_short_alias!($ident)
778	};
779	(flag.$ident:ident.short.alias)=>{
780		$crate::default_flag_short_alias!($ident)
781	};
782	($ident:ident.flag.short.alias)=>{
783		$crate::default_flag_short_alias!($ident)
784	};
785	(flag.$ident:ident.short_alias)=>{
786		$crate::default_flag_short_alias!($ident)
787	};
788	($ident:ident.flag.short_alias)=>{
789		$crate::default_flag_short_alias!($ident)
790	};
791	($ident:ident$(.$ident2:ident)+)=>{
792		$crate::default_val!([$ident]$(.$ident2)+)
793	};
794	([$($ident:ident).+].description) => {
795		$crate::default_description!($($ident).+)
796	};
797	([$($ident:ident).+].name) => {
798		$crate::default_name!($($ident).+)
799	};
800	([$($ident:ident).+].$ident2:ident$(.$ident3:ident)*)=>{
801		$crate::default_val!([$($ident).+.$ident2]$(.$ident3)*)
802	}
803}
804
805#[macro_export]
806/// Default name for presets
807macro_rules! default_name {
808	(flag.$ident:ident) => {
809		$crate::default_flag_name!($ident)
810	};
811	($ident:ident.flag) => {
812		$crate::default_flag_name!($ident)
813	};
814}
815
816#[macro_export]
817/// Default name for preset flags
818macro_rules! default_flag_name {
819	($ident:ident) => {
820		stringify!($ident)
821	};
822}
823
824#[macro_export]
825/// Default alias for preset flags
826macro_rules! default_flag_short_alias {
827	(help) => {
828		$crate::short_alias![h, '?']
829	};
830	(version) => {
831		$crate::short_alias![v]
832	};
833	(authors) => {
834		$crate::short_alias![A]
835	};
836	(license) => {
837		$crate::short_alias![L]
838	};
839	(copyright) => {
840		$crate::short_alias![C]
841	};
842	(yes) => {
843		$crate::short_alias![y]
844	};
845	(no) => {
846		$crate::short_alias![n]
847	};
848}
849
850#[macro_export]
851/// Default description for presets.
852macro_rules! default_description {
853	(flag.help) => {
854		"Prints help information"
855	};
856	(flag.version) => {
857		"Prints version information"
858	};
859	(flag.authors) => {
860		"Prints authors' information"
861	};
862	(flag.license) => {
863		"Prints license information"
864	};
865	(flag.copyright) => {
866		"Prints copyright information"
867	};
868	(flag.yes) => {
869		"Assumes as yes choosed in all prompts"
870	};
871	(flag.no) => {
872		"Assumes as no choosed in all prompts"
873	};
874	($ident:ident.flag) => {
875		$crate::default_description!(flag.$ident)
876	};
877}
878
879#[macro_export]
880#[doc(hidden)]
881// Preset flag base
882macro_rules! _preset_flag_constructor {
883	($ident:ident)=>{
884		$crate::_preset_flag_constructor!($ident,$crate::default_value!(flag.$ident.description))
885	};
886	($ident:ident,$description:literal)=>{
887		$crate::_preset_flag_constructor!($ident,->String::from($description))
888	};
889	($ident:ident,$description:expr)=>{
890		$crate::_preset_flag_constructor!($ident,->$description.into())
891	};
892	($ident:ident,->$description:expr) => {
893		Flag::with_all_field(
894			$crate::default_name!(flag.$ident).to_owned(),
895			$description,
896			$crate::default_value!(flag.$ident.short.alias),
897			$crate::vector![None;:String],
898			$crate::FlagType::Bool,
899			$crate::FlagValue::Bool(false)
900		)
901	};
902}
903
904#[macro_export]
905/// Macro for preset help flag.
906macro_rules! help_flag {
907	($($($description:tt)+)?)=>{
908		$crate::_preset_flag_constructor!(help$(,$($description)+)?)
909	};
910}
911
912#[macro_export]
913/// Macro for preset version flag.
914macro_rules! version_flag {
915	($($($description:tt)+)?)=>{
916		$crate::_preset_flag_constructor!(version$(,$($description)+)?)
917	};
918}
919
920#[macro_export]
921/// Macro for preset authors flag.
922macro_rules! authors_flag {
923	($($($description:tt)+)?)=>{
924		$crate::_preset_flag_constructor!(authors$(,$($description)+)?)
925	};
926}
927
928#[macro_export]
929/// Macro for preset license flag.
930macro_rules! license_flag {
931	($($($description:tt)+)?)=>{
932		$crate::_preset_flag_constructor!(license$(,$($description)+)?)
933	};
934}
935
936#[macro_export]
937/// Macro for preset yes flag.
938macro_rules! yes_flag {
939	($($($description:tt)+)?)=>{
940		$crate::_preset_flag_constructor!(yes$(,$($description)+)?)
941	};
942}
943
944#[macro_export]
945/// Macro for preset no flag.
946macro_rules! no_flag {
947	($($($description:tt)+)?)=>{
948		$crate::_preset_flag_constructor!(no$(,$($description)+)?)
949	};
950}
951
952#[macro_export]
953/// Macro for preset copyright flag.
954macro_rules! copyright_flag{
955	($($($description:tt)+)?)=>{
956		$crate::_preset_flag_constructor!(copyright$(,$($description)+)?)
957	};
958}
959
960#[macro_export]
961/// Wrap with option if argument is not None.
962macro_rules! option_wrap {
963	() => {
964		None
965	};
966	(None) => {
967		None
968	};
969	($($inner:tt)+) => {
970		Some($($inner)+)
971	};
972}
973
974#[macro_export]
975/// create cmd helper with full detail
976macro_rules! cmd {
977	($name:ident=>$t:tt)=>{
978		$crate::cmd!(stringify!($name)=>$t)
979	};
980	($name:ident=:$t:tt)=>{
981		$crate::cmd!(stringify!($name)=>$t)
982	};
983	($name:ident$sep:tt$t:tt)=>{
984		$crate::cmd!(stringify!($name)=>$t)
985	};
986	($name:literal$sep:tt$t:tt)=>{
987		$crate::cmd!(->$crate::string_from!($name)=>$t)
988	};
989	($name:ident$t:tt)=>{
990		$crate::cmd!($name=>$t)
991	};
992	($name:literal$t:tt)=>{
993		$crate::cmd!($name=>$t)
994	};
995	($name:expr=>{$($t:tt)*})=>{
996		$crate::cmd!($name=>[$($t)*])
997	};
998	($name:expr=>($($t:tt)*))=>{
999		$crate::cmd!($name=>[$($t)*])
1000	};
1001	($name:expr=>[$($t:tt)*])=>{
1002		$crate::cmd!(->$crate::string_from!($name)=>[$($t)*])
1003	};
1004	(->$name:expr=>{$($at:tt)*}[,$($t:tt)*])=>{
1005		$crate::cmd!(->$name=>{$($at)*}[$($t)*])
1006	};
1007	(->$name:expr=>{$($at:tt)*}[;$($t:tt)*])=>{
1008		$crate::cmd!(->$name=>{$($at)*}[$($t)*])
1009	};
1010	(->$name:expr=>{>,$($t:tt)+}[action->$($t2:tt)*])=>{
1011		$crate::cmd!(->$name=>{>,$($t)+}[>$($t2)*])
1012	};
1013	(->$name:expr=>{>,$($t:tt)+}[action=>$($t2:tt)*])=>{
1014		$crate::cmd!(->$name=>{>,$($t)+}[>$($t2)*])
1015	};
1016	(->$name:expr=>{>,$($t:tt)+}[action=$($t2:tt)*])=>{
1017		$crate::cmd!(->$name=>{>,$($t)+}[>$($t2)*])
1018	};
1019	(->$name:expr=>{>,$($t:tt)+}[action:$($t2:tt)*])=>{
1020		$crate::cmd!(->$name=>{>,$($t)+}[>$($t2)*])
1021	};
1022	(->$name:expr=>{>,$($t:tt)+}[>$(>)+$($t2:tt)*])=>{
1023		$crate::cmd!(->$name=>{>,$($t)+}[>$($t2)*])
1024	};
1025	(->$name:expr=>{$($t:tt)+}[authors:$($t2:tt)*])=>{
1026		$crate::cmd!(->$name=>{$($t)+}[<$($t2)*])
1027	};
1028	(->$name:expr=>{$($t:tt)+}[authors=$($t2:tt)*])=>{
1029		$crate::cmd!(->$name=>{$($t)+}[<$($t2)*])
1030	};
1031	(->$name:expr=>{$($t:tt)+}[copyright:$($t2:tt)*])=>{
1032		$crate::cmd!(->$name=>{$($t)+}[(c)$($t2)*])
1033	};
1034	(->$name:expr=>{$($t:tt)+}[copyright=$($t2:tt)*])=>{
1035		$crate::cmd!(->$name=>{$($t)+}[(c)$($t2)*])
1036	};
1037	(->$name:expr=>{$($t:tt)+}[license:$($t2:tt)*])=>{
1038		$crate::cmd!(->$name=>{$($t)+}[(l)$($t2)*])
1039	};
1040	(->$name:expr=>{$($t:tt)+}[license=$($t2:tt)*])=>{
1041		$crate::cmd!(->$name=>{$($t)+}[(l)$($t2)*])
1042	};
1043	(->$name:expr=>{$($t:tt)+}[description:$($t2:tt)*])=>{
1044		$crate::cmd!(->$name=>{$($t)+}[=$($t2)*])
1045	};
1046	(->$name:expr=>{$($t:tt)+}[description=$($t2:tt)*])=>{
1047		$crate::cmd!(->$name=>{$($t)+}[=$($t2)*])
1048	};
1049	(->$name:expr=>{$($t:tt)+}[usage:$($t2:tt)*])=>{
1050		$crate::cmd!(->$name=>{$($t)+}[:$($t2)*])
1051	};
1052	(->$name:expr=>{$($t:tt)+}[usage=$($t2:tt)*])=>{
1053		$crate::cmd!(->$name=>{$($t)+}[:$($t2)*])
1054	};
1055	(->$name:expr=>{$($t:tt)+}[#$($t2:tt)*])=>{
1056		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1057	};
1058	(->$name:expr=>{$($t:tt)+}[l:$($t2:tt)*])=>{
1059		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1060	};
1061	(->$name:expr=>{$($t:tt)+}[l=$($t2:tt)*])=>{
1062		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1063	};
1064	(->$name:expr=>{$($t:tt)+}[l+$($t2:tt)*])=>{
1065		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1066	};
1067	(->$name:expr=>{$($t:tt)+}[lf:$($t2:tt)*])=>{
1068		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1069	};
1070	(->$name:expr=>{$($t:tt)+}[l_flag:$($t2:tt)*])=>{
1071		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1072	};
1073	(->$name:expr=>{$($t:tt)+}[l_flag=$($t2:tt)*])=>{
1074		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1075	};
1076	(->$name:expr=>{$($t:tt)+}[l_flags:$($t2:tt)*])=>{
1077		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1078	};
1079	(->$name:expr=>{$($t:tt)+}[l_flags=$($t2:tt)*])=>{
1080		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1081	};
1082	(->$name:expr=>{$($t:tt)+}[local_flag:$($t2:tt)*])=>{
1083		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1084	};
1085	(->$name:expr=>{$($t:tt)+}[local_flag=$($t2:tt)*])=>{
1086		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1087	};
1088	(->$name:expr=>{$($t:tt)+}[local_flags:$($t2:tt)*])=>{
1089		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1090	};
1091	(->$name:expr=>{$($t:tt)+}[local_flags=$($t2:tt)*])=>{
1092		$crate::cmd!(->$name=>{$($t)+}[l~$($t2)*])
1093	};
1094	(->$name:expr=>{$($t:tt)+}[c=$($t2:tt)*])=>{
1095		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1096	};
1097	(->$name:expr=>{$($t:tt)+}[c:$($t2:tt)*])=>{
1098		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1099	};
1100	(->$name:expr=>{$($t:tt)+}[c+$($t2:tt)*])=>{
1101		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1102	};
1103	(->$name:expr=>{$($t:tt)+}[cf:$($t2:tt)*])=>{
1104		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1105	};
1106	(->$name:expr=>{$($t:tt)+}[c_flag:$($t2:tt)*])=>{
1107		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1108	};
1109	(->$name:expr=>{$($t:tt)+}[c_flag=$($t2:tt)*])=>{
1110		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1111	};
1112	(->$name:expr=>{$($t:tt)+}[c_flags:$($t2:tt)*])=>{
1113		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1114	};
1115	(->$name:expr=>{$($t:tt)+}[c_flags=$($t2:tt)*])=>{
1116		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1117	};
1118	(->$name:expr=>{$($t:tt)+}[common_flag:$($t2:tt)*])=>{
1119		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1120	};
1121	(->$name:expr=>{$($t:tt)+}[common_flag=$($t2:tt)*])=>{
1122		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1123	};
1124	(->$name:expr=>{$($t:tt)+}[common_flags:$($t2:tt)*])=>{
1125		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1126	};
1127	(->$name:expr=>{$($t:tt)+}[common_flags=$($t2:tt)*])=>{
1128		$crate::cmd!(->$name=>{$($t)+}[c~$($t2)*])
1129	};
1130	(->$name:expr=>{$($t:tt)+}[alias:$($t2:tt)*])=>{
1131		$crate::cmd!(->$name=>{$($t)+}[&$($t2)*])
1132	};
1133	(->$name:expr=>{$($t:tt)+}[alias=$($t2:tt)*])=>{
1134		$crate::cmd!(->$name=>{$($t)+}[&$($t2)*])
1135	};
1136	(->$name:expr=>{$($t:tt)+}[version:$($t2:tt)*])=>{
1137		$crate::cmd!(->$name=>{$($t)+}[n$($t2)*])
1138	};
1139	(->$name:expr=>{$($t:tt)+}[version=$($t2:tt)*])=>{
1140		$crate::cmd!(->$name=>{$($t)+}[n$($t2)*])
1141	};
1142	(->$name:expr=>{$($t:tt)+}[ver:$($t2:tt)*])=>{
1143		$crate::cmd!(->$name=>{$($t)+}[n$($t2)*])
1144	};
1145	(->$name:expr=>{$($t:tt)+}[ver=$($t2:tt)*])=>{
1146		$crate::cmd!(->$name=>{$($t)+}[n$($t2)*])
1147	};
1148	(->$name:expr=>{$($t:tt)+}[v:$($t2:tt)*])=>{
1149		$crate::cmd!(->$name=>{$($t)+}[n$($t2)*])
1150	};
1151	(->$name:expr=>{$($t:tt)+}[v=$($t2:tt)*])=>{
1152		$crate::cmd!(->$name=>{$($t)+}[n$($t2)*])
1153	};
1154	(->$name:expr=>{$($t:tt)+}[n:$($t2:tt)*])=>{
1155		$crate::cmd!(->$name=>{$($t)+}[n$($t2)*])
1156	};
1157	(->$name:expr=>{$($t:tt)+}[n=$($t2:tt)*])=>{
1158		$crate::cmd!(->$name=>{$($t)+}[n$($t2)*])
1159	};
1160	(->$name:expr=>{$($t:tt)+}[|=>$($t2:tt)*])=>{
1161		$crate::cmd!(->$name=>{$($t)+}[+$($t2)*])
1162	};
1163	(->$name:expr=>{$($t:tt)+}[|=$($t2:tt)*])=>{
1164		$crate::cmd!(->$name=>{$($t)+}[+$($t2)*])
1165	};
1166	(->$name:expr=>{$($t:tt)+}[|$($t2:tt)*])=>{
1167		$crate::cmd!(->$name=>{$($t)+}[+$($t2)*])
1168	};
1169	(->$name:expr=>{$($t:tt)+}[sub:$($t2:tt)*])=>{
1170		$crate::cmd!(->$name=>{$($t)+}[+$($t2)*])
1171	};
1172	(->$name:expr=>{$($t:tt)+}[sub=$($t2:tt)*])=>{
1173		$crate::cmd!(->$name=>{$($t)+}[+$($t2)*])
1174	};
1175	(->$name:expr=>[>>$(>)*$action:expr$(,$($t:tt)*)?])=>{
1176		$crate::cmd!(->$name=>{>,<,@,@,=,:,l~,c~,&,n,+}[>$action$(,$($t)*)?])
1177	};
1178	(->$name:expr=>[->$action:expr$(,$($t:tt)*)?])=>{
1179		$crate::cmd!(->$name=>{>,<,@,@,=,:,l~,c~,&,n,+}[>$action$(,$($t)*)?])
1180	};
1181	(->$name:expr=>[=>$action:expr$(,$($t:tt)*)?])=>{
1182		$crate::cmd!(->$name=>{>,<,@,@,=,:,l~,c~,&,n,+}[>$action$(,$($t)*)?])
1183	};
1184	(->$name:expr=>[>$action:expr,<$authors:literal$(,$($t:tt)*)?])=>{
1185		$crate::cmd!(->$name=>{>,<,@,@,=,:,l~,c~,&,n,+}[>$action,<$authors$(,$($t)*)?])
1186	};
1187	(->$name:expr=>{>,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1188	[$(>)?|$c:ident$(:Context)?,$cmd:ident$(:Command)?|$(->$crate::action_result!())?$(->$r:ty)?{$($c2:tt)*}$($t:tt)*])=>{
1189		$crate::cmd!(->$name=>{>[|$c:Context,$cmd:Command|->$crate::action_result!(){$($c2)*}],<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1190		[$($t)*])
1191	};
1192	(->$name:expr=>{>,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1193	[$(>)?$action:ident$($t:tt)*])=>{
1194		$crate::cmd!(->$name=>{>[$action],<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1195		[$($t)*])
1196	};
1197	(->$name:expr=>{>,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1198	[$(>)?$action:expr$(,$($t:tt)*)?])=>{
1199		$crate::cmd!(->$name=>{>[$action],<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1200		[$($($t)*)?])
1201	};
1202	(->$name:expr=>{>,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1203	[$(>)?$action:expr$(;$($t:tt)*)?])=>{
1204		$crate::cmd!(->$name=>{>[$action],<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1205		[$($($t)*)?])
1206	};
1207	(->$name:expr=>{>$([$($action:tt)*])?,<,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1208	[<...$(,$($t:tt)*)?])=>{
1209		$crate::cmd!(->$name=>{>$([$($action)*])?,<[$crate::crate_authors!()],@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1210		[$($($t)*)?])
1211	};
1212	(->$name:expr=>{>$([$($action:tt)*])?,<,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1213	[<$(,$($t:tt)*)?])=>{
1214		$crate::cmd!(->$name=>{>$([$($action)*])?,<[$crate::crate_authors!()],@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1215		[$($($t)*)?])
1216	};
1217	(->$name:expr=>{>$([$($action:tt)*])?,<,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1218	[<fc$(,$($t:tt)*)?])=>{
1219		$crate::cmd!(->$name=>{>$([$($action)*])?,<[$crate::crate_authors!()],@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1220		[$($($t)*)?])
1221	};
1222	(->$name:expr=>{>$([$($action:tt)*])?,<,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1223	[<from_crate$(,$($t:tt)*)?])=>{
1224		$crate::cmd!(->$name=>{>$([$($action)*])?,<[$crate::crate_authors!()],@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1225		[$($($t)*)?])
1226	};
1227	(->$name:expr=>{>$([$($action:tt)*])?,<,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1228	[<$authors:literal$(,$($t:tt)*)?])=>{
1229		$crate::cmd!(->$name=>{>$([$($action)*])?,<[$authors],@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1230		[$($($t)*)?])
1231	};
1232	(->$name:expr=>{>$([$($action:tt)*])?,<,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1233	[<[$($authors:tt)*]$(,$($t:tt)*)?])=>{
1234		$crate::cmd!(->$name=>{>$([$($action)*])?,<[$($authors)*],@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1235		[$($($t)*)?])
1236	};
1237	(->$name:expr=>{>$([$($action:tt)*])?,<,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1238	[<$authors:expr$(,$($t:tt)*)?])=>{
1239		$crate::cmd!(->$name=>{>$([$($action)*])?,<[$authors],@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1240		[$($($t)*)?])
1241	};
1242	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1243	[@$($t:tt)*])=>{
1244		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1245		[(c)$($t)*])
1246	};
1247	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1248	[(c)$($copyright:literal),+$(;$($t:tt)*)?])=>{
1249		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright),+],@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1250		[$($($t)*)?])
1251	};
1252	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1253	[(c)from_crate$(,$($t:tt)*)?])=>{
1254		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[from_crate],@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1255		[$($($t)*)?])
1256	};
1257	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1258	[(c)$year:literal$(,)?from_crate$(,$($t:tt)*)?])=>{
1259		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$year,from_crate],@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1260		[$($($t)*)?])
1261	};
1262	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1263	[(c)$($year:literal)?$(,)?...$(,$($t:tt)*)?])=>{
1264		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($year,)?...],@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1265		[$($($t)*)?])
1266	};
1267	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1268	[(c)$($copyright:literal)+$(,$($t:tt)*)?])=>{
1269		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright),+],@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1270		[$($($t)*)?])
1271	};
1272	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1273	[(c)$copyright:literal$(,$($t:tt)*)?])=>{
1274		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$copyright],@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1275		[$($($t)*)?])
1276	};
1277	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1278	[(c)[$($copyright:tt)*]$(,$($t:tt)*)?])=>{
1279		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1280		[$($($t)*)?])
1281	};
1282	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1283	[@$($t:tt)*])=>{
1284		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1285		[(l)$($t)*])
1286	};
1287	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1288	[(l)[$($license:tt)*]$($t:tt)*])=>{
1289		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@[$($license)*],=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1290		[$($t)*])
1291	};
1292	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1293	[(l)$lexpr:literal$(,)?$(->)?$lcontent:literal$($t:tt)*])=>{
1294		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@[$lexpr,->$lcontent],=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1295		[$($t)*])
1296	};
1297	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1298	[(l)$lexpr:expr,$(->)?$lcontent:literal$($t:tt)*])=>{
1299		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@[$lexpr,->$lcontent],=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1300		[$($t)*])
1301	};
1302	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1303	[(l)$lexpr:literal,->$lcontent:expr$(,$t:tt)*])=>{
1304		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@[$lexpr,->$lcontent],=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1305		[$($t)*])
1306	};
1307	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1308	[(l)$lexpr:literal,->$lcontent:expr$(;$t:tt)*])=>{
1309		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@[$lexpr,->$lcontent],=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1310		[$($t)*])
1311	};
1312	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1313	[(l)$lexpr:literal$(,)?$(fp)?:$lfile:expr$(,$t:tt)*])=>{
1314		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@[$lexpr,:$lfile],=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1315		[$($t)*])
1316	};
1317	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1318	[(l)$lexpr:literal,$lcontent:expr$(;$t:tt)*])=>{
1319		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@[$lexpr,:$lfile],=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1320		[$($t)*])
1321	};
1322	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1323	[(l)$lexpr:literal,$lcontent:expr$(,$t:tt)*])=>{
1324		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@[$lexpr,$lcontent],=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1325		[$($t)*])
1326	};
1327	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1328	[(l)$lexpr:literal,$lcontent:expr$(;$t:tt)*])=>{
1329		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@[$lexpr,$lcontent],=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1330		[$($t)*])
1331	};
1332	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1333	[(l)$lexpr:literal $lcontent:expr$(;$t:tt)*])=>{
1334		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@[$lexpr,$lcontent],=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1335		[$($t)*])
1336	};
1337	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@[$($copyright:tt)*],@,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1338	[(l)$license:expr$(,$($t:tt)*)?])=>{
1339		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@[$($copyright)*],@[->$license],=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1340		[$($($t)*)?])
1341	};
1342	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1343	[=$description:literal$($t:tt)*])=>{
1344		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=[$description],:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1345		[$($t)*])
1346	};
1347	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1348	[=[$($description:tt)*]$($t:tt)*])=>{
1349		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=[$($description)*],:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1350		[$($t)*])
1351	};
1352	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1353	[:$usage:ident$(,$($t:tt)*)?])=>{
1354		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:[$usage],l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1355		[$($($t)*)?])
1356	};
1357	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1358	[:$usage:literal$($t:tt)*])=>{
1359		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:[$usage],l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1360		[$($t)*])
1361	};
1362	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1363	[:[$($usage:tt)*]$($t:tt)*])=>{
1364		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:[$($usage)*],l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1365		[$($t)*])
1366	};
1367	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1368	[:$usage:expr$(,$($t:tt)*)?])=>{
1369		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:[->$usage],l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1370		[$($($t)*)?])
1371	};
1372	(->$name:expr=>{$($args:tt)+}
1373	[l~{$($lf:tt)*}$($t:tt)*])=>{
1374		$crate::cmd!(->$name=>{$($args)+}
1375		[l~[$($lf)*]$($t)*])
1376	};
1377	(->$name:expr=>{$($args:tt)+}
1378	[l~($($lf:tt)*)$($t:tt)*])=>{
1379		$crate::cmd!(->$name=>{$($args)+}
1380		[l~[$($lf)*]$($t)*])
1381	};
1382	(->$name:expr=>{>$($args:tt)+}
1383	[l~,$($t:tt)*])=>{
1384		$crate::cmd!(->$name=>{>$($args)+}[l~[],$($t)*])
1385	};
1386	(->$name:expr=>{>$($args:tt)+}
1387	[l~None$($t:tt)*])=>{
1388		$crate::cmd!(->$name=>{>$($args)+}[l~[]$($t)*])
1389	};
1390	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1391	[l~[$($lf:tt)*]$($t:tt)*])=>{
1392		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~[$($($l_flags)*)?$($lf)*],c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1393		[$($t)*])
1394	};
1395	(->$name:expr=>{>$($args:tt)+}
1396	[c~{$($cf:tt)*}$($t:tt)*])=>{
1397		$crate::cmd!(->$name=>{>$($args)+}
1398		[c~[$($cf)*]$($t)*])
1399	};
1400	(->$name:expr=>{>$($args:tt)+}
1401	[c~($($cf:tt)*)$($t:tt)*])=>{
1402		$crate::cmd!(->$name=>{>$($args)+}
1403		[c~[$($cf)*]$($t)*])
1404	};
1405	(->$name:expr=>{>$($args:tt)+}
1406	[c~,$($t:tt)*])=>{
1407		$crate::cmd!(->$name=>{>$($args)+}[c~[],$($t)*])
1408	};
1409	(->$name:expr=>{>$($args:tt)+}
1410	[c~None$($t:tt)*])=>{
1411		$crate::cmd!(->$name=>{>$($args)+}[c~[]$($t)*])
1412	};
1413	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1414	[c~[$($cf:tt)*]$($t:tt)*])=>{
1415		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~[$($($c_flags)*)?$($cf)*],&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1416		[$($t)*])
1417	};
1418	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1419	[c~Vector$b:tt$(,$($t:tt)*)?])=>{
1420		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~[->Vector$b],&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1421		[$($($t)*)?])
1422	};
1423	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1424	[c~$macro:ident!$b:tt$(,$($t:tt)*)?])=>{
1425		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~[->$macro!$b],&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1426		[$($($t)*)?])
1427	};
1428
1429	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1430	[l~Vector$b:tt$(,$($t:tt)*)?])=>{
1431		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~[->Vector$b],c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1432		[$($($t)*)?])
1433	};
1434	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1435	[l~$macro:ident!$b:tt$(,$($t:tt)*)?])=>{
1436		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~[->$macro!$b],c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1437		[$($($t)*)?])
1438	};
1439	(->$name:expr=>{$($args:tt)+}[l~$fn:tt$fa:tt$(;$($t:tt)*)?])=>{
1440			$crate::cmd!(->$name=>{$($args)+}[l~[$fn$fa]$(,$($t)*)?])
1441		};
1442	(->$name:expr=>{$($args:tt)+}[l~$fn:tt$sep:tt$fa:tt$(;$($t:tt)*)?])=>{
1443		$crate::cmd!(->$name=>{$($args)+}[l~[$fn$sep$fa]$(,$($t)*)?])
1444	};
1445	(->$name:expr=>{$($args:tt)+}[l~$fn:tt$fa:tt$(,$($t:tt)*)?])=>{
1446		$crate::cmd!(->$name=>{$($args)+}[l~[$fn$fa]$(,$($t)*)?])
1447	};
1448	(->$name:expr=>{$($args:tt)+}[l~$fn:tt$sep:tt$fa:tt$(,$($t:tt)*)?])=>{
1449		$crate::cmd!(->$name=>{$($args)+}[l~[$fn$sep$fa]$(,$($t)*)?])
1450	};
1451	(->$name:expr=>{$($args:tt)+}[c~$fn:tt$fa:tt$(;$($t:tt)*)?])=>{
1452			$crate::cmd!(->$name=>{$($args)+}[c~[$fn$fa]$(,$($t)*)?])
1453		};
1454	(->$name:expr=>{$($args:tt)+}[c~$fn:tt$sep:tt$fa:tt$(;$($t:tt)*)?])=>{
1455		$crate::cmd!(->$name=>{$($args)+}[c~[$fn$sep$fa]$(,$($t)*)?])
1456	};
1457	(->$name:expr=>{$($args:tt)+}[c~$fn:tt$fa:tt$(,$($t:tt)*)?])=>{
1458		$crate::cmd!(->$name=>{$($args)+}[c~[$fn$fa]$(,$($t)*)?])
1459	};
1460	(->$name:expr=>{$($args:tt)+}[c~$fn:tt$sep:tt$fa:tt$(,$($t:tt)*)?])=>{
1461		$crate::cmd!(->$name=>{$($args)+}[c~[$fn$sep$fa]$(,$($t)*)?])
1462	};
1463	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1464	[c~$c_flags:expr$(,$($t:tt)*)?])=>{
1465		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~[->$c_flags],&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1466		[$($($t)*)?])
1467	};
1468	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1469	[l~$l_flags:expr$(,$($t:tt)*)?])=>{
1470		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~[->$l_flags],c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+$([$($sub)*])?}
1471		[$($($t)*)?])
1472	};
1473	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1474	[&$(None)?$(,$($t:tt)*)?])=>{
1475		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?],n$([$($version)*])?,+$([$($sub)*])?}
1476		[$($($t)*)?])
1477	};
1478	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1479	[&[$($alias:tt)*]$(,$($t:tt)*)?])=>{
1480		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?$($alias)*],n$([$($version)*])?,+$([$($sub)*])?}
1481		[$($($t)*)?])
1482	};
1483	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1484	[&Vector$vt:tt$($t:tt)*])=>{
1485		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[->Vector$vt],n$([$($version)*])?,+$([$($sub)*])?}
1486		[$($t)*])
1487	};
1488	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1489	[&vector!$vt:tt$($t:tt)*])=>{
1490		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[->vector!$vt],n$([$($version)*])?,+$([$($sub)*])?}
1491		[$($t)*])
1492	};
1493	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1494	[&$alias:ident$(,)?n $($t:tt)*])=>{
1495		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?$alias,],n$([$($version)*])?,+$([$($sub)*])?}
1496		[n$($t)*])
1497	};
1498	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1499	[&$alias:ident$(,)?$i:ident:$($t:tt)*])=>{
1500		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?$alias,],n$([$($version)*])?,+$([$($sub)*])?}
1501		[$i:$($t)*])
1502	};
1503	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1504	[&$alias:ident$(,)?$i:ident=$($t:tt)*])=>{
1505		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?$alias,],n$([$($version)*])?,+$([$($sub)*])?}
1506		[$i=$($t)*])
1507	};
1508	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1509	[&$alias:ident$(,)?$next_alias:ident$($t:tt)*])=>{
1510		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?$alias,],n$([$($version)*])?,+$([$($sub)*])?}
1511		[&$next_alias$($t)*])
1512	};
1513	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1514	[&$alias:literal$(,)?n$($t:tt)*])=>{
1515		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?$alias,],n$([$($version)*])?,+$([$($sub)*])?}
1516		[n$($t)*])
1517	};
1518	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1519	[&$alias:literal$(,)?$next_alias:ident$($t:tt)*])=>{
1520		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?$alias,],n$([$($version)*])?,+$([$($sub)*])?}
1521		[&$next_alias$($t)*])
1522	};
1523	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1524	[&$alias:ident$(,)?$next_alias:literal$($t:tt)*])=>{
1525		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?$alias,],n$([$($version)*])?,+$([$($sub)*])?}
1526		[&$next_alias$($t)*])
1527	};
1528	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1529	[&$alias:literal$(,)?$next_alias:literal$($t:tt)*])=>{
1530		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?$alias,],n$([$($version)*])?,+$([$($sub)*])?}
1531		[&$next_alias$($t)*])
1532	};
1533	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1534	[&$alias:ident$($t:tt)*])=>{
1535		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?$alias,],n$([$($version)*])?,+$([$($sub)*])?}
1536		[$($t)*])
1537	};
1538	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($at:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1539	[&$alias:literal$($t:tt)*])=>{
1540		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[$($($at)*)?$alias,],n$([$($version)*])?,+$([$($sub)*])?}
1541		[$($t)*])
1542	};
1543	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1544	[&$alias:expr$(,$($t:tt)*)?])=>{
1545		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&[->$alias],n$([$($version)*])?,+$([$($sub)*])?}
1546		[$($($t)*)?])
1547	};
1548	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n,+$([$($sub:tt)*])?}
1549	[n $(,$($t:tt)*)?])=>{
1550		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n[from_crate],+$([$($sub:tt)*])?}
1551		[$($($t)*)?])
1552	};
1553	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n,+$([$($sub:tt)*])?}
1554	[n from_crate$($t:tt)*])=>{
1555		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n[from_crate],+$([$($sub:tt)*])?}
1556		[$($($t)*)?])
1557	};
1558	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n,+$([$($sub:tt)*])?}
1559	[n ...$($t:tt)*])=>{
1560		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n[...],+$([$($sub:tt)*])?}
1561		[$($($t)*)?])
1562	};
1563	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n,+$([$($sub:tt)*])?}
1564	[n $major:literal$(,)?$minor:literal$(,)?$patch:literal $($vt:literal)*$($t:tt)*])=>{
1565		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n[$major $minor $patch $($vt)*],+$([$($sub:tt)*])?}
1566		[$($t)*])
1567	};
1568	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n,+$([$($sub:tt)*])?}
1569	[n $version:literal.$versionp:literal $($vt:literal)*$($t:tt)*])=>{
1570		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n[$version.$versionp $($vt)*],+$([$($sub:tt)*])?}
1571		[$($t)*])
1572	};
1573	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n,+$([$($sub:tt)*])?}
1574	[n $version:literal$($t:tt)*])=>{
1575		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n[$version],+$([$($sub:tt)*])?}
1576		[$($t)*])
1577	};
1578	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n,+$([$($sub:tt)*])?}
1579	[n [$($version:tt)*]$(,$($t:tt)*)?])=>{
1580		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n[$($version)*],+$([$($sub:tt)*])?}
1581		[$($($t)*)?])
1582	};
1583	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($subt:tt)*])?}
1584	[+ [$($sub:tt)*] $(,$($t:tt)*)?])=>{
1585		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+[$($($subt)*)?$($sub)*,]}
1586		[$($($t)*)?])
1587	};
1588	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+}
1589	[+ Vector$sub:tt$($t:tt)*])=>{
1590		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+[->Vector$sub]}
1591		[$($t)*])
1592	};
1593	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+}
1594	[+ vector!$sub:tt$($t:tt)*])=>{
1595		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+[->vector!$sub]}
1596		[$($t)*])
1597	};
1598	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($subt:tt)*])?}
1599	[+ $macro:ident!$body:tt $($t:tt)*])=>{
1600		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+[$($($subt)*)?$macro!$body,]}
1601		[$($t)*])
1602	};
1603	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($subt:tt)*])?}
1604	[+ $sub:expr $(,$($t:tt)*)?])=>{
1605		$crate::cmd!(->$name=>{>$([$($action)*])?,<$([$($authors)*])?,@$([$($copyright)*])?,@$([$($license)*])?,=$([$($description)*])?,:$([$($usage)*])?,l~$([$($l_flags)*])?,c~$([$($c_flags)*])?,&$([$($alias)*])?,n$([$($version)*])?,+[$($($subt)*)?$sub,]}
1606		[$($($t)*)?])
1607	};
1608	(->$name:expr=>{>$([$($action:tt)*])?,<$([$($authors:tt)*])?,@$([$($copyright:tt)*])?,@$([$($license:tt)*])?,=$([$($description:tt)*])?,:$([$($usage:tt)*])?,l~$([$($l_flags:tt)*])?,c~$([$($c_flags:tt)*])?,&$([$($alias:tt)*])?,n$([$($version:tt)*])?,+$([$($sub:tt)*])?}
1609	[])=>{
1610		$crate::cmd!(->$name=>[>$($($action)*)?,<[$($($authors)*)?],@[$($($copyright)*)?],@[$($($license)*)?],=[$($crate::string_from!{$($description)*})?],:[$($($usage)*)?],l~[$($($l_flags)*)?],c~[$($($c_flags)*)?],&[$($($alias)*)?],n[$($($version)*)?],+[$($($sub)*)?]])
1611	};
1612	(
1613		->$name:expr=>
1614		[
1615			>$action:expr,
1616			<$authors:tt,
1617			@$copyright:tt,
1618			@$license:tt,
1619			$(=)+$desc:tt,
1620			:$usage:tt,
1621			l~$l_flags:tt,
1622			c~$c_flags:tt,
1623			&$alias:tt,
1624			n $ver:tt,
1625			+ $sub:tt$(,)?
1626		]
1627	) => {
1628		Command::with_all_field(
1629			$name,
1630			$crate::option_wrap!($action),
1631			$crate::string_from!$authors,
1632			$crate::copyright!$copyright,
1633			$crate::license!$license,
1634			$crate::option_string_from!$desc,
1635			$crate::string_from!$usage,
1636			$crate::flags!$l_flags,
1637			$crate::flags!$c_flags,
1638			$crate::alias!$alias,
1639			$crate::version!$ver,
1640			$crate::cmds!$sub,
1641		)
1642	};
1643	(->$name:expr=>[$($t:tt)*])=>{
1644		$crate::cmd!(->$name=>{>,<,@,@,=,:,l~,c~,&,n,+}[$($t)*])
1645	};
1646}
1647
1648/// Create usage
1649#[macro_export]
1650macro_rules! default_usage {
1651	($name:ident) => {
1652		default_usage!(stringify!($name))
1653	};
1654	($name:ident  as var) => {
1655		$name.into() + "[SUBCOMMAND OR ARG] [OPTIONS]"
1656	};
1657	($name: literal) => {
1658		concat!($name, "[SUBCOMMAND OR ARG] [OPTIONS]")
1659	};
1660	($name:ident : into) => {
1661		$name.into() + "[SUBCOMMAND OR ARG] [OPTIONS]"
1662	};
1663	($name:ident : string) => {
1664		$name + "[SUBCOMMAND OR ARG] [OPTIONS]"
1665	};
1666	(nameString=>$name:expr) => {
1667		$name + "[SUBCOMMAND OR ARG] [OPTIONS]"
1668	};
1669}
1670
1671#[macro_export]
1672/// Macro for creating copyright
1673macro_rules! copyright {
1674	()=>{
1675		$crate::string_from!()
1676	};
1677	([])=>{
1678		$crate::string_from!()
1679	};
1680	($raw_str:literal) => {
1681		$raw_str.to_string()
1682	};
1683	(->$raw_str:literal) => {
1684		$raw_str.to_string()
1685	};
1686	(->$raw:expr)=>{
1687		$raw
1688	};
1689	(...)=>{
1690		$crate::copyright!(from_crate)
1691	};
1692	(from_crate) => {
1693		concat!("Copyright (c) ", $crate::crate_authors!()).to_owned()
1694	};
1695	($prefix:literal$(,)? $year:literal$(,)?$holder:ident) => {
1696		$crate::copyright!($prefix, $year, stringify!($holder))
1697	};
1698	($prefix:literal, $year:literal,$holder:expr) => {
1699		concat!($prefix," ", $year," ", $holder).to_owned()
1700	};
1701	($prefix:literal $year:literal $holder:expr) => {
1702		copyright!($prefix, $year, $holder)
1703	};
1704	(from_crate,$year:literal)=>{
1705		concat!("Copyright (c) ", $year," ", $crate::crate_authors!()).to_owned()
1706	};
1707	($year:literal,from_crate)=>{
1708		copyright!(from_crate,$year)
1709	};
1710	($prefix:literal, $year:literal,$holder:literal) => {
1711		concat!($prefix," ", $year," ", $holder).to_owned()
1712	};
1713	($prefix:literal $year:literal $holder:literal) => {
1714		copyright!($prefix, $year, $holder)
1715	};
1716	(...$(,)?$year:literal)=>{
1717		$crate::copyright!(from_crate,$year)
1718	};
1719	($year:literal$(,)?...)=>{
1720		$crate::copyright!($year,from_crate)
1721	};
1722	({$($t:tt)*})=>{
1723		$crate::copyright!([$($t:tt)+])
1724	};
1725	(($($t:tt)*))=>{
1726		$crate::copyright!([$($t:tt)+])
1727	};
1728	($year:literal$(,)?$holder:ident) => {
1729		$crate::copyright!($year, stringify!($holder))
1730	};
1731	($year:literal$(,)?$holder:expr) => {
1732		$crate::copyright!("Copyright (c)", $year, $holder)
1733	};
1734	($prefix:expr, $year:expr,$holder:ident) => {
1735		$crate::copyright!($prefix, $year, stringify!($holder))
1736	};
1737	($prefix:expr, $year:expr,$holder:expr) => {
1738		concat!($prefix, " ", $year, " ", $holder).to_owned()
1739	};
1740}
1741
1742#[macro_export]
1743/// Helps for creating flag*s*.
1744macro_rules! flags {
1745	()=>{
1746		$crate::flags!(None)
1747	};
1748	(None)=>{
1749		$crate::vector!(None;:Flag)
1750	};
1751	(->$expr:expr)=>{
1752		$expr
1753	};
1754	($($flag_arg:tt);* $(;)?) => {
1755		$crate::vector![$($crate::flag![$flag_arg]),*]
1756	};
1757	($($flag_arg:tt),* $(,)?) => {
1758		$crate::vector![$($crate::flag![$flag_arg]),*]
1759	};
1760	($($flag_name:ident$sep:tt$flag_arg:tt),* $(,)?)=>{
1761		$crate::flags!($([$flag_name=>$flag_arg]),*);
1762	};
1763	($($flag_name:ident$sep:tt$flag_arg:tt);* $(,)?)=>{
1764		$crate::flags!($([$flag_name=>$flag_arg]),*);
1765	};
1766	($ft:tt$(,$($t:tt)*)?)=>{
1767		$crate::flags!(={$ft,},$($($t)*)?)
1768	};
1769	(={$($st:tt),+,},$ft:tt$(,$($t:tt)*)?)=>{
1770		$crate::flags!(={$($st),+,$ft,},$($($t)*)?)
1771	};
1772	(={$($st:tt),+,},$ft:tt$(;$($t:tt)*)?)=>{
1773		$crate::flags!(={$($st),+,$ft,},$($($t)*)?)
1774	};
1775	($(={$($st:tt),+,},)?$flag_name:ident$flag_arg:tt$(,$($t:tt)*)?)=>{
1776		$crate::flags!(={$($($st),+,)?[$flag_name$flag_arg],},$($($t)*)?)
1777	};
1778	($(={$($st:tt),+,},)?$flag_name:ident$flag_arg:tt$(;$($t:tt)*)?)=>{
1779		$crate::flags!(={$($($st),+,)?[$flag_name$flag_arg],},$($($t)*)?)
1780	};
1781	($(={$($st:tt),+,},)?$flag_name:ident$sep:tt$flag_arg:tt$(,$($t:tt)*)?)=>{
1782		$crate::flags!(={$($($st),+,)?[$flag_name$sep$flag_arg],},$($($t)*)?)
1783	};
1784	($(={$($st:tt),+,},)?$flag_name:ident$sep:tt$flag_arg:tt$(;$($t:tt)*)?)=>{
1785		$crate::flags!(={$($($st),+,)?[$flag_name$sep$flag_arg],},$($($t)*)?)
1786	};
1787	($(={$($st:tt),+,},)?[$($ft:tt)+]$($t:tt)*)=>{
1788		$crate::flags!(={$($($st),+,)?[$($ft)+],},$($t)*);
1789	};
1790	($(={$($st:tt),+,},)?{$($ft:tt)+}$($t:tt)*)=>{
1791		$crate::flags!(={$($($st),+,)?[$($ft)+],},$($t)*);
1792	};
1793	($(={$($st:tt),+,},)?($($ft:tt)+)$($t:tt)*)=>{
1794		$crate::flags!(={$($($st),+,)?[$($ft)+],},$($t)*);
1795	};
1796	(={$($st:tt),+,},)=>{
1797		$crate::flags!($($st),+,)
1798	};
1799}
1800
1801#[macro_export]
1802/// Returns alias for Command Construction
1803macro_rules! alias {
1804	() => {
1805		$crate::vector!(;:String)
1806	};
1807	(None) => {
1808		$crate::vector!(;:String)
1809	};
1810	(=[$($at:tt)*],,$($t:tt)*)=>{
1811		alias!(=[$($at)*],$($t)*)
1812	};
1813	(=[$($at:tt)*])=>{
1814		$crate::vector!($($at)*;:String)
1815	};
1816	(=[$($at:tt)*],)=>{
1817		$crate::vector!($($at)*;:String)
1818	};
1819	(=[$($at:tt)*],$alias:ident,$($t:tt)*)=>{
1820		$crate::alias!(=[$($at)*$crate::string_from!(stringify!($alias)),],$($t)*)
1821	};
1822	(=[$($at:tt)*],$alias:literal,$($t:tt)*)=>{
1823		alias!(=[$($at)*$crate::string_from!($alias),],$($t)*)
1824	};
1825	(=[$($at:tt)*],$alias:expr,$($t:tt)*)=>{
1826		alias!(=[$($at)*stringify!($alias),],$($t)*)
1827	};
1828	(=[$($at:tt)*],$alias:ident$($t:tt)*)=>{
1829		alias!(=[$($at)*$crate::string_from!(stringify!($alias)),],$($t)*)
1830	};
1831	(=[$($at:tt)*],$alias:literal$($t:tt)*)=>{
1832		alias!(=[$($at)*$crate::string_from!($alias),],$($t)*)
1833	};
1834	(=[$($at:tt)*],$alias:expr)=>{
1835		alias!(=[$($at)*$alias,],)
1836	};
1837	(->$raw:expr) => {
1838		$raw
1839	};
1840	($($t:tt)+)=>{
1841		$crate::alias!(=[],$($t)+)
1842	};
1843}
1844
1845#[macro_export]
1846/// Macro for specification of command version
1847macro_rules! version {
1848	()=>{
1849		version!(None)
1850	};
1851	(None)=>{
1852		$crate::string_from!()
1853	};
1854	(...) => {
1855		$crate::string_from!($crate::crate_version!())
1856	};
1857	(from_crate)=>{
1858		version!(...)
1859	};
1860	($vm:literal.$vp:literal)=>{
1861		$crate::string_from!(concat!($vm,".",$vp))
1862	};
1863	($version:literal) => {
1864		$crate::string_from!($version)
1865	};
1866	($major:literal$(,)?$minor:literal$(,)?$patch:literal $($($tail:tt)+)?)=>{
1867		$crate::string_from!(concat!($major,".",$minor,".",$patch$(,$(" ",tt_stringify!($tail)),+)?))
1868	};
1869	(&$from:expr) => {
1870		$from
1871	};
1872	(->$raw:expr) => {
1873		$raw
1874	};
1875}
1876
1877#[macro_export]
1878/// stringifier(not stringify about literal)
1879macro_rules! tt_stringify {
1880	($ident:ident) => {
1881		stringify!($ident)
1882	};
1883	($literal:literal) => {
1884		$literal
1885	};
1886	($t:tt) => {
1887		stringify!($t)
1888	};
1889}
1890
1891#[macro_export]
1892/// alias of commands! macro
1893macro_rules! cmds{
1894	($($t:tt)*)=>{
1895		$crate::commands!($($t)*)
1896	}
1897}
1898
1899#[macro_export]
1900/// create command array
1901macro_rules! commands{
1902	(->$($raw:tt)*)=>{
1903		$($raw)*
1904	};
1905	()=>{
1906		commands![None]
1907	};
1908	(None)=>{
1909		$crate::vector![None;:Command]
1910	};
1911	($([$($cmd:tt)+]$(,)?)+)=>{
1912		$crate::vector![$(cmd![$($cmd)+])+;:Command]
1913	};
1914	($($expr:expr),+;:Command$(,)?)=>{
1915		$crate::vector![$($expr),+;:Command]
1916	};
1917	($($expr:expr),+ $(,)?;:Command$(,)?)=>{
1918		$crate::vector![$($expr),+;:Command]
1919	};
1920	($($expr:expr),*$(,)?)=>{
1921		$crate::vector![$($expr),*;:Command]
1922	};
1923}
1924
1925#[macro_export]
1926/// string_from macro. based on Strong::from, but no arg can generate String::new()
1927macro_rules! string_from {
1928	() => {
1929		String::new()
1930	};
1931	("")=>{
1932		String::new()
1933	};
1934	(->$from:expr)=>{
1935		$from
1936	};
1937	(&$from:expr)=>{
1938		$from
1939	};
1940	(String::from($from:expr))=>{
1941		String::from($from)
1942	};
1943	($from:expr)=>{
1944		String::from($from)
1945	};
1946	(&$($from_tt:tt)+)=>{
1947		String::from($($from_tt)+)
1948	};
1949	($($from_tt:tt)+)=>{
1950		String::from($($from_tt)+)
1951	};
1952}
1953
1954#[macro_export]
1955/// option_string_from macro
1956macro_rules! option_string_from {
1957	() => {
1958		None
1959	};
1960	("")=>{
1961		None
1962	};
1963	(->$from:expr)=>{
1964		$from
1965	};
1966	(&$from:expr)=>{
1967		$from
1968	};
1969	($from:literal)=>{
1970		Some(String::from($from))
1971	};
1972	($from:expr)=>{
1973		Some(String::from($from))
1974	};
1975	(&$($from_tt:tt)+)=>{
1976		String::from($($from_tt)+)
1977	};
1978	($($from_tt:tt)+)=>{
1979		String::from($($from_tt)+)
1980	};
1981}
1982
1983#[macro_export]
1984/// Helps for creating flag.
1985macro_rules! flag {
1986	(@$($t:tt)*) => {
1987		$crate::_fsp!(@$($t)*)
1988	};
1989	(&$($t:tt)+) => {
1990		$crate::_fsp!(&$($t)+)
1991	};
1992	(*$($t:tt)+) => {
1993		$crate::_fsp!(*$($t)+)
1994	};
1995	($($t:tt)*)=>{
1996		$crate::_ffp!($($t)*)
1997	};
1998}
1999
2000#[macro_export]
2001#[doc(hidden)]
2002// flag basic constructor
2003macro_rules! _flag_basic_constructor {
2004	(->$name:expr=>[
2005		$(=)?$description:expr,
2006		$(s~)?$short_alias:expr,
2007		$(l~)?$long_alias:expr,
2008		$(>)?$type:expr,
2009		$(?)?$default:expr$(,)?]) => {
2010		$crate::Flag::with_all_field(
2011			$name,
2012			$description,
2013			$short_alias,
2014			$long_alias,
2015			$type,
2016			$default,
2017		)
2018	};
2019	($name:expr,$description:expr,$short_alias:expr,$long_alias:expr,$type:expr,$default:expr) => {
2020		$crate::Flag::with_all_field(
2021			$name,
2022			$description,
2023			$short_alias,
2024			$long_alias,
2025			$type,
2026			$default,
2027		)
2028	};
2029}
2030
2031#[macro_export]
2032#[doc(hidden)]
2033// inner for first parse name and tify little after name.
2034macro_rules! _ffp {
2035	([$($t:tt)+])=>{
2036		$crate::_ffp!($($t)*)
2037	};
2038	({$($t:tt)+})=>{
2039		$crate::_ffp!($($t)*)
2040	};
2041	(($($t:tt)+))=>{
2042		$crate::_ffp!($($t)*)
2043	};
2044	(=$(>)*$expr:expr)=>{
2045		$expr
2046	};
2047	(>$(>)*$expr:expr)=>{
2048		$expr
2049	};
2050	(help)=>{
2051		$crate::help_flag!()
2052	};
2053	(version)=>{
2054		$crate::version_flag!()
2055	};
2056	(authors)=>{
2057		$crate::authors_flag!()
2058	};
2059	(license)=>{
2060		$crate::license_flag!()
2061	};
2062	(copyright)=>{
2063		$crate::copyright_flag!()
2064	};
2065	(yes)=>{
2066		$crate::yes_flag!()
2067	};
2068	(no)=>{
2069		$crate::no_flag!()
2070	};
2071	(->$name:ident$t:tt)=>{
2072 		$crate::_fsp!(->$name=>$t)
2073 	};
2074	(->[$name:expr]$t:tt)=>{
2075	 	$crate::_fsp!(->[$name]=>$t)
2076	};
2077	(->[$name:expr]$sep:tt$($t:tt)+)=>{
2078	 	$crate::_fsp!(->[$name]=>$($t)+)
2079	};
2080	(->$name:ident=$t:tt)=>{
2081		$crate::_fsp!(->$name=>$t)
2082	};
2083	(->$name:expr=>$($t:tt)*)=>{
2084		$crate::_fsp!(->$name=>$($t)*)
2085	};
2086	(->$name:ident$sep:tt$t:tt)=>{
2087		$crate::_fsp!(->$name=>$t)
2088	};
2089	([$($t:tt)+]$($ta:tt)?)=>{
2090		$crate::_fsp!([$($t)+]$(=>$ta)?)
2091	};
2092	([$($t:tt)+][#$(sep:tt)*]$($ta:tt)+)=>{
2093		$crate::_fsp!([$($t)+]=>$($ta:tt)+)
2094	};
2095	([$($t:tt)+][$($ta:tt)*]$($tas:tt)+)=>{
2096		$crate::_fsp!([$($t)+]=>[$($ta)*]$($tas)+)
2097	};
2098	([$($t:tt)+]$sep:tt$($ta:tt)+)=>{
2099		$crate::_fsp!([$($t)+]=>$($ta)+)
2100	};
2101	($name:literal[#$($sep:tt)*]$($tas:tt)+)=>{
2102		$crate::_fsp!($name=>$($tas)+)
2103	};
2104	($name:literal[$($ta:tt)*]$($tas:tt)+)=>{
2105		$crate::_fsp!($name=>[$($ta)*]$($tas)+)
2106	};
2107	($name:ident[#$($sep:tt)*]$($tas:tt)+)=>{
2108		$crate::_fsp!($name=>$($tas)+)
2109	};
2110	($name:ident[$($ta:tt)*]$($tas:tt)+)=>{
2111		$crate::_fsp!($name=>[$($ta)*]$($tas)+)
2112	};
2113	($name:ident$t:tt)=>{
2114		$crate::_fsp!($name=>$t)
2115	};
2116	($name:ident$sep:tt$t:tt)=>{
2117		$crate::_fsp!($name=>$t)
2118	};
2119	($name:ident)=>{
2120		$crate::_fsp!($name)
2121	};
2122	($name:ident$sep:tt$($t:tt)+)=>{
2123		$crate::_fsp!($name=>$($t)+)
2124	};
2125	($name:expr$(=>$t:tt)?)=>{
2126		$crate::_fsp!($name=>$($t)?)
2127	};
2128	($name:expr=>$($t:tt)*)=>{
2129		$crate::_fsp!($name=>$($t)*)
2130	};
2131	(->[$name:expr])=>{
2132	 	$crate::_fsp!(->[$name])
2133	};
2134	(->$name:expr)=>{
2135		$crate::_fsp!(->$name)
2136	};
2137}
2138
2139#[macro_export]
2140#[doc(hidden)]
2141// macro for inner flag
2142macro_rules! _fsp {
2143	(*$($t:tt)*)=>{
2144		$crate::flag!($($t)*)
2145	};
2146	(@$($t:tt)*)=>{
2147		$crate::flag!($($t)*)
2148	};
2149	(&$($t:tt)*)=>{
2150		$crate::flag!(->$($t)*)
2151	};
2152	($name:ident=>$($t:tt)*)=>{
2153		$crate::_fsp!(stringify!($name)=>$($t)*)
2154	};
2155	($name:ident)=>{
2156		$crate::_fsp!(stringify!($name))
2157	};
2158	([$($nt:tt)*]$(=>$($t:tt)*)?)=>{
2159		$crate::_fsp!($($nt)* =>$($($t)*)?)
2160	};
2161	($name:expr=>$($t:tt)*)=>{
2162		$crate::_fsp!(->$crate::string_from!($name)=>$($t)*)
2163	};
2164	($name:expr)=>{
2165		$crate::_fsp!(->$crate::string_from!($name))
2166	};
2167	(->[$name:expr]=>$($t:tt)*)=>{
2168		$crate::_fsp!(->$name=>$($t)*)
2169	};
2170	(->$name:expr=>$($t:tt)*)=>{
2171		$crate::_ftp!(->$name=>$($t)*)
2172	};
2173	(->[$name:expr])=>{
2174		$crate::_fsp!(->$name)
2175	};
2176	(->$name:expr)=>{
2177		$crate::_fsp!(->$name=>)
2178	};
2179}
2180
2181#[macro_export]
2182#[doc(hidden)]
2183// macro for innser flag
2184macro_rules! _ftp{
2185	(->$name:expr=>$t:tt$($t2:tt)+)=>{
2186			$crate::_ftp_s!(->$name=>{=,s~,l~,>,?}[$t$($t2)+])
2187	};
2188	(->$name:expr=>)=>{
2189		$crate::_ftp!(->$name=>[])
2190	};
2191	(->$name:expr=>{$($t:tt)*})=>{
2192		$crate::_ftp![->$name=>[$($t)*]]
2193	};
2194	(->$name:expr=>($($t:tt)*))=>{
2195		$crate::_ftp![->$name=>[$($t)*]]
2196	};
2197	(->$name:expr=>[]) => {
2198		$crate::_ftp!(->$name=>[=String::default(),s~$crate::Vector::default(),l~$crate::Vector::default(),>$crate::FlagType::default(),?$crate::flag_value!(bool)])
2199	};
2200	(->$name:expr=>[$i:ident])=>{
2201		$crate::_fp_ident_ft_assigner!(->$name=>[$i],_ftp,=)
2202	};
2203	(->$name:expr=>[$i:ident,$($t:tt)*])=>{
2204		$crate::_fp_ident_ft_assigner!(->$name=>[$i,$($t)*],_ftp,=)
2205	};
2206	(->$name:expr=>[-$($t:tt)*])=>{
2207		$crate::_ftp_s!(->$name=>[-$($t)+])
2208	};
2209	(->$name:expr=>[$(=)?$description:literal,$($t:tt)*])=>{
2210		$crate::_ftp_s!(->$name=>[=$description,$($t)*])
2211	};
2212	(->$name:expr=>[=[$($dt:tt)*]$($t:tt)*])=>{
2213		$crate::_ftp_s!(->$name=>[=[$($dt)*]$($t)*])
2214	};
2215	(->$name:expr=>[$(=)?$description:expr,$(s~)?$(-)?[$($s:tt)*]$($t:tt)*])=>{
2216		$crate::_ftp_s!(->$name=>[=$description,-[$($s)*]$($t)*])
2217	};
2218	(->$name:expr=>[$(=)?$description:expr,
2219		$short_alias:expr,
2220		$long_alias:expr,
2221		$(>)?$type:expr,
2222		$(?)?$default:expr$(,)?
2223		])=>{
2224			$crate::_flag_basic_constructor!(->$name=>[$description,$short_alias,$long_alias,$type,$default])
2225	};
2226	(->$name:expr=>[$(=)?$description:expr,
2227		s~$short_alias:expr,
2228		$long_alias:expr,
2229		$(>)?$type:expr,
2230		$(?)?$default:expr$(,)?
2231		])=>{
2232			$crate::_flag_basic_constructor!(->$name=>[$description,$short_alias,$long_alias,$type,$default])
2233	};
2234	(->$name:expr=>[$(=)?$description:expr,
2235		$short_alias:expr,
2236		l~$long_alias:expr,
2237		$(>)?$type:expr,
2238		$(?)?$default:expr$(,)?
2239		])=>{
2240			$crate::_flag_basic_constructor!(->$name=>[$description,$short_alias,$long_alias,$type,$default])
2241	};
2242	(->$name:expr=>[$(=)?$description:expr,
2243		s~$short_alias:expr,
2244		l~$long_alias:expr,
2245		$(>)?$type:expr,
2246		$(?)?$default:expr$(,)?
2247		])=>{
2248			$crate::_flag_basic_constructor!(->$name=>[$description,$short_alias,$long_alias,$type,$default])
2249	};
2250	(->$name:expr=>[$($t:tt)+])=>{
2251		$crate::_ftp_s!(->$name=>[$($t)+])
2252	};
2253}
2254#[macro_export]
2255#[doc(hidden)]
2256// macro for innser flag
2257macro_rules! _ftp_s {
2258	(->$name:expr=>{$($at:tt)*}[$($t:tt)*])=>{
2259		$crate::_ftp_t!(->$name=>{$($at)*}[$($t)*])
2260	};
2261	(->$name:expr=>[$($t:tt)+])=>{
2262		$crate::_ftp_t!(->$name=>{=,s~,l~,>,?}[$($t)+])
2263	};
2264}
2265
2266#[macro_export]
2267#[doc(hidden)]
2268// macro for innser flag
2269macro_rules! _ftp_t {
2270	(->$name:expr=>
2271		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}[,$($t:tt)*])=>{
2272			$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($t)*])
2273		};
2274	(->$name:expr=>
2275		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?}
2276		[$type:ident?$($t:tt)*])=>{
2277		$crate::_ftp_t!(->$name=>{=,s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?}[?$($t)*])
2278	};
2279	(->$name:expr=>
2280		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?$($default:expr)?}
2281		[[>$type:ident$($t:tt)*]$($t2:tt)*])=>{
2282		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?$($default)?}[$($t)*,$($t2)*])
2283	};
2284	(->$name:expr=>
2285		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2286		[[=$($dt:tt)*]$($t:tt)*])=>{
2287		$crate::_ftp_t!(->$name=>{=,s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[=$($dt)*,$($t)*])
2288	};
2289	(->$name:expr=>
2290		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2291		[[=->$description:expr]$($t:tt)*])=>{
2292		$crate::_ftp_t!(->$name=>{=[->$description],s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($t)*])
2293	};
2294	(->$name:expr=>
2295		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?}
2296		[>$type:ident?$default:expr$(,$($t:tt)*)?])=>{
2297		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?$default}[$($($t)*)?])
2298	};
2299	(->$name:expr=>
2300		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?$($default:expr)?}
2301		[>$type:ident$(,$($t:tt)*)?])=>{
2302		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?$($default)?}[$($($t)*)?])
2303	};
2304	(->$name:expr=>
2305		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?$($default:expr)?}
2306		[>$type:ident$($t:tt)*])=>{
2307		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?$($default)?}[$($t)*])
2308	};
2309	(->$name:expr=>
2310		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?$($default:expr)?}
2311		[[$i:ident]$($t:tt)*])=>{
2312		$crate::_fp_ident_ft_assigner!(->$name=>{=,s~$([$($st)*])?,l~$([$($lt)*])?,>,?$($default)?}[$i,$($t)*],_ftp_t,=)
2313	};
2314	(->$name:expr=>
2315		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$type:ident,?}
2316		[[@$($default:expr)?]$($t:tt)*])=>{
2317		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?$($default)?}[$($t)*])
2318	};
2319	(->$name:expr=>
2320		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$type:ident,?}
2321		[[?$($default:expr)?]$($t:tt)*])=>{
2322		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?$($default)?}[$($t)*])
2323	};
2324	(->$name:expr=>
2325		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2326		[$(l~)?--$l:ident$(,)?$la:ident$($t:tt)*])=>{
2327		$crate::_fp_ident_ft_assigner!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~[$($($lt)*)? $l ],>$($type)?,?$($default)?}[$la$($t)*],_ftp_t,--)
2328	};
2329	(->$name:expr=>
2330		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2331		[$(l~)?--$l:ident $($t:tt)*])=>{
2332		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~[$($($lt)*)? $l],>$($type)?,?$($default)?}[$($t)*])
2333	};
2334	(->$name:expr=>
2335		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2336		[$(s~)?-$s:ident$(,)?$sa:ident$($t:tt)*])=>{
2337			$crate::_fp_ident_s_assigner!(->$name=>{=$([$($dt)*])?,s~[$($($st)*)?$s],l~$([$($lt)*])?,>$($type)?,?$($default)?}[$sa$($t)*],_ftp_t)
2338	};
2339	(->$name:expr=>
2340		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2341		[$(s~)?-$s:ident$(,$($t:tt)*)?])=>{
2342			$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~[$($($st)*)?$s],l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($($t)*)?])
2343	};
2344	(->$name:expr=>
2345		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2346		[$(s~)?-$s:ident$($t:tt)*])=>{
2347			$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~[$($($st)*)?$s],l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($t)*])
2348	};
2349	(->$name:expr=>
2350		{=$([$($dt:tt)*])?,s~,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2351		[$(s~)?$(-)?[$($(-)?$s:ident$(,)?)*]$(,$($t:tt)*)?])=>{
2352			$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~[$($s)*],l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($($t)*)?])
2353	};
2354	(->$name:expr=>
2355		{=$([$($dt:tt)*])?,s~,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2356		[$(s~)?$(-)?[$($(-)?$s:ident$(,)?)*]$($t:tt)*])=>{
2357			$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~[$($s)*],l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($t)*])
2358	};
2359	(->$name:expr=>
2360		{=$([$($dt:tt)*])?,s~,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2361		[[-$($s:tt)*]$($t:tt)*])=>{
2362			$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~,l~$([$($lt)*])?,>$($type)?,?$($default)?}[-$($s)*,$($t)*])
2363	};
2364	(->$name:expr=>
2365		{=$([$($dt:tt)*])?,s~,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2366		[$(s~)?$(-)?[$($s:tt)*]$($t:tt)*])=>{
2367			$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~[$($s)*],l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($t)*])
2368	};
2369	(->$name:expr=>
2370		{=$([$($dt:tt)*])?,s~,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2371		[s~$short_alias:ident$(,$($t:tt)*)?])=>{
2372		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~[->$short_alias],l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($($t)*)?])
2373	};
2374	(->$name:expr=>
2375		{=$([$($dt:tt)*])?,s~,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2376		[s~$short_alias:expr$(,$($t:tt)*)?])=>{
2377		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~[->$short_alias],l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($($t)*)?])
2378	};
2379	(->$name:expr=>
2380		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~,>$($type:ident)?,?$($default:expr)?}
2381		[l~$long_alias:expr$(,$($t:tt)*)?])=>{
2382		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~[->$long_alias],>$($type)?,?$($default)?}[$($($t)*)?])
2383	};
2384	(->$name:expr=>
2385		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~,>$($type:ident)?,?$($default:expr)?}
2386		[$(l~)?$(--)?[$($(--)?$l:ident$(,)?)*]$($t:tt)*])=>{
2387		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~[$($l)*],>$($type)?,?$($default)?}[$($t)*])
2388	};
2389	(->$name:expr=>
2390		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~,>$($type:ident)?,?$($default:expr)?}
2391		[[--$($lt:tt)*]$($t:tt)*])=>{
2392		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~,>$($type)?,?$($default)?}[--$($lt)*,$($t)*])
2393	};
2394	(->$name:expr=>
2395		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~,>$($type:ident)?,?$($default:expr)?}
2396		[$(l~)?$(--)?[$($lt:tt)*],$($t:tt)*])=>{
2397		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~[$($lt)*],>$($type)?,?$($default)?}[$($t)*])
2398	};
2399	(->$name:expr=>
2400		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~,>$($type:ident)?,?$($default:expr)?}
2401		[$(l~)?$(--)?[$($lt:tt)*]])=>{
2402		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~[$($lt)*],>$($type)?,?$($default)?}[])
2403	};
2404	(->$name:expr=>
2405		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2406		[= -$($t:tt)*])=>{
2407		$crate::_ftp_t!(->$name=>{=[],s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[-$($t)*])
2408	};
2409	(->$name:expr=>
2410		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2411		[= ?$($t:tt)*])=>{
2412		$crate::_ftp_t!(->$name=>{=[],s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[?$($t)*])
2413	};
2414	(->$name:expr=>
2415		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2416		[= >$($t:tt)*])=>{
2417		$crate::_ftp_t!(->$name=>{=[],s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[>$($t)*])
2418	};
2419	(->$name:expr=>
2420		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2421		[=$(,$($t:tt)*)?])=>{
2422		$crate::_ftp_t!(->$name=>{=[],s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($($t)*)?])
2423	};
2424	(->$name:expr=>
2425		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$(bool)?,?}
2426		[$(?)?$(@)?false])=>{
2427		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>bool,?false}[])
2428	};
2429	(->$name:expr=>
2430		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$(bool)?,?}
2431		[$(?)?$(@)?true])=>{
2432		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>bool,?true}[])
2433	};
2434	(->$name:expr=>
2435		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2436		[=$description:ident$($t:tt)*])=>{
2437		$crate::_ftp_t!(->$name=>{=[$description],s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($t)*])
2438	};
2439	(->$name:expr=>
2440		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2441		[$(=)?$description:literal$($t:tt)*])=>{
2442		$crate::_ftp_t!(->$name=>{=[$description],s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($t)*])
2443	};
2444	(->$name:expr=>
2445		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2446		[=[->$description:expr]$($t:tt)*])=>{
2447		$crate::_ftp_t!(->$name=>{=[->$description],s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($t)*])
2448	};
2449	(->$name:expr=>
2450		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2451		[[=[$($dt:tt)*]]$($t:tt)*])=>{
2452		$crate::_ftp_t!(->$name=>{=[$($dt)*],s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($t)*])
2453	};
2454	(->$name:expr=>
2455		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2456		[[=$description:expr]$($t:tt)*])=>{
2457		$crate::_ftp_t!(->$name=>{=[$description],s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($t)*])
2458	};
2459	(->$name:expr=>
2460		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2461		[$(=)?$description:expr$(,$($t:tt)*)?])=>{
2462		$crate::_ftp_t!(->$name=>{=[$description],s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($($t)*)?])
2463	};
2464	(->$name:expr=>
2465		{=[$($dt:tt)*],s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$type:ident,?}
2466		[$(?)?$(@)?$default:literal])=>{
2467		$crate::_ftp_t!(->$name=>{=[$($dt)*],s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?$default}[])
2468	};
2469	(->$name:expr=>
2470		{=[$($dt:tt)*],s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$type:ident,?}
2471		[[$(?)?$(@)?$default:expr]])=>{
2472		$crate::_ftp_t!(->$name=>{=[$($dt)*],s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?$default}[])
2473	};
2474	(->$name:expr=>
2475		{=[$($dt:tt)*],s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$type:ident,?}
2476		[?$default:expr])=>{
2477		$crate::_ftp_t!(->$name=>{=[$($dt)*],s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?$default}[])
2478	};
2479	(->$name:expr=>
2480		{=[$($dt:tt)*],s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$type:ident,?}
2481		[@$default:expr])=>{
2482		$crate::_ftp_t!(->$name=>{=[$($dt)*],s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?$default}[])
2483	};
2484	(->$name:expr=>
2485		{={$($dt:tt)*},s~[$($st:tt)*],l~[$($lt:tt)*],>$type:ident,?}
2486		[$(?)?$(@)?$default:expr])=>{
2487		$crate::_ftp_t!(->$name=>{={$($dt)*},s~[$($st)*],l~[$($lt)*],>$type,?$default}[])
2488	};
2489	(->$name:expr=>
2490		{=[$($dt:tt)*],s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?$($default:expr)?}
2491		[$i:ident$($t:tt)*])=>{
2492		$crate::_ftp_t!(->$name=>{=[$($dt)*],s~$([$($st)*])?,l~$([$($lt)*])?,>,?$($default)?}[>$i$($t)*])
2493	};
2494	(->$name:expr=>
2495		{=,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?$($default:expr)?}
2496		[$i:ident$($t:tt)*])=>{
2497		$crate::_fp_ident_ft_assigner!(->$name=>{=,s~$([$($st)*])?,l~$([$($lt)*])?,>,?$($default)?}[$i$($t)*],_ftp_t,=)
2498	};
2499	(->$name:expr=>
2500		{=$([$($dt:tt)*])?,s~,l~$([$($lt:tt)*])?,>$($type:ident)?,?$($default:expr)?}
2501		[$short_alias:expr$(,$($t:tt)*)?])=>{
2502		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~[->$short_alias],l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($($t)*)?])
2503	};
2504	(->$name:expr=>
2505		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~,>$($type:ident)?,?$($default:expr)?}
2506		[$long_alias:expr$(,$($t:tt)*)?])=>{
2507		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~[->$long_alias],>$($type)?,?$($default)?}[$($($t)*)?])
2508	};
2509	(->$name:expr=>
2510		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$($type:ident)?,?}
2511		[@$($default:expr)?$(,$($t:tt)*)?])=>{
2512		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>$($type)?,?$($default)?}[$($($t)*)?])
2513	};
2514	(->$name:expr=>
2515		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$type:ident,?}
2516		[?$($default:expr)?$(,$($t:tt)*)?])=>{
2517		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>$type,?$($default)?}[$($($t)*)?])
2518	};
2519	(->$name:expr=>
2520		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?}
2521		[?false$(,$($t:tt)*)?])=>{
2522		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>,?false}[$($($t)*)?])
2523	};
2524	(->$name:expr=>
2525		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?}
2526		[?$default:expr$(,$($t:tt)*)?])=>{
2527		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>,?$default}[$($($t)*)?])
2528	};
2529	(->$name:expr=>
2530		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?}
2531		[])=>{
2532		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>String,?}[])
2533	};
2534	(->$name:expr=>
2535		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?true}
2536		[])=>{
2537		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>bool,?true}[])
2538	};
2539	(->$name:expr=>
2540		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>,?false}
2541		[])=>{
2542		$crate::_ftp_t!(->$name=>{=$([$($dt)*])?,s~$([$($st)*])?,l~$([$($lt)*])?,>bool,?false}[])
2543	};
2544	(->$name:expr=>
2545		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$type:ident,?}
2546		[])=>{
2547		$crate::_ftp!(->$name=>[=$crate::string_from!($($($dt)*)?),s~$crate::short_alias![$($($st)*)?],l~$crate::long_alias![$($($lt)*)?],>$crate::flag_type!($type),?$crate::flag_value!($type)])
2548	};
2549	(->$name:expr=>
2550		{=$([$($dt:tt)*])?,s~$([$($st:tt)*])?,l~$([$($lt:tt)*])?,>$type:ident,?$($default:expr)?}
2551		[])=>{
2552		$crate::_ftp!(->$name=>[=$crate::string_from!($($($dt)*)?),s~$crate::short_alias![$($($st)*)?],l~$crate::long_alias![$($($lt)*)?],>$crate::flag_type!($type),?$crate::flag_value!($type$(,$default)?)])
2553	}
2554}
2555
2556#[macro_export]
2557/// short_alias_expander
2558macro_rules! short_alias {
2559	() => {
2560		$crate::short_alias!(None)
2561	};
2562	(None) => {
2563		$crate::vector!(None;:char)
2564	};
2565	($(-)?[$($t:tt)*])=>{
2566		$crate::short_alias!($($t)*)
2567	};
2568	($($s:ident)+)=>{
2569		$crate::vector![$($crate::char![$s]),+;:char]
2570	};
2571	($(-$s:ident),+$(,)?)=>{
2572		$crate::short_alias![$($s)+]
2573	};
2574	($($(-)?$s:ident)+$(,)?)=>{
2575		$crate::short_alias![$($s)+]
2576	};
2577	($($(-)?$s:ident),+$(,)?)=>{
2578		$crate::short_alias![$($s)+]
2579	};
2580	($(-)?$s:ident$($t:tt)*)=>{
2581		$crate::short_alias!(=[],$s$($t)*)
2582	};
2583	($($s:literal),+)=>{
2584		$crate::vector![$($s),+;:char]
2585	};
2586	($($s:literal)+)=>{
2587		$crate::vector![$($s),+;:char]
2588	};
2589	(=[$($t:tt)*],$(-)?$s:ident,$($t2:tt)*)=>{
2590		$crate::short_alias!(=[$($t)*$crate::char![$s],],$($t2)*)
2591	};
2592	(=[$($t:tt)*],$(-)?$s:ident$($t2:tt)*)=>{
2593		$crate::short_alias!(=[$($t)*$crate::char![$s],],$($t2)*)
2594	};
2595	(-$s:literal$($t:tt)*)=>{
2596		$crate::short_alias!(=[],$s$($t)*)
2597	};
2598	(=[$($t:tt)*],-$s:literal $($t2:tt)*)=>{
2599		$crate::short_alias!(=[$($t)*],$s$($t2)*)
2600	};
2601	($s:literal$($t:tt)*)=>{
2602		$crate::short_alias!(=[],$s$($t)*)
2603	};
2604	(=[$($t:tt)*],$s:literal,$($t2:tt)*)=>{
2605		$crate::short_alias!(=[$($t)*$s,],$($t2)*)
2606	};
2607	(=[$($t:tt)*],$s:literal $($t2:tt)*)=>{
2608		$crate::short_alias!(=[$($t)*$s,],$($t2)*)
2609	};
2610	(=[$($t:tt)*],)=>{
2611		$crate::vector!($($t)*;:char)
2612	};
2613	(->$s:expr)=>{
2614		$s
2615	};
2616}
2617
2618#[macro_export]
2619/// long_alias_expander
2620macro_rules! long_alias {
2621	()=>{
2622		$crate::long_alias!(None)
2623	};
2624	(None) => {
2625		$crate::vector!(None;:String)
2626	};
2627	(--[$($t:tt)*])=>{
2628		$crate::long_alias!($($t)*)
2629	};
2630	($($l:ident)+)=>{
2631		$crate::vector!($(stringify!($l)),+;=>String)
2632	};
2633	($($(--)?$l:ident),+$(,)?)=>{
2634		$crate::long_alias!($($l)+)
2635	};
2636	($($(--)?$l:ident)+$(,)?)=>{
2637		$crate::long_alias!($($l)+)
2638	};
2639	(--$l:ident$($t:tt)*)=>{
2640		$crate::long_alias!(=[],$l$($t)*)
2641	};
2642	($(--$l:literal)+$(,)?)=>{
2643		$crate::long_alias!($($l),+)
2644	};
2645	($(--$l:literal),+$(,)?)=>{
2646		$crate::vector!($($l),+;=>String)
2647	};
2648	($($l:literal)+$(,)?)=>{
2649		$crate::long_alias!($($l),+)
2650	};
2651	($($l:literal),+$(,)?)=>{
2652		$crate::vector!($($l),+;=>String)
2653	};
2654	($(--)?$l:ident$($t:tt)*)=>{
2655		$crate::long_alias!(=[],$l$($t)*)
2656	};
2657	(=[$($t:tt)*],$(--)?$l:ident,$($t2:tt)*)=>{
2658		$crate::long_alias!(=[$($t)*stringify!($l),],$($t2)*)
2659	};
2660	(=[$($t:tt)*],$(--)?$l:ident$($t2:tt)*)=>{
2661		$crate::long_alias!(=[$($t)*stringify!($l),],$($t2)*)
2662	};
2663	(--$l:literal$($t:tt)*)=>{
2664		$crate::long_alias!(=[],$l$($t)*)
2665	};
2666	($l:literal$($t:tt)*)=>{
2667		$crate::long_alias!(=[],$l$($t)*)
2668	};
2669	($($(--)?$l:literal)+$(,)?)=>{
2670		$crate::long_alias!($($l),+)
2671	};
2672	($($(--)?$l:literal),+$(,)?)=>{
2673		$crate::vector!($($l),+;=>String)
2674	};
2675	(=[$($t:tt)*],--$l:literal,$($t2:tt)*)=>{
2676		$crate::long_alias!(=[$($t)*$l,],$($t2)*)
2677	};
2678	(=[$($t:tt)*],--$l:literal$($t2:tt)*)=>{
2679		$crate::long_alias!(=[$($t)*$l,],$($t2)*)
2680	};
2681	(=[$($t:tt)*],$l:literal,$($t2:tt)*)=>{
2682		$crate::long_alias!(=[$($t)*$l,],$($t2)*)
2683	};
2684	(=[$($t:tt)*],$l:literal$($t2:tt)*)=>{
2685		$crate::long_alias!(=[$($t)*$l,],$($t2)*)
2686	};
2687	(=[$($t:tt)*],)=>{
2688		$crate::vector!($($t)*;=>String)
2689	};
2690	($long:expr)=>{
2691		$crate::long_alias!(->$long)
2692	};
2693	(->$long:expr)=>{
2694		$long
2695	}
2696}
2697
2698#[macro_export]
2699#[doc(hidden)]
2700// inner macro in flag! macro
2701macro_rules! _fp_ident_s_assigner {
2702	(->$name:expr=>$({$($ta:tt)*})?[a$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2703		$crate::$macro!(->$name=>$({$($ta)*})?[-a$($t)*])
2704	};
2705	(->$name:expr=>$({$($ta:tt)*})?[b$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2706		$crate::$macro!(->$name=>$({$($ta)*})?[-b$($t)*])
2707	};
2708	(->$name:expr=>$({$($ta:tt)*})?[c$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2709		$crate::$macro!(->$name=>$({$($ta)*})?[-c$($t)*])
2710	};
2711	(->$name:expr=>$({$($ta:tt)*})?[d$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2712		$crate::$macro!(->$name=>$({$($ta)*})?[-d$($t)*])
2713	};
2714	(->$name:expr=>$({$($ta:tt)*})?[e$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2715		$crate::$macro!(->$name=>$({$($ta)*})?[-e$($t)*])
2716	};
2717	(->$name:expr=>$({$($ta:tt)*})?[f$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2718		$crate::$macro!(->$name=>$({$($ta)*})?[-f$($t)*])
2719	};
2720	(->$name:expr=>$({$($ta:tt)*})?[g$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2721		$crate::$macro!(->$name=>$({$($ta)*})?[-g$($t)*])
2722	};
2723	(->$name:expr=>$({$($ta:tt)*})?[h$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2724		$crate::$macro!(->$name=>$({$($ta)*})?[-h$($t)*])
2725	};
2726	(->$name:expr=>$({$($ta:tt)*})?[i$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2727		$crate::$macro!(->$name=>$({$($ta)*})?[-i$($t)*])
2728	};
2729	(->$name:expr=>$({$($ta:tt)*})?[j$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2730		$crate::$macro!(->$name=>$({$($ta)*})?[-j$($t)*])
2731	};
2732	(->$name:expr=>$({$($ta:tt)*})?[k$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2733		$crate::$macro!(->$name=>$({$($ta)*})?[-k$($t)*])
2734	};
2735	(->$name:expr=>$({$($ta:tt)*})?[l$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2736		$crate::$macro!(->$name=>$({$($ta)*})?[-l$($t)*])
2737	};
2738	(->$name:expr=>$({$($ta:tt)*})?[m$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2739		$crate::$macro!(->$name=>$({$($ta)*})?[-m$($t)*])
2740	};
2741	(->$name:expr=>$({$($ta:tt)*})?[n$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2742		$crate::$macro!(->$name=>$({$($ta)*})?[-n$($t)*])
2743	};
2744	(->$name:expr=>$({$($ta:tt)*})?[o$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2745		$crate::$macro!(->$name=>$({$($ta)*})?[-o$($t)*])
2746	};
2747	(->$name:expr=>$({$($ta:tt)*})?[p$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2748		$crate::$macro!(->$name=>$({$($ta)*})?[-p$($t)*])
2749	};
2750	(->$name:expr=>$({$($ta:tt)*})?[q$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2751		$crate::$macro!(->$name=>$({$($ta)*})?[-q$($t)*])
2752	};
2753	(->$name:expr=>$({$($ta:tt)*})?[r$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2754		$crate::$macro!(->$name=>$({$($ta)*})?[-r$($t)*])
2755	};
2756	(->$name:expr=>$({$($ta:tt)*})?[s$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2757		$crate::$macro!(->$name=>$({$($ta)*})?[-s$($t)*])
2758	};
2759	(->$name:expr=>$({$($ta:tt)*})?[t$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2760		$crate::$macro!(->$name=>$({$($ta)*})?[-t$($t)*])
2761	};
2762	(->$name:expr=>$({$($ta:tt)*})?[u$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2763		$crate::$macro!(->$name=>$({$($ta)*})?[-u$($t)*])
2764	};
2765	(->$name:expr=>$({$($ta:tt)*})?[v$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2766		$crate::$macro!(->$name=>$({$($ta)*})?[-v$($t)*])
2767	};
2768	(->$name:expr=>$({$($ta:tt)*})?[w$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2769		$crate::$macro!(->$name=>$({$($ta)*})?[-w$($t)*])
2770	};
2771	(->$name:expr=>$({$($ta:tt)*})?[x$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2772		$crate::$macro!(->$name=>$({$($ta)*})?[-x$($t)*])
2773	};
2774	(->$name:expr=>$({$($ta:tt)*})?[y$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2775		$crate::$macro!(->$name=>$({$($ta)*})?[-y$($t)*])
2776	};
2777	(->$name:expr=>$({$($ta:tt)*})?[z$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2778		$crate::$macro!(->$name=>$({$($ta)*})?[-z$($t)*])
2779	};
2780	(->$name:expr=>$({$($ta:tt)*})?[A$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2781		$crate::$macro!(->$name=>$({$($ta)*})?[-A$($t)*])
2782	};
2783	(->$name:expr=>$({$($ta:tt)*})?[B$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2784		$crate::$macro!(->$name=>$({$($ta)*})?[-B$($t)*])
2785	};
2786	(->$name:expr=>$({$($ta:tt)*})?[C$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2787		$crate::$macro!(->$name=>$({$($ta)*})?[-C$($t)*])
2788	};
2789	(->$name:expr=>$({$($ta:tt)*})?[D$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2790		$crate::$macro!(->$name=>$({$($ta)*})?[-D$($t)*])
2791	};
2792	(->$name:expr=>$({$($ta:tt)*})?[E$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2793		$crate::$macro!(->$name=>$({$($ta)*})?[-E$($t)*])
2794	};
2795	(->$name:expr=>$({$($ta:tt)*})?[F$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2796		$crate::$macro!(->$name=>$({$($ta)*})?[-F$($t)*])
2797	};
2798	(->$name:expr=>$({$($ta:tt)*})?[G$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2799		$crate::$macro!(->$name=>$({$($ta)*})?[-G$($t)*])
2800	};
2801	(->$name:expr=>$({$($ta:tt)*})?[H$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2802		$crate::$macro!(->$name=>$({$($ta)*})?[-H$($t)*])
2803	};
2804	(->$name:expr=>$({$($ta:tt)*})?[I$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2805		$crate::$macro!(->$name=>$({$($ta)*})?[-I$($t)*])
2806	};
2807	(->$name:expr=>$({$($ta:tt)*})?[J$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2808		$crate::$macro!(->$name=>$({$($ta)*})?[-J$($t)*])
2809	};
2810	(->$name:expr=>$({$($ta:tt)*})?[K$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2811		$crate::$macro!(->$name=>$({$($ta)*})?[-K$($t)*])
2812	};
2813	(->$name:expr=>$({$($ta:tt)*})?[L$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2814		$crate::$macro!(->$name=>$({$($ta)*})?[-L$($t)*])
2815	};
2816	(->$name:expr=>$({$($ta:tt)*})?[M$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2817		$crate::$macro!(->$name=>$({$($ta)*})?[-M$($t)*])
2818	};
2819	(->$name:expr=>$({$($ta:tt)*})?[N$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2820		$crate::$macro!(->$name=>$({$($ta)*})?[-N$($t)*])
2821	};
2822	(->$name:expr=>$({$($ta:tt)*})?[O$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2823		$crate::$macro!(->$name=>$({$($ta)*})?[-O$($t)*])
2824	};
2825	(->$name:expr=>$({$($ta:tt)*})?[P$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2826		$crate::$macro!(->$name=>$({$($ta)*})?[-P$($t)*])
2827	};
2828	(->$name:expr=>$({$($ta:tt)*})?[Q$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2829		$crate::$macro!(->$name=>$({$($ta)*})?[-Q$($t)*])
2830	};
2831	(->$name:expr=>$({$($ta:tt)*})?[R$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2832		$crate::$macro!(->$name=>$({$($ta)*})?[-R$($t)*])
2833	};
2834	(->$name:expr=>$({$($ta:tt)*})?[S$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2835		$crate::$macro!(->$name=>$({$($ta)*})?[-S$($t)*])
2836	};
2837	(->$name:expr=>$({$($ta:tt)*})?[T$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2838		$crate::$macro!(->$name=>$({$($ta)*})?[-T$($t)*])
2839	};
2840	(->$name:expr=>$({$($ta:tt)*})?[U$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2841		$crate::$macro!(->$name=>$({$($ta)*})?[-U$($t)*])
2842	};
2843	(->$name:expr=>$({$($ta:tt)*})?[V$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2844		$crate::$macro!(->$name=>$({$($ta)*})?[-V$($t)*])
2845	};
2846	(->$name:expr=>$({$($ta:tt)*})?[W$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2847		$crate::$macro!(->$name=>$({$($ta)*})?[-W$($t)*])
2848	};
2849	(->$name:expr=>$({$($ta:tt)*})?[X$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2850		$crate::$macro!(->$name=>$({$($ta)*})?[-X$($t)*])
2851	};
2852	(->$name:expr=>$({$($ta:tt)*})?[Y$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2853		$crate::$macro!(->$name=>$({$($ta)*})?[-Y$($t)*])
2854	};
2855	(->$name:expr=>$({$($ta:tt)*})?[Z$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2856		$crate::$macro!(->$name=>$({$($ta)*})?[-Z$($t)*])
2857	};
2858	(->$name:expr=>$({$($ta:tt)*})?[$i:ident$($t:tt)*],$macro:ident$(,$($p:tt)*)?) => {
2859		$crate::$macro!(->$name=>$({$($ta)*})?[$($($p)*)?$i$($t)*])
2860	};
2861}
2862
2863#[macro_export]
2864#[doc(hidden)]
2865// sub macro for flag
2866macro_rules! _fp_ident_ft_assigner {
2867	(->$name:expr=>$({$($ta:tt)*})?[bool$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2868		$crate::$macro!(->$name=>$({$($ta)*})?[>bool$($t)*])
2869	};
2870	(->$name:expr=>$({$($ta:tt)*})?[b$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2871		$crate::$macro!(->$name=>$({$($ta)*})?[>b$($t)*])
2872	};
2873	(->$name:expr=>$({$($ta:tt)*})?[B$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2874		$crate::$macro!(->$name=>$({$($ta)*})?[>B$($t)*])
2875	};
2876	(->$name:expr=>$({$($ta:tt)*})?[Bool$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2877		$crate::$macro!(->$name=>$({$($ta)*})?[>Bool$($t)*])
2878	};
2879	(->$name:expr=>$({$($ta:tt)*})?[int$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2880		$crate::$macro!(->$name=>$({$($ta)*})?[>int$($t)*])
2881	};
2882	(->$name:expr=>$({$($ta:tt)*})?[i$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2883		$crate::$macro!(->$name=>$({$($ta)*})?[>i$($t)*])
2884	};
2885	(->$name:expr=>$({$($ta:tt)*})?[Integer$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2886		$crate::$macro!(->$name=>$({$($ta)*})?[>Integer$($t)*])
2887	};
2888	(->$name:expr=>$({$($ta:tt)*})?[I$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2889		$crate::$macro!(->$name=>$({$($ta)*})?[>I$($t)*])
2890	};
2891	(->$name:expr=>$({$($ta:tt)*})?[integer$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2892		$crate::$macro!(->$name=>$({$($ta)*})?[>integer$($t)*])
2893	};
2894	(->$name:expr=>$({$($ta:tt)*})?[Int$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2895		$crate::$macro!(->$name=>$({$($ta)*})?[>Int$($t)*])
2896	};
2897	(->$name:expr=>$({$($ta:tt)*})?[float$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2898		$crate::$macro!(->$name=>$({$($ta)*})?[>float$($t)*])
2899	};
2900	(->$name:expr=>$({$($ta:tt)*})?[f$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2901		$crate::$macro!(->$name=>$({$($ta)*})?[>f$($t)*])
2902	};
2903	(->$name:expr=>$({$($ta:tt)*})?[F$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2904		$crate::$macro!(->$name=>$({$($ta)*})?[>F$($t)*])
2905	};
2906	(->$name:expr=>$({$($ta:tt)*})?[Float$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2907		$crate::$macro!(->$name=>$({$($ta)*})?[>Float$($t)*])
2908	};
2909	(->$name:expr=>$({$($ta:tt)*})?[Str$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2910		$crate::$macro!(->$name=>$({$($ta)*})?[>Str$($t)*])
2911	};
2912	(->$name:expr=>$({$($ta:tt)*})?[str$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2913		$crate::$macro!(->$name=>$({$($ta)*})?[>str$($t)*])
2914	};
2915	(->$name:expr=>$({$($ta:tt)*})?[s$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2916		$crate::$macro!(->$name=>$({$($ta)*})?[>s$($t)*])
2917	};
2918	(->$name:expr=>$({$($ta:tt)*})?[string]$($t:tt)*)=>{
2919		$crate::$macro!(->$name=>$({$($ta)*})?[>string$($t)*])
2920	};
2921	(->$name:expr=>$({$($ta:tt)*})?[S$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2922		$crate::$macro!(->$name=>$({$($ta)*})?[>String$($t)*])
2923	};
2924	(->$name:expr=>$({$($ta:tt)*})?[String$($t:tt)*],$macro:ident$(,$($p:tt)*)?)=>{
2925		$crate::$macro!(->$name=>$({$($ta)*})?[>String$($t)*])
2926	};
2927	(->$name:expr=>$({$($ta:tt)*})?[$description:ident$($t:tt)*],$macro:ident)=>{
2928		$crate::$macro!(->$name=>$({$($ta)*})?[=$description$($t)*])
2929	};
2930	(->$name:expr=>$({$($ta:tt)*})?[$description:ident$($t:tt)*],$macro:ident,$($p:tt)*)=>{
2931		$crate::$macro!(->$name=>$({$($ta)*})?[$($p)*$description$($t)*])
2932	}
2933}
2934
2935#[macro_export]
2936/// Gets FlagType from keyword
2937macro_rules! flag_type {
2938	(bool) => {
2939		$crate::flag_type!(Bool)
2940	};
2941	(b) => {
2942		$crate::flag_type!(bool)
2943	};
2944	(B) => {
2945		flag_type!(boool)
2946	};
2947	(int) => {
2948		$crate::flag_type!(Int)
2949	};
2950	(i) => {
2951		flag_type!(int)
2952	};
2953	(I) => {
2954		flag_type!(int)
2955	};
2956	(Integer) => {
2957		flag_type!(int)
2958	};
2959	(integer) => {
2960		flag_type!(int)
2961	};
2962	(float) => {
2963		$crate::flag_type!(Float)
2964	};
2965	(f) => {
2966		flag_type!(f)
2967	};
2968	(F) => {
2969		flag_type!(f)
2970	};
2971	(str) => {
2972		$crate::flag_type!(string)
2973	};
2974	(Str) => {
2975		flag_type!(string)
2976	};
2977	(s) => {
2978		flag_type!(str)
2979	};
2980	(S) => {
2981		flag_type!(str)
2982	};
2983	(string) => {
2984		$crate::flag_type!(String)
2985	};
2986	($i:ident) => {
2987		$crate::FlagType::$i
2988	};
2989}
2990
2991#[macro_export]
2992/// Creates flag_value
2993macro_rules! flag_value {
2994	(bool,$val:expr) => {
2995		$crate::FlagValue::Bool($val)
2996	};
2997	(b, $val:expr) => {
2998		$crate::flag_value!(bool, $val)
2999	};
3000	(Bool,$val:expr) => {
3001		$crate::flag_value!(bool, $val)
3002	};
3003	(true) => {
3004		$crate::flag_value!(bool, true)
3005	};
3006	(false) => {
3007		$crate::flag_value!(bool, false)
3008	};
3009	(int, $val:expr) => {
3010		$crate::FlagValue::Int($val)
3011	};
3012	(i, $val:expr) => {
3013		$crate::flag_value!(int, $val)
3014	};
3015	(Int, $val:expr) => {
3016		$crate::flag_value!(int, $val)
3017	};
3018	(Integer, $val:expr) => {
3019		$crate::flag_value!(int, $val)
3020	};
3021	(integer, $val:expr) => {
3022		$crate::flag_value!(int, $val)
3023	};
3024	(float, $val:expr) => {
3025		$crate::FlagValue::Float($val)
3026	};
3027	(f,$val:expr) => {
3028		flag_value!(float, $val)
3029	};
3030	(Float, $val:expr) => {
3031		flag_value!(float, $val)
3032	};
3033	(F, $val:expr) => {
3034		flag_value!(float, $val)
3035	};
3036	(str,$val:literal) => {
3037		$crate::flag_value!(str, $val.into())
3038	};
3039	(str, $val:expr) => {
3040		$crate::FlagValue::String($val)
3041	};
3042	(s,$val:expr) => {
3043		$crate::flag_value!(str, $val)
3044	};
3045	(S,$val:expr) => {
3046		$crate::flag_value!(str, $val)
3047	};
3048	(Str, $val:expr) => {
3049		$crate::flag_value!(str, $val)
3050	};
3051	(String, $val:expr) => {
3052		$crate::flag_value!(str, $val)
3053	};
3054	(string, $val:expr) => {
3055		$crate::flag_value!(str, $val)
3056	};
3057	($i:ident$(,)?) => {
3058		$crate::flag_value!($i, $crate::type_default_value!($i))
3059	};
3060}
3061
3062#[macro_export]
3063/// Creates default_flag_value
3064macro_rules! default_flag_value {
3065	($type:ident) => {
3066		$crate::flag_value!($type, $crate::type_default_value!($type))
3067	};
3068}
3069
3070#[macro_export]
3071/// get Default falue from type
3072macro_rules! type_default_value {
3073	(b) => {
3074		$crate::type_default_value!(bool)
3075	};
3076	(Bool) => {
3077		$crate::type_default_value!(bool)
3078	};
3079	(bool) => {
3080		bool::default()
3081	};
3082	(true) => {
3083		$crate::type_default_value!(bool)
3084	};
3085	(false) => {
3086		$crate::type_default_value!(bool)
3087	};
3088	(i) => {
3089		$crate::type_default_value!(int)
3090	};
3091	(I) => {
3092		$crate::type_default_value!(int)
3093	};
3094	(Int) => {
3095		$crate::type_default_value!(int)
3096	};
3097	(Integer) => {
3098		$crate::type_default_value!(int)
3099	};
3100	(integer) => {
3101		$crate::type_default_value!(int)
3102	};
3103	(int) => {
3104		isize::default()
3105	};
3106	(f) => {
3107		$crate::type_default_value!(float)
3108	};
3109	(F) => {
3110		$crate::type_default_value!(float)
3111	};
3112	(Float) => {
3113		$crate::type_default_value!(float)
3114	};
3115	(float) => {
3116		f64::default()
3117	};
3118	(s) => {
3119		$crate::type_default_value!(str)
3120	};
3121	(S) => {
3122		$crate::type_default_value!(str)
3123	};
3124	(Str) => {
3125		$crate::type_default_value!(str)
3126	};
3127	(String) => {
3128		$crate::type_default_value!(str)
3129	};
3130	(string) => {
3131		$crate::type_default_value!(str)
3132	};
3133	(str) => {
3134		String::default()
3135	};
3136}
3137
3138#[macro_export]
3139/// Creates function returns given string
3140macro_rules! string_fn {
3141	($string:literal) => {
3142		$crate::string_fn!($string.to_owned())
3143	};
3144	($string:expr) => {
3145		|_: &$crate::Command, _: &$crate::Context| -> String { $string }
3146	};
3147	(file_path=>$file_path:expr) => {
3148		$crate::string_fn!(include_str!($file_path).to_owned())
3149	};
3150}
3151
3152#[macro_export]
3153/// create license helper
3154macro_rules! license {
3155	()=>{
3156		$crate::license!(None)
3157	};
3158	(none) => {
3159		$crate::command::License(None)
3160	};
3161	(None) => {
3162		$crate::command::License(None)
3163	};
3164	($expr:expr, $content:literal)=>{
3165		$crate::license!($expr,->$content)
3166	};
3167	($expr:literal, $fn:expr)=>{
3168		$crate::license!($expr.into(),$fn)
3169	};
3170	($expr:expr,$fn:expr)=>{
3171		$crate::command::License(Some(($expr,$fn)))
3172	};
3173	($expr:expr,fp:$file_path:expr)=>{
3174		$crate::license!($expr,file_path=>$file_path)
3175	};
3176	($expr:expr,:$file_path:expr)=>{
3177		$crate::license!($expr,fp:$file_path)
3178	};
3179	($expr:expr,outputter=>$fn:expr)=>{
3180		$crate::license!($expr,$fn)
3181	};
3182	($expr:expr, ->$content_result:literal)=>{
3183		$crate::license!($expr,$crate::string_fn!($content_result))
3184	};
3185	($expr:expr, ->$content_result:expr)=>{
3186		$crate::license!($expr,$crate::string_fn!($content_result))
3187	};
3188	($expr:expr, content=>$content:literal) => {
3189		$crate::license!($expr, $crate::string_fn!($content))
3190	};
3191	($expr:expr, content=>$content:expr) => {
3192		$crate::license!($expr, $crate::string_fn!($content))
3193	};
3194	($expr:expr, file_path=>$file_path:expr) => {
3195		$crate::license!($expr, $crate::string_fn!(file_path=>$file_path))
3196	};
3197	($expr:expr, $c:expr$(,)?)=>{
3198		$crate::license!($expr,$c)
3199	};
3200	($expr:expr, $i:ident=>$c:expr$(,)?)=>{
3201		$crate::license!($expr,$i=>$c)
3202	};
3203	(expr=>$expr:expr, $c:expr$(,)?)=>{
3204		$crate::license!($expr,$c)
3205	};
3206	(expr=>$expr:expr, $i:ident=>$c:expr$(,)?)=>{
3207		$crate::license!($expr,$i=>$c)
3208	};
3209	(->$license:expr)=>{
3210		$license
3211	};
3212}
3213
3214/// Preset of help command
3215#[macro_export]
3216macro_rules! preset_help_command {
3217	($help_func:ident) => {
3218		Command::with_all_field(
3219			String::from("help"),
3220			Some($crate::help_command_action!($help_func)),
3221			String::default(),
3222			String::default(),
3223			$crate::command::License::default(),
3224			Some("show help".into()),
3225			String::from("help <sub command>"),
3226			$crate::Vector::default(),
3227			$crate::Vector::default(),
3228			$crate::Vector::default(),
3229			String::default(),
3230			$crate::Vector::default(),
3231		)
3232	};
3233}
3234
3235/// Print preset help shortcut
3236#[macro_export]
3237macro_rules! output_help {
3238	() => {
3239		$crate::output_help!(cmd, ctx)
3240	};
3241	(false) => {
3242		$crate::output_help!(cmd, ctx, false)
3243	};
3244	($cmd:expr,$ctx:expr,false) => {
3245		$crate::output_help!(help_tablize_with_alias_dedup, $cmd, $ctx, false)
3246	};
3247	($cmd:expr,$ctx:expr) => {
3248		$crate::output_help!(help_tablize_with_alias_dedup, $cmd, $ctx)
3249	};
3250	($func:ident,$cmd:expr,$ctx:expr) => {
3251		$crate::output_help!($func, $cmd, $ctx, true)
3252	};
3253	($func:ident,$cmd:expr,$ctx:expr, true) => {
3254		println!("{}", $crate::command::presets::func::$func($cmd, $ctx));
3255	};
3256	($func:ident,$cmd:expr,$ctx:expr, false) => {
3257		$crate::command::presets::func::$func($cmd, $ctx)
3258	};
3259}
3260
3261#[cfg(test)]
3262mod tests {
3263	use std::collections::VecDeque;
3264
3265	use crate::{command::License, Command, Context, Flag, FlagType, FlagValue, Vector};
3266
3267	macro_rules! assert_eqs {
3268		($left:expr,$($right:expr),+$(,)?) => {
3269			$(assert_eq!($left,$right);)+
3270		};
3271	}
3272
3273	#[test]
3274	fn vector_macro_test() {
3275		assert_eqs!(
3276			Vector::<String>(None),
3277			v!(),
3278			v!(None),
3279			v!(None; :String),
3280			v!(::<String>)
3281		);
3282		let _r: Vector<String> = Vector(Some(vec!["a".to_owned(), "b".to_owned(), "c".to_owned()]));
3283		assert_eq!(_r, v!("a".to_owned(), "b".to_owned(), "c".to_owned()));
3284		assert_eq!(_r, v!("a".to_owned(), "b".to_owned(), "c".to_owned(),));
3285		assert_eq!(
3286			_r,
3287			v!("a".to_owned(), "b".to_owned(), "c".to_owned();:String)
3288		);
3289		assert_eq!(_r, v!["a","b","c";=>String]);
3290		assert_eq!(_r, v!["a","b","c",;=>String]);
3291		let _r: Vector<String> = Vector(Some(vec!["a".to_owned(), "a".to_owned(), "a".to_owned()]));
3292	}
3293	#[test]
3294	fn short_alias_macro_test() {
3295		let _r = v!('a', 'b', 'c');
3296		assert_eqs!(
3297			_r,
3298			short_alias![a, -b, c],
3299			short_alias!('a' 'b' 'c'),
3300			short_alias!['a' b c],
3301			short_alias![-a,-'b' c],
3302			short_alias!(a b,'c')
3303		);
3304		let _r = v!('s', 'f');
3305		assert_eqs!(_r, short_alias!('s', 'f'), short_alias!('s' 'f'));
3306	}
3307
3308	#[test]
3309	fn long_alias_macro_test() {
3310		let _r = v!["aaa","bbb","ccc";=>String];
3311		assert_eq!(_r, long_alias!(--aaa, --bbb, --ccc));
3312		assert_eq!(_r, long_alias!(aaa, bbb, ccc));
3313		assert_eq!(_r, long_alias!(--aaa, bbb, ccc));
3314		assert_eq!(_r, long_alias!(--"aaa", --"bbb", --"ccc"));
3315		assert_eq!(_r, long_alias!(aaa, "bbb", ccc));
3316		assert_eq!(_r, long_alias!(aaa, "bbb", --ccc));
3317		assert_eq!(_r, long_alias!(--aaa, --"bbb", ccc));
3318	}
3319
3320	#[test]
3321	fn version_macro_test() {
3322		assert_eqs!(crate_version!(), version!(...), version!(from_crate));
3323		assert_eq!(String::from("0.1.2"), version!("0.1.2"));
3324		assert_eq!(String::from("0.1.2"), version!(0.1.2));
3325		assert_eqs!("0.1.2".to_owned(), version!(0 1 2), version!(0, 1, 2),);
3326		assert_eqs!(
3327			"0.1.2 aaa".to_owned(),
3328			version!(0 1 2 aaa),
3329			version!(0, 1, 2 aaa),
3330			version!(0 1 2 "aaa"),
3331			version!(0, 1, 2 "aaa"),
3332		);
3333	}
3334
3335	#[test]
3336	fn flag_test() {
3337		let _t = "test";
3338		let _t_string = String::from(_t);
3339		let full = Flag {
3340			name: "test_flag".into(),
3341			description: "test".into(),
3342			short_alias: Vector(Some(vec!['s', 'f'])),
3343			long_alias: Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3344			default_value: FlagValue::Bool(false),
3345			flag_type: FlagType::Bool,
3346		};
3347		let _flag_name = String::from("test_flag");
3348		let _flag_name2 = _flag_name.clone();
3349		let _flag_name3 = _flag_name.clone();
3350		assert_eqs!(
3351			full.clone(),
3352			flag!(->String::from("test_flag")=>[
3353				=String::from("test"),
3354				Vector(Some(vec!['s', 'f'])),
3355				Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3356				FlagType::Bool,
3357				FlagValue::Bool(false)
3358			]),
3359			flag!(@->String::from("test_flag")=>[
3360					=String::from("test"),
3361					Vector(Some(vec!['s', 'f'])),
3362					Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3363					FlagType::Bool,
3364					FlagValue::Bool(false)
3365				]
3366			),
3367			flag!(->[String::from("test_flag")]=>[
3368					=String::from(_t),
3369					Vector(Some(vec!['s', 'f'])),
3370					Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3371					FlagType::Bool,
3372					FlagValue::Bool(false)
3373				]
3374			),
3375			flag!([->String::from("test_flag")]=>[
3376					=String::from(_t),
3377					Vector(Some(vec!['s', 'f'])),
3378					Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3379					FlagType::Bool,
3380					FlagValue::Bool(false)
3381				]
3382			),
3383			flag!([->String::from("test_flag")][
3384					=String::from(_t),
3385					Vector(Some(vec!['s', 'f'])),
3386					Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3387					FlagType::Bool,
3388					FlagValue::Bool(false)
3389				]
3390			),
3391			flag!(&String::from("test_flag")=>[
3392					=String::from(_t),
3393					Vector(Some(vec!['s', 'f'])),
3394					Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3395					FlagType::Bool,
3396					FlagValue::Bool(false)
3397				]
3398			),
3399			flag!("test_flag"=>[
3400				=String::from(_t),
3401				Vector(Some(vec!['s', 'f'])),
3402				Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3403				FlagType::Bool,
3404				FlagValue::Bool(false)
3405			]),
3406			flag!(&_flag_name=>[
3407				=String::from(_t),
3408				Vector(Some(vec!['s', 'f'])),
3409				Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3410				FlagType::Bool,
3411				FlagValue::Bool(false)
3412			]),
3413			flag!(
3414				&_flag_name2 = [
3415					=String::from(_t),
3416					Vector(Some(vec!['s', 'f'])),
3417					Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3418					FlagType::Bool,
3419					FlagValue::Bool(false)
3420				]
3421			),
3422			flag!(
3423				&_flag_name3[
3424					=String::from(_t),
3425					Vector(Some(vec!['s', 'f'])),
3426					Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3427					FlagType::Bool,
3428					FlagValue::Bool(false)
3429				]
3430			),
3431			flag!(test_flag=>[
3432				=String::from(_t),
3433				Vector(Some(vec!['s', 'f'])),
3434				Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3435				FlagType::Bool,
3436				FlagValue::Bool(false)
3437			]),
3438			flag!(test_flag[
3439				=String::from(_t),
3440				Vector(Some(vec!['s', 'f'])),
3441				Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3442				FlagType::Bool,
3443				FlagValue::Bool(false)
3444			]),
3445			flag!(
3446				[test_flag][
3447					=String::from(_t),
3448					Vector(Some(vec!['s', 'f'])),
3449					Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3450					FlagType::Bool,
3451					FlagValue::Bool(false)
3452				]
3453			),
3454			flag!(
3455				[test_flag]=>[
3456					=String::from(_t),
3457					Vector(Some(vec!['s', 'f'])),
3458					Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3459					FlagType::Bool,
3460					FlagValue::Bool(false)
3461				]
3462			),
3463			flag!(
3464				[test_flag] = [
3465					=String::from(_t),
3466					Vector(Some(vec!['s', 'f'])),
3467					Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3468					FlagType::Bool,
3469					FlagValue::Bool(false)
3470				]
3471			),
3472		);
3473		let _f = String::from("test_flag");
3474		assert_eqs!(
3475			Flag::with_name("test_flag"),
3476			flag!(->String::from("test_flag")),
3477			flag!([->String::from("test_flag")]),
3478			flag!(->[String::from("test_flag")]),
3479			flag!("test_flag"),
3480			flag!("test_flag"=>),
3481			flag!(test_flag),
3482			flag!(->_f),
3483		);
3484		assert_eqs!(
3485			full.clone(),
3486			flag!(test_flag=>[
3487				bool,
3488				_t,
3489				Vector(Some(vec!['s', 'f'])),
3490				Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3491				?false
3492				]
3493			),
3494		);
3495		assert_eqs!(
3496			full.clone(),
3497			flag!(test_flag=>[
3498				bool,
3499				_t,
3500				Vector(Some(vec!['s', 'f'])),
3501				Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3502				?false
3503				]
3504			),
3505			flag!(test_flag=>[
3506				>bool,
3507				=_t,
3508				s~Vector(Some(vec!['s', 'f'])),
3509				l~Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3510				?false
3511				]
3512			),
3513			flag!(test_flag=>[
3514				>bool,
3515				=_t,
3516				l~Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3517				s~Vector(Some(vec!['s', 'f'])),
3518				?false
3519				]
3520			),
3521			flag!(test_flag=>[
3522				_t,
3523				>bool,
3524				l~Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3525				s~Vector(Some(vec!['s', 'f'])),
3526				?false
3527				]
3528			),
3529		);
3530		assert_eqs!(
3531			full.clone(),
3532			flag!(test_flag=>[
3533			bool,
3534			_t,
3535			-[-s,-f],
3536			Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3537			?false]),
3538			flag!(test_flag=>[
3539			bool,
3540			_t,
3541			s~[s, f],
3542			Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3543			?false]),
3544			flag!(test_flag=>[
3545			bool,
3546			_t,
3547			['s', 'f'],
3548			Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3549			?false]),
3550			flag!(test_flag=>[
3551			bool,
3552			_t,
3553			-[s f],
3554			--["long", "long2"],
3555			?false]),
3556			flag!(test_flag=>[
3557			>bool,
3558			=_t,
3559			-s,-f,
3560			Vector(Some(vec!["long".to_owned(), "long2".to_owned()])),
3561			?false]),
3562			flag!(test_flag=>[
3563				>bool,
3564				=_t,
3565				-s f,
3566				[long long2],
3567				?false]),
3568			flag!(test_flag=>[
3569				bool,
3570				=_t,
3571				-s -f,
3572				--long long2,
3573				?false]),
3574			flag!(test_flag=>[
3575				>bool,
3576				=[->String::from(_t)],
3577				-s,f,
3578				--long long2]),
3579			flag!(test_flag=>[
3580				bool,
3581				=[->_t.into()],
3582				-s -f,
3583				--long long2,]),
3584		);
3585		assert_eqs!(
3586			full.clone(),
3587			flag!(test_flag=>[
3588				=_t,
3589				-s,-f,
3590				--[long,long2],
3591				bool?false
3592			]),
3593			flag!([test_flag=>[
3594				=_t,
3595				s~Vector(Some(vec!['s', 'f'])),
3596				--[long, long2],
3597				>bool?false
3598			]]),
3599			flag!(test_flag[
3600				=_t,
3601				s~[s f],
3602				[long long2],
3603				>bool?false
3604			]),
3605			flag!(test_flag[
3606				=_t,
3607				-s ,-f,
3608				--long long2,
3609				bool?false
3610			]),
3611		);
3612
3613		assert_eqs!(
3614			full.clone().short_alias('a'),
3615			flag!(test_flag=>[
3616			>bool,
3617			=_t,
3618			-s f a,
3619			--long long2]),
3620			flag!(test_flag=>[
3621				>bool,
3622				=_t,
3623				-s,f -a,
3624				--long long2 ?false]),
3625			flag!(test_flag=>[
3626			>bool?false,
3627			_t,
3628			-s,f -a,
3629			--long, long2
3630			]),
3631			flag!(test_flag=>[
3632				>bool,
3633				_t,
3634				-s,f,a,
3635				--[long, long2],
3636				?false]),
3637			flag!([test_flag=>[
3638				>bool,
3639				_t,
3640				-s,f,a,
3641				--[long, long2],
3642				?false]]),
3643		);
3644		assert_eqs!(
3645			{
3646				let mut f = full.clone().short_alias('a');
3647				f.long_alias.take();
3648				f
3649			},
3650			flag!(test_flag=>[
3651				>bool,
3652				=_t,
3653				-s f a,
3654				?false
3655			]),
3656			flag!(test_flag=>[
3657				>bool?false,
3658				=_t,
3659				Vector(Some(vec!['s', 'f','a']))
3660			]),
3661			flag!(test_flag=>[
3662				>bool,
3663				=_t,
3664				-s,f,a,
3665				?false
3666			]),
3667			flag!(test_flag=>[
3668				>bool,
3669				=_t,
3670				-s,f,a ?false
3671			]),
3672			flag!(test_flag=>[
3673				>bool?false,
3674				=_t,
3675				-s,f,a
3676			])
3677		);
3678		let mut s = full.clone();
3679		s.long_alias.take();
3680		assert_eq!(s, flag!(test_flag=>[bool,_t,-s,-f,?false]));
3681		s.short_alias.take();
3682		assert_eqs!(
3683			s,
3684			flag!(test_flag=>[bool,_t]),
3685			flag!(test_flag=>[bool,_t,[],[]]),
3686			flag!(test_flag=>[bool,_t,[]]),
3687			flag!(test_flag=>[>bool,=_t,false]),
3688			flag!(test_flag=>[bool,_t,?]),
3689			flag!(test_flag=>[>bool,_t,?false])
3690		);
3691		assert_eqs!(
3692			full.clone().description(""),
3693			flag!(test_flag=>[bool,=,-s,-f,--long,--long2,?false]),
3694			flag!(test_flag=>[bool,= -s -f --long --long2 ?false])
3695		);
3696		assert_eq!(
3697			{
3698				let mut f = full.clone().description("");
3699				f.long_alias.take();
3700				f
3701			},
3702			flag!(test_flag=>[bool,,-s,-f,?false])
3703		);
3704		assert_eqs!(
3705			Flag::with_all_field(
3706				"test_flag".into(),
3707				"aaa".into(),
3708				Vector(None),
3709				Vector(None),
3710				FlagType::Bool,
3711				FlagValue::Bool(false)
3712			),
3713			flag!(test_flag=>[bool,"aaa",?false]),
3714			flag!(test_flag=>[bool,"aaa",@false]),
3715			flag!(test_flag=>[Bool,"aaa",false]),
3716			flag!(test_flag=>[Bool,"aaa"])
3717		);
3718		assert_eqs!(
3719			Flag::new_bool("test_flag"),
3720			flag!(test_flag=>[>bool,]),
3721			flag!(test_flag=>[>bool]),
3722			flag!(test_flag=>[>Bool]),
3723			flag!(test_flag=>[bool,,?false]),
3724			flag!(test_flag=>[bool,,false])
3725		);
3726		assert_eqs!(
3727			Flag::new_bool("test_flag").description("desc"),
3728			flag!(test_flag=>[bool,="desc",?false]),
3729			flag!(test_flag=>[="desc",?false]),
3730			flag!(test_flag=>[="desc",bool?false]),
3731			flag!(test_flag=>[="desc",bool]),
3732		);
3733		let _i = "desc_only";
3734		assert_eqs!(
3735			Flag::new_string("test_flag").description(_i),
3736			flag!(test_flag=>[_i])
3737		);
3738		assert_eqs!(
3739			Flag::new_bool("test_flag")
3740				.description("test")
3741				.short_alias('s')
3742				.short_alias('f'),
3743			flag!(test_flag[bool,"test",-s f]),
3744			flag!(test_flag=>[="test",-s,-f, >bool?false]),
3745			flag!(test_flag=>[="test",-s,-f, ?false])
3746		);
3747		let _t = "desc";
3748		assert_eqs!(
3749			{ full.clone().description("desc") },
3750			flag!(test_flag=>[="desc",-s,-f,--long,--long2,>bool?false]),
3751			flag!(test_flag=>[="desc",-s,-f,--long,--long2 bool?false]),
3752			flag!(test_flag=>[="desc",-s,-f,--long,--long2,bool?false]),
3753			flag!(test_flag=>[="desc",-s,-f,--long,--long2 bool]),
3754			flag!(test_flag=>[="desc",-s,-f,--long,--long2,bool]),
3755			flag!(test_flag:[="desc",-s,-f,--long,--long2,?false]),
3756			flag!(test_flag=[="desc",-s,-f,--long,--long2 ?false]),
3757			flag!(test_flag[-s,f,--long,--long2,="desc",bool?false]),
3758			flag!(test_flag[-s,f,--long,--long2,="desc",bool?false]),
3759			flag!(test_flag=>[-s,-f,--long,--long2,="desc",bool]),
3760			flag!(test_flag=>[bool,"desc",-s,-f,--long,--long2,?false]),
3761			flag!(test_flag[bool,-s,-f,--long,--long2,=_t,?false]),
3762			flag!(test_flag=>[bool,-s,-f,--long,--long2,="desc",?false])
3763		);
3764		assert_eqs!(
3765			{ full.clone().description("desc") },
3766			flag!(test_flag=>[="desc",-s,-f,--long,--long2,>bool?false]),
3767			flag!(test_flag=>[="desc" -s -f --long --long2 >bool?false]),
3768			flag!(test_flag=>[="desc" -s -f --long --long2 >bool?false]),
3769			flag!(test_flag=>[_t -s -f --long --long2 bool?false]),
3770			flag!(test_flag=>[>bool =_t -s -f --long --long2 ?false]),
3771			flag!(test_flag=>[bool =_t -s -f --long --long2 ?false]),
3772		);
3773		assert_eqs!(
3774			Flag::new("test_flag", FlagType::Bool, "desc")
3775				.short_alias('s')
3776				.short_alias('f'),
3777			flag!(test_flag=>[="desc",-s,-f, bool]),
3778			flag!(test_flag=>["desc",-s,-f, bool]),
3779			flag!(test_flag=>[="desc",-s,-f,?false]),
3780			flag!(test_flag=>[bool,-s,-f,="desc",?false])
3781		);
3782		assert_eqs!(
3783			Flag::new("test_flag", FlagType::Bool, "desc"),
3784			flag!(test_flag=>["desc",?false]),
3785			flag!(test_flag["desc",b])
3786		);
3787		assert_eqs!(
3788			Flag::new_string("test_flag").description("desc"),
3789			flag!(test_flag["desc"]),
3790			flag!(test_flag[_t]),
3791		);
3792		assert_eqs!(
3793			Flag::new_string("test_flag")
3794				.description("aaa")
3795				.default_value("aaa".to_owned().into()),
3796			flag!(test_flag=>[str,"aaa","aaa"]),
3797			flag!(test_flag[>str,"aaa","aaa"]),
3798			flag!(test_flag[>str?"aaa","aaa"])
3799		);
3800		assert_eqs!(
3801			{
3802				let mut f = full.clone().description("desc");
3803				f.short_alias.take();
3804				f
3805			},
3806			flag!(test_flag=>[bool,_t,--long,--long2,?false])
3807		);
3808		assert_eqs!(
3809			full.clone(),
3810			flag!([test_flag][bool, -s,-f,--long,--long2,="test",false]),
3811			flag!(*test_flag[bool, -s,-f,--long,--long2,="test",false]),
3812			flag!(test_flag{bool, -s,-f,--long,--long2,="test",false}),
3813			flag!(*test_flag{bool, -s,-f,--long,--long2,="test",false}),
3814			flag!(@[String::from("test_flag")]=>{bool, -s,-f,--long,--long2,="test",false}),
3815			flag!([test_flag]=>{bool, -s,-f,--long long2 ="test",false}),
3816			flag!([test_flag]=>{bool, -[s,'f'],--long long2 ="test",false}),
3817		);
3818		assert_eqs!(
3819			full,
3820			flag!([test_flag]
3821			[>bool]
3822			[-s -f]
3823			[--long --long2]
3824			[="test"]
3825			[?false]
3826			),
3827			flag!([test_flag]
3828			[bool]
3829			[="test"]
3830			[-s -f]
3831			[--long --long2]
3832			[false]
3833			),
3834			flag!(test_flag:
3835			[bool]
3836			[="test"]
3837			[-s -f]
3838			[--long --long2]
3839			[false]
3840			),
3841			flag!(test_flag
3842			[bool]
3843			[="test"]
3844			[-s -f]
3845			[--long --long2]
3846			[?false]
3847			),
3848		);
3849		assert_eqs!(
3850			Flag::with_all_field(
3851				"test_flag".into(),
3852				String::from("test"),
3853				vector!['e';:char],
3854				Vector(None),
3855				FlagType::Bool,
3856				FlagValue::Bool(false),
3857			),
3858			flag![[test_flag][>bool ="test" -e ?false]],
3859			flag![[test_flag][bool][="test"][-e][?false]],
3860			flag![[test_flag][>bool?false][="test"][-e]],
3861		);
3862		assert_eqs!(
3863			Flag::with_all_field(
3864				"length".into(),
3865				String::from("length"),
3866				vector!['l';:char],
3867				Vector(None),
3868				FlagType::Int,
3869				FlagValue::Int(20),
3870			),
3871			flag!([length]=>[>int,="length",-l,20]),
3872		);
3873		assert_eqs!(
3874			Flag::with_all_field(
3875				"length".into(),
3876				String::from("length"),
3877				vector!['l';:char],
3878				Vector(None),
3879				FlagType::Int,
3880				FlagValue::Int(20),
3881			),
3882			flag!([length]=>[>int?20,="length",-l]),
3883		);
3884	}
3885
3886	#[test]
3887	fn flags_marco_test() {
3888		assert_eqs!(vector!(None;:Flag), flags!(), flags!(None));
3889		let _r = Vector(Some(vec![
3890			flag!(test_flag[>bool?false,-s,-f,="test"]),
3891			flag!(test_flag2[>bool?false,="test2",-t]),
3892			Flag::with_all_field(
3893				"test_flag3".into(),
3894				String::from("test3"),
3895				vector!['e';:char],
3896				Vector(None),
3897				FlagType::Bool,
3898				FlagValue::Bool(false),
3899			),
3900		]));
3901		assert_eqs!(
3902			_r.clone(),
3903			flags!(
3904				[test_flag[>bool?false,-s,-f,="test"]],
3905				[test_flag2=>[>bool?false,="test2" -t]],
3906				[[test_flag3][>bool][="test3"][-e][?false]]
3907			),
3908		);
3909		assert_eq!(
3910			_r.clone(),
3911			flags!(
3912				test_flag[>bool?false,-s,-f,="test"],
3913				test_flag2[>bool?false,="test2" -t],
3914				test_flag3[>bool ="test3" -e ?false],
3915			)
3916		);
3917
3918		let _r = vector!(help_flag!());
3919		assert_eq!(_r.clone(), flags!([help]));
3920		assert_eq!(_r.clone(), flags!(help));
3921	}
3922
3923	fn get_context_for_test() -> Context {
3924		let _r = License::new(Some(("test".into(), |_, _| -> String {
3925			"test_license_content".to_owned()
3926		})));
3927		Context::new(
3928			vec!["raw".into(), "arg".into(), "test".into()],
3929			VecDeque::default(),
3930			Vector::default(),
3931			Vector::default(),
3932			"exe_path".into(),
3933		)
3934	}
3935
3936	#[test]
3937	fn license_macro_test() {
3938		let _r = License::new(Some(("test".into(), |_, _| -> String {
3939			"test_license_content".to_owned()
3940		})));
3941		let _c = get_context_for_test();
3942		let _cmd = Command::with_name("test");
3943
3944		let comp = |left: &License, right: &License, cmd: &Command, c: &Context| {
3945			assert_eq!(left.expr(), right.expr());
3946			assert_eq!(left.output(cmd, c), right.output(cmd, c));
3947		};
3948		comp(&_r, &license!("test",->"test_license_content"), &_cmd, &_c);
3949		comp(
3950			&_r,
3951			&license!("test",->"test_license_content".to_owned()),
3952			&_cmd,
3953			&_c,
3954		);
3955		comp(&_r, &license!("test", "test_license_content"), &_cmd, &_c);
3956		comp(
3957			&_r,
3958			&license!("test", string_fn!("test_license_content".to_owned())),
3959			&_cmd,
3960			&_c,
3961		);
3962		comp(
3963			&_r,
3964			&license!("test", |_, _| -> String { "test_license_content".into() }),
3965			&_cmd,
3966			&_c,
3967		);
3968		comp(
3969			&_r,
3970			&license!(expr=>"test", outputter=>|_,_| -> String {
3971				"test_license_content".into()
3972			}),
3973			&_cmd,
3974			&_c,
3975		);
3976	}
3977
3978	fn compare_cmd(left: Command, right: Command, c: Context) {
3979		assert_eq!(left.name, right.name);
3980		match (left.action, right.action) {
3981			(Some(la), Some(ra)) => {
3982				assert!(la(left.clone(), c.clone()).unwrap().is_done());
3983				assert!(ra(right.clone(), c.clone()).unwrap().is_done());
3984				assert_eq!(la, ra);
3985				assert_eq!(la as usize, ra as usize);
3986			}
3987			(None, None) => {}
3988			(None, Some(_)) => {
3989				panic!("action is not equal")
3990			}
3991			(Some(_), None) => {
3992				panic!("action is not equal")
3993			}
3994		}
3995		assert_eq!(left.authors, right.authors);
3996		assert_eq!(left.copyright, right.copyright);
3997		assert_eqs!(left.license.expr(), right.license.expr());
3998		assert_eq!(
3999			left.license.output(&left, &c),
4000			right.license.output(&right, &c)
4001		);
4002		match (left.license.output_fn(), right.license.output_fn()) {
4003			(Some(_loutput), Some(_routput)) => {
4004				//assert_eq!(_loutput as usize, _routput as usize);
4005			}
4006			(None, None) => {}
4007			(_, _) => {
4008				panic!("license output_fn not match!")
4009			}
4010		}
4011		assert_eq!(left.description, right.description);
4012		assert_eq!(left.usage, right.usage);
4013		assert_eq!(left.alias, right.alias);
4014		assert_eq!(left.version, right.version);
4015		match (left.sub, right.sub) {
4016			(Vector(None), Vector(None)) => {}
4017			(Vector(Some(lsub)), Vector(Some(rsub))) => {
4018				for (index, lsc) in lsub.iter().enumerate() {
4019					compare_cmd(lsc.clone(), rsub[index].clone(), c.clone())
4020				}
4021			}
4022			(_, _) => {
4023				panic!("sub commands does not match");
4024			}
4025		}
4026	}
4027
4028	macro_rules! compare_cmds{
4029		($c:expr,$left:expr, $($right:expr),+$(,)?)=>{
4030			$(compare_cmd($left,$right,$c);)+
4031		}
4032	}
4033
4034	#[test]
4035	fn cmd_macro_test() {
4036		let act = |_, c: Context| -> action_result!() {
4037			println!("action!{:?}", c);
4038			assert_eq!(
4039				c.raw_args,
4040				vec!["raw".to_owned(), "arg".to_owned(), "test".to_owned()]
4041			);
4042			done!()
4043		};
4044		let _l = license!("test_license",->"test_license_fn");
4045		let _lsub = license!("test_license_sub",->"test_license_fn_sub");
4046		let _lleaf = license!("test_license_sub2",->"test_license_fn_sub2");
4047		let leaf = Command::with_name("leaf")
4048			.action(|c, _| {
4049				println!("Context: {:?}", c);
4050				done!()
4051			})
4052			.license(_lleaf.clone());
4053		let sub = Command::with_name("sub")
4054			.local_flag(Flag::new_bool("sub_local"))
4055			.local_flag(Flag::new_string("sub_lstr"))
4056			.common_flag(Flag::new_bool("sub_common"))
4057			.local_flag(Flag::new_string("sub_cstr"))
4058			.action(|_, _| {
4059				println!("sub");
4060				done!()
4061			})
4062			.sub_command(leaf)
4063			.license(_lsub.clone());
4064		let sub2_act = |_, _| {
4065			println!("sub2");
4066			done!()
4067		};
4068		let sub2 = Command::with_name("sub2").action(sub2_act);
4069		let _r = Command::with_all_field(
4070			"test".into(),
4071			Some(act),
4072			"suquiya test".into(),
4073			"suquiya".into(),
4074			_l.clone(),
4075			Some("test_command".into()),
4076			"test_usage".into(),
4077			flags!({tlf[="test_local_flag" -l >bool?false]}),
4078			flags!({tcf[="test_common_flag" -c >bool?false]}),
4079			Vector(Some(vec!["alias".into(), "alias2".into()])),
4080			"0.0.1".into(),
4081			vector![sub.clone(),sub2.clone();:Command],
4082		);
4083		let _c = get_context_for_test();
4084
4085		compare_cmd(
4086			_r.clone(),
4087			cmd!("test":[
4088				>act,
4089				<["suquiya test"],
4090				@["suquiya"],
4091				@[->_l.clone()],
4092				=["test_command"],
4093				:["test_usage"],
4094				l~{tlf[="test_local_flag" -l >bool?false]},
4095				c~{tcf[="test_common_flag" -c >bool?false]},
4096				&["alias", "alias2"],
4097				n ["0.0.1"],
4098				+ [sub.clone(),sub2.clone();:Command],
4099			]),
4100			_c.clone(),
4101		);
4102
4103		compare_cmd(
4104			_r.clone(),
4105			cmd!(test:[
4106				>act,
4107				<["suquiya test"],
4108				@["suquiya"],
4109				@[->_l.clone()],
4110				=["test_command"],
4111				:["test_usage"],
4112				l~flags!({tlf[="test_local_flag" -l >bool?false]}),
4113				c~flags!({tcf[="test_common_flag" -c >bool?false]}),
4114				&Vector(Some(vec!["alias".into(), "alias2".into()])),
4115				n ["0.0.1"],
4116				+ vector![sub.clone(),sub2.clone();:Command],
4117			]),
4118			_c.clone(),
4119		);
4120
4121		compare_cmd(
4122			_r.clone(),
4123			cmd!(test[
4124				>>act,
4125				<"suquiya test",
4126				@"suquiya",
4127				@[->_l.clone()],
4128				="test_command",
4129				:"test_usage",
4130				l~flags!({tlf[="test_local_flag" -l >bool?false]}),
4131				c~flags!({tcf[="test_common_flag" -c >bool?false]}),
4132				&Vector(Some(vec!["alias".into(), "alias2".into()])),
4133				n "0.0.1",
4134				+ vector![sub.clone(),sub2.clone();:Command],
4135			]),
4136			_c.clone(),
4137		);
4138
4139		compare_cmds!(
4140			_c.clone(),
4141			_r.clone().authors("suquiya").copyright("suquiya copyright"),
4142			cmd!(test[
4143				>act,
4144				<"suquiya",
4145				@"suquiya copyright",
4146				@_l.clone(),
4147				="test_command",
4148				:"test_usage",
4149				l~flags!({tlf[="test_local_flag" -l >bool?false]}),
4150				c~flags!({tcf[="test_common_flag" -c >bool?false]}),
4151				&Vector(Some(vec!["alias".into(), "alias2".into()])),
4152				n "0.0.1",
4153				+ vector![sub.clone(),sub2.clone();:Command],
4154			]),
4155		);
4156
4157		let r = _r
4158			.clone()
4159			.authors(crate_authors!())
4160			.copyright("suquiya copyright");
4161		compare_cmds!(
4162			_c.clone(),
4163			r.clone(),
4164			cmd!(test[
4165				>act,
4166				<crate_authors!(),
4167				@"suquiya copyright",
4168				@_l.clone(),
4169				="test_command",
4170				:"test_usage",
4171				l~flags!({tlf[="test_local_flag" -l >bool?false]}),
4172				c~flags!({tcf[="test_common_flag" -c >bool?false]}),
4173				&vector!["alias".into(), "alias2".into()],
4174				n "0.0.1",
4175				+ vector![sub.clone(),sub2.clone();:Command],
4176			]),
4177			cmd!("test"[
4178				>act
4179				<crate_authors!(),
4180				@"suquiya copyright",
4181				@["test_license",->"test_license_fn"],
4182				="test_command",
4183				:"test_usage",
4184				l~flags!({tlf[="test_local_flag" -l >bool?false]}),
4185				c~flags!({tcf[="test_common_flag" -c >bool?false]}),
4186				&[alias, alias2],
4187				n "0.0.1",
4188				+ [sub.clone(),sub2.clone();:Command],
4189			]),
4190			cmd!("test"[
4191				>act
4192				<crate_authors!(),
4193				@"suquiya copyright",
4194				@"test_license","test_license_fn",
4195				="test_command",
4196				:"test_usage",
4197				l~({tlf[="test_local_flag" -l >bool?false]}),
4198				c~({tcf[="test_common_flag" -c >bool?false]}),
4199				&[alias, alias2],
4200				n "0.0.1",
4201				+ [sub.clone(),sub2.clone()],
4202			]),
4203			cmd!("test"[
4204				>act
4205				<crate_authors!(),
4206				@"suquiya copyright",
4207				@"test_license","test_license_fn",
4208				="test_command",
4209				:"test_usage",
4210				l~({tlf[="test_local_flag" -l >bool?false]}),
4211				c~({tcf[="test_common_flag" -c >bool?false]}),
4212				&alias alias2,
4213				n "0.0.1",
4214				+ [sub.clone(),sub2.clone()],
4215			]),
4216			cmd!("test"[
4217				>act
4218				<crate_authors!(),
4219				@"suquiya copyright",
4220				@"test_license","test_license_fn",
4221				="test_command",
4222				:"test_usage",
4223				l~{tlf[="test_local_flag" -l >bool?false]},
4224				c~{tcf[="test_common_flag" -c >bool?false]},
4225				&alias,
4226				&alias2,
4227				n "0.0.1",
4228				+ sub.clone(),
4229				+ sub2.clone(),
4230			]),
4231		);
4232
4233		let _r = r.clone().copyright(copyright![2020, "suquiya"]);
4234		compare_cmd(
4235			_r.clone(),
4236			cmd!("test"[
4237				action=>act
4238				authors=crate_authors!(),
4239				(c)2020,"suquiya";
4240				(l)"test_license" "test_license_fn",
4241				="test_command",
4242				:"test_usage",
4243				l~{tlf[="test_local_flag" -l >bool?false]},
4244				c~{tcf[="test_common_flag" -c >bool?false]},
4245				&alias,
4246				&alias2,
4247				n "0.0.1",
4248				+ sub.clone(),
4249				+ sub2.clone(),
4250			]),
4251			_c.clone(),
4252		);
4253
4254		//rust-analyzerが警告を出すが通るテスト、一時的にコメントアウト
4255		let _r = r
4256			.clone()
4257			.copyright("Copyright (c) ".to_owned() + crate_authors!());
4258		compare_cmd(
4259			_r.clone(),
4260			cmd!("test"[
4261				action=>act
4262				authors=crate_authors!(),
4263				(c)...,
4264				(l)"test_license" "test_license_fn",
4265				="test_command",
4266				:"test_usage",
4267				l~{tlf[="test_local_flag" -l >bool?false]},
4268				c~{tcf[="test_common_flag" -c >bool?false]},
4269				&alias,
4270				&alias2,
4271				version= "0.0.1",
4272				+ sub.clone(),
4273				+ sub2.clone(),
4274			]),
4275			_c.clone(),
4276		);
4277		let _r = r.clone().copyright(copyright![2020, from_crate]);
4278		compare_cmd(
4279			_r.clone(),
4280			cmd!("test"[
4281				action=>act
4282				authors=crate_authors!(),
4283				copyright:2020,from_crate,
4284				license:"test_license" "test_license_fn",
4285				description="test_command",
4286				usage:"test_usage",
4287				l~tlf[="test_local_flag" -l >bool?false],
4288				l_flag:[],
4289				l~None,
4290				l~,
4291				c~tcf[="test_common_flag" -c >bool?false],
4292				c_flag:[],
4293				c~None,
4294				alias:alias,
4295				alias=alias2,
4296				n 0 0 1,
4297				|=> sub.clone(),
4298				| sub2.clone(),
4299			]),
4300			_c.clone(),
4301		);
4302		compare_cmd(
4303			_r.clone(),
4304			cmd!("test"[
4305				action=>act
4306				authors=...,
4307				copyright:2020,...,
4308				license:"test_license" "test_license_fn",
4309				description="test_command",
4310				usage:"test_usage",
4311				l~tlf[="test_local_flag" -l >bool?false],
4312				l_flag:[],
4313				l~None,
4314				l~,
4315				c~tcf[="test_common_flag" -c >bool?false],
4316				c_flag:[],
4317				c~None,
4318				alias:alias,
4319				alias=alias2,
4320				n 0 0 1,
4321				+ sub.clone(),
4322				| cmd!(sub2[>sub2_act]),
4323			]),
4324			_c.clone(),
4325		);
4326	}
4327
4328	#[test]
4329	fn default_val_macro_test() {
4330		assert_eqs!(
4331			default_value!(flag.help.description),
4332			default_value!(help.flag.description),
4333			default_value!(description.flag.help),
4334			default_description!(flag.help)
4335		);
4336		assert_eqs!(
4337			default_value!(flag.help.name),
4338			default_value!(help.flag.name),
4339			default_value!(name.flag.help),
4340			default_name!(flag.help)
4341		);
4342	}
4343
4344	#[test]
4345	fn preset_help_check_test() {
4346		let act = |cmd: Command, ctx: Context| -> action_result!() {
4347			checks!(cmd, ctx, [error, help, version, license]);
4348			println!("check passed!");
4349			done!()
4350		};
4351		let _r = Command::with_all_field(
4352			crate_name!().into(),
4353			Some(act),
4354			crate_authors!().into(),
4355			copyright!(from_crate, 2022),
4356			license!("MIT License",file_path=>"../LICENSE"),
4357			Some(crate_description!().into()),
4358			"exam [OPTIONS]".into(),
4359			flags![
4360				 [
4361					  [length]=>[>int?20,="password length option. default: 20",-l]
4362				 ],
4363				 [
4364					  [number]=>[>int?7,="password number option. default: 7",-n]
4365				 ],
4366				 [
4367					  [include]=>[>String,="chooses chars indicate type password include. Types are alphabet(a),number(n),symbol(s) and default(d). You can specify multiple chars(ex: an). default=ans",-i,?"d"]
4368				 ],
4369				 [
4370					  [exclude]=>[
4371							>String?"",
4372							="Password will generate without chars that is specidied by this flag",-e
4373					  ]
4374				 ],
4375				 [
4376					  [custom]=>[
4377							>String?"",
4378							="Password will generate with only chars that is specidied by this flag. this option is inputted, include option is disabled. default: disable",-c,-m,--cstm
4379					  ]
4380				 ]
4381			],
4382			flags!(help, version, license),
4383			alias!(),
4384			crate_version!().into(),
4385			commands!(),
4386		).run_from_args(vec!["help".to_owned(),"--help".to_owned()]);
4387	}
4388}