I'm working on trying to port a CLI tool I made to Odin that I need to have identical flags to rm, including flags like preserve-root and one-file-system that contain internal hyphens, but it looks like this isn't supported by core:flags or the getopt implementation. I'm also unsure how I would add something like that to the existing core:flags without rewriting a lot of it, since the issue is in how it determines what the name of the flag is. Am I missing something or is this just a situation where I'll have to write my own parser for this?
#Not able to get long opts with internal '-'?
1 messages · Page 1 of 1 (latest)
internal hyphens are supported, here's a config of mine that i use:
Options :: struct {
set_volume: f32 `args:"name=set-volume" usage:"volume to assign nodes"`,
shift_volume: f32 `args:"name=shift-volume" usage:"volume to increment nodes"`,
add_program: [dynamic]string `args:"name=add-program" usage:"name of program to add to aux"`,
remove_program: [dynamic]string `args:"name=remove-program" usage:"name of program to remove from aux"`,
get_volume: bool `args:"name=get-volume" usage:"the current mixologist volume"`,
}
Thank you so much!
long story short, you wrap everything in a struct and then use struct tags to sett teh name
Yeah, I see that now, I just didn't quite grok how the struct tags worked.