Skip to content

Commit 67b74fb

Browse files
committed
fix(complete): Check takes_values from num_args, not action
This should be more accurate
1 parent 6717cf1 commit 67b74fb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clap_complete/src/engine/complete.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn complete(
8181
});
8282

8383
if let Some(opt) = opt {
84-
if opt.get_action().takes_values() && value.is_none() {
84+
if opt.get_num_args().expect("built").takes_values() && value.is_none() {
8585
next_state = ParseState::Opt((opt, 1));
8686
};
8787
} else if pos_allows_hyphen(current_cmd, pos_index) {
@@ -581,7 +581,10 @@ fn parse_shortflags<'c, 's>(
581581
});
582582
is_find.unwrap_or(false)
583583
});
584-
if opt.map(|o| o.get_action().takes_values()).unwrap_or(false) {
584+
if opt
585+
.map(|o| o.get_num_args().expect("built").takes_values())
586+
.unwrap_or(false)
587+
{
585588
takes_value_opt = opt;
586589
break;
587590
}

0 commit comments

Comments
 (0)