Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Sep 17, 2024

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
67 checks passed
@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