Unable to Use a Hyphen as First Character in Field Separator
briandowns opened this issue · 0 comments
briandowns commented
When testing out different separators, I wanted to use an ->
however it wasn't happy with. Upon further digging, it appears that the Fatih Flags sees that as a boolean flag and ignores it.
This can either be considered a limitation to be accepted or possibly dealt with. One thing to do would be to avoid the validArg()
call by determining if a separator has a hyphen in it's values 0 position. I'm sure there are better ways.
var idx int
for i, j := range args {
if j == "-s" {
idx = i
}
}
var hasHyphen bool
if string(args[idx+1]) == "-" {
hasHyphen = true
}
If there's a hyphen found, bypass the validArgs
call and process as expected. Then again, this is probably a fairly fringe edge case that will likely never arise.