Lines Matching refs:arg

60     for arg in cmd.get_arguments() {
61 assert_arg(arg);
67 arg.get_id()
70 if let Some(s) = arg.get_short() {
71 short_flags.push(Flag::Arg(format!("-{s}"), arg.get_id().as_str()));
74 for (short_alias, _) in &arg.short_aliases {
75 short_flags.push(Flag::Arg(format!("-{short_alias}"), arg.get_id().as_str()));
78 if let Some(l) = arg.get_long() {
79 assert!(!l.starts_with('-'), "Argument {}: long {:?} must not start with a `-`, that will be handled by the parser", arg.get_id(), l);
80 long_flags.push(Flag::Arg(format!("--{l}"), arg.get_id().as_str()));
83 for (long_alias, _) in &arg.aliases {
84 long_flags.push(Flag::Arg(format!("--{long_alias}"), arg.get_id().as_str()));
88 if let Some((first, second)) = cmd.two_args_of(|x| x.get_id() == arg.get_id()) {
92 arg.get_id(),
98 if let Some(l) = arg.get_long() {
113 if let Some(s) = arg.get_short() {
128 if let Some(idx) = arg.index {
145 for req in &arg.requires {
151 arg.get_id(),
155 for req in &arg.r_ifs {
157 !arg.is_required_set(),
159 arg.get_id()
166 arg.get_id()
170 for req in &arg.r_ifs_all {
172 !arg.is_required_set(),
174 arg.get_id()
181 arg.get_id()
185 for req in &arg.r_unless {
187 !arg.is_required_set(),
189 arg.get_id()
196 arg.get_id(),
200 for req in &arg.r_unless_all {
202 !arg.is_required_set(),
204 arg.get_id()
211 arg.get_id(),
216 for req in &arg.blacklist {
222 arg.get_id(),
227 for req in &arg.overrides {
233 arg.get_id(),
237 if arg.is_last_set() {
239 arg.get_long().is_none(),
242 arg.get_id()
245 arg.get_short().is_none(),
248 arg.get_id()
253 !(arg.is_required_set() && arg.is_global_set()),
256 arg.get_id()
259 if arg.get_value_hint() == ValueHint::CommandWithArguments {
261 arg.is_positional(),
264 arg.get_id()
268 arg.is_trailing_var_arg_set() || arg.is_last_set(),
271 arg.get_id()
301 for arg in &group.args {
304 cmd.get_arguments().any(|x| x.get_id() == arg),
308 arg
433 (Arg(flag, arg), Command(_, sub)) | (Command(flag, sub), Arg(_, arg)) => panic!(
434 "the '{flag}' {short_or_long} flag for the '{arg}' argument conflicts with the short flag \
527 for arg in cmd.get_arguments() {
528 if arg.index.unwrap_or(0) == highest_idx {
530 !arg.is_trailing_var_arg_set() || !arg.is_last_set(),
533 arg.get_id()
536 if arg.is_trailing_var_arg_set() {
538 arg.is_multiple(),
541 arg.get_id()
546 !arg.is_trailing_var_arg_set(),
549 arg.get_id()
561 // * The last arg is Required
685 fn assert_arg(arg: &Arg) {
686 debug!("Arg::_debug_asserts:{}", arg.get_id());
691 !arg.blacklist.iter().any(|x| x == arg.get_id()),
693 arg.get_id(),
697 arg.get_action().takes_values(),
698 arg.is_takes_value_set(),
700 arg.get_id(),
701 arg.get_action()
703 if let Some(action_type_id) = arg.get_action().value_type_id() {
706 arg.get_value_parser().type_id(),
708 arg.get_id(),
709 arg.get_action(),
710 arg.get_value_parser()
714 if arg.get_value_hint() != ValueHint::Unknown {
716 arg.is_takes_value_set(),
718 arg.get_id()
721 if arg.get_value_hint() == ValueHint::CommandWithArguments {
723 arg.is_multiple_values_set(),
725 arg.get_id()
730 if arg.index.is_some() {
732 arg.is_positional(),
734 arg.get_id()
737 arg.is_takes_value_set(),
739 arg.get_id(),
740 if arg.get_id() == Id::HELP {
742 } else if arg.get_id() == Id::VERSION {
750 let num_vals = arg.get_num_args().expect(INTERNAL_ERROR_MSG);
754 let num_val_names = arg.get_value_names().unwrap_or(&[]).len();
758 arg.get_id(),
767 arg.is_takes_value_set(),
769 arg.get_id(),
774 arg.is_multiple_values_set(),
776 arg.get_id(),
782 !arg.is_require_equals_set(),
783 "Argument {}: cannot accept more than 1 arg (num_args={}) with require_equals",
784 arg.get_id(),
791 !arg.is_multiple_values_set(),
793 arg.get_id()
797 assert_arg_flags(arg);
799 assert_defaults(arg, "default_value", arg.default_vals.iter());
801 arg,
803 arg.default_missing_vals.iter(),
806 arg,
808 arg.default_vals_ifs
814 fn assert_arg_flags(arg: &Arg) {
817 if arg.$a() {
821 if !arg.$b() {
828 panic!("Argument {:?}\n{}", arg.get_id(), s)
845 arg: &Arg,
850 let value_parser = arg.get_value_parser();
852 if let Some(delim) = arg.get_value_delimiter() {
855 if let Err(err) = value_parser.parse_ref(&assert_cmd, Some(arg), &part.to_os_str())
859 arg.get_id(),
866 } else if let Err(err) = value_parser.parse_ref(&assert_cmd, Some(arg), default_os) {
869 arg.get_id(),