Allow partial option matches in C CLI parser as well

Matches behavior of Go parser and is nice to have
This commit is contained in:
Kovid Goyal
2025-04-28 12:43:09 +05:30
parent d7fb143ee0
commit 14792aa60e
2 changed files with 44 additions and 11 deletions

View File

@@ -106,13 +106,14 @@ version
t('-01=y', bool_reset=False, bool_set=True)
t('-01=n', bool_reset=False, bool_set=False)
t('--simple-string xx moo -1', leftover=['moo', '-1'], simple_string='xx')
t('--simple-string -0 -- -1', leftover=['-1'], simple_string='-0')
t('--si -0 -- -1', leftover=['-1'], simple_string='-0')
t('--simple-string=-0 -- -1', leftover=['-1'], simple_string='-0')
t('--simple-string=--help -- -1', leftover=['-1'], simple_string='--help')
t('--simple-string --help -- -1', leftover=['-1'], simple_string='--help')
t('-1l=a --list=b -c b --list c', bool_set=True, choice='b', list=list('abc'))
t('-1s= -l "" --list= x', leftover=['x'], bool_set=True, simple_string='', list=['', ''])
t('--choice moo', fails='a, b, c')
t('--bool', fails='mbiguous')
t('-1c moo', fails='a, b, c')
t('-10c=moo', fails='a, b, c')
t('-1 -h', fails=True, help_called=True)