File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
clap_complete/tests/testsuite Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -300,6 +300,24 @@ pub(crate) fn optional_multi_value_option_command(name: &'static str) -> clap::C
300300 )
301301}
302302
303+ #[ allow( dead_code) ]
304+ pub ( crate ) fn allow_dash_dash_as_value_command ( name : & ' static str ) -> clap:: Command {
305+ clap:: Command :: new ( name)
306+ . arg (
307+ clap:: Arg :: new ( "value" )
308+ . long ( "value" )
309+ . action ( clap:: ArgAction :: Set )
310+ . allow_hyphen_values ( true )
311+ . allow_dash_dash_as_value ( false ) ,
312+ )
313+ . arg (
314+ clap:: Arg :: new ( "pos" )
315+ . help ( "collect trailing values" )
316+ . num_args ( 0 ..)
317+ . last ( true ) ,
318+ )
319+ }
320+
303321pub ( crate ) fn two_multi_valued_arguments_command ( name : & ' static str ) -> clap:: Command {
304322 clap:: Command :: new ( name)
305323 . arg (
Original file line number Diff line number Diff line change @@ -378,6 +378,26 @@ pos_c
378378 assert_data_eq ! ( complete!( cmd, "-cSF=[TAB]" ) , snapbox:: str ![ ] ) ;
379379}
380380
381+ #[ test]
382+ fn terminator_after_allow_dash_dash_as_value_false ( ) {
383+ let mut cmd = Command :: new ( "exhaustive" )
384+ . arg (
385+ clap:: Arg :: new ( "value" )
386+ . long ( "value" )
387+ . action ( clap:: ArgAction :: Set )
388+ . allow_hyphen_values ( true )
389+ . allow_dash_dash_as_value ( false ) ,
390+ )
391+ . arg (
392+ clap:: Arg :: new ( "pos" )
393+ . value_parser ( [ "rest" ] )
394+ . num_args ( 0 ..)
395+ . last ( true ) ,
396+ ) ;
397+
398+ assert_data_eq ! ( complete!( cmd, "--value -- r" ) , snapbox:: str ![ "rest" ] ) ;
399+ }
400+
381401#[ test]
382402fn suggest_argument_multi_values ( ) {
383403 let mut cmd = Command :: new ( "dynamic" )
You can’t perform that action at this time.
0 commit comments