Skip to content

flag: fix parse_bool_value() with different order short args (fix #22176) - #22242

Merged
spytheman merged 1 commit into
vlang:masterfrom
yuyi98:fix_parse_bool_value
Sep 17, 2024
Merged

spytheman merged 1 commit into
vlang:masterfrom
yuyi98:fix_parse_bool_value

Conversation

@yuyi98

@yuyi98 yuyi98 commented Sep 17, 2024

Copy link
Copy Markdown
Member

This PR fix parse_bool_value() with different order short args (fix #22176).

  • Fix parse_bool_value() with different order short args.
  • Add test.
import flag

fn main() {
	mut fp := flag.new_flag_parser(['-ba', '-c'])
	a_bool := fp.bool('a_bool', `a`, false, '')
	assert a_bool
	b_bool := fp.bool('b_bool', `b`, false, '')
	assert b_bool
	c_bool := fp.bool('c_bool', `c`, false, '')
	assert c_bool
	additional_args := fp.finalize()!
	println(additional_args.join_lines())
	assert additional_args == []
}

PS D:\Test\v\tt1> v run .

@spytheman
spytheman merged commit 15bf822 into vlang:master Sep 17, 2024
@yuyi98
yuyi98 deleted the fix_parse_bool_value branch September 18, 2024 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FlagParser single letter options dependent on order of flags.

2 participants