mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-17 16:38:54 +00:00
Fix: mlr -i nonesuch cat says mlr: empty IRS (#1980)
* Fix: `mlr -i nonesuch cat` says `mlr: empty IRS` * fix experr
This commit is contained in:
parent
5c8c3b132a
commit
e8c4187e67
1 changed files with 20 additions and 4 deletions
|
|
@ -34,13 +34,25 @@ func FinalizeReaderOptions(readerOptions *TReaderOptions) error {
|
|||
readerOptions.IPS = lib.UnhexStringLiteral(readerOptions.IPS)
|
||||
|
||||
if !readerOptions.ifsWasSpecified {
|
||||
readerOptions.IFS = defaultFSes[readerOptions.InputFileFormat]
|
||||
if fs, ok := defaultFSes[readerOptions.InputFileFormat]; ok {
|
||||
readerOptions.IFS = fs
|
||||
} else {
|
||||
return fmt.Errorf("unrecognized input format %q", readerOptions.InputFileFormat)
|
||||
}
|
||||
}
|
||||
if !readerOptions.ipsWasSpecified {
|
||||
readerOptions.IPS = defaultPSes[readerOptions.InputFileFormat]
|
||||
if ps, ok := defaultPSes[readerOptions.InputFileFormat]; ok {
|
||||
readerOptions.IPS = ps
|
||||
} else {
|
||||
return fmt.Errorf("unrecognized input format %q", readerOptions.InputFileFormat)
|
||||
}
|
||||
}
|
||||
if !readerOptions.irsWasSpecified {
|
||||
readerOptions.IRS = defaultRSes[readerOptions.InputFileFormat]
|
||||
if rs, ok := defaultRSes[readerOptions.InputFileFormat]; ok {
|
||||
readerOptions.IRS = rs
|
||||
} else {
|
||||
return fmt.Errorf("unrecognized input format %q", readerOptions.InputFileFormat)
|
||||
}
|
||||
}
|
||||
if !readerOptions.allowRepeatIFSWasSpecified {
|
||||
// Special case for Miller 6 upgrade -- now that we have regexing for mixes of tabs
|
||||
|
|
@ -49,7 +61,11 @@ func FinalizeReaderOptions(readerOptions *TReaderOptions) error {
|
|||
if readerOptions.InputFileFormat == "nidx" && !readerOptions.ifsWasSpecified {
|
||||
readerOptions.IFSRegex = lib.CompileMillerRegexOrDie(WHITESPACE_REGEX)
|
||||
} else {
|
||||
readerOptions.AllowRepeatIFS = defaultAllowRepeatIFSes[readerOptions.InputFileFormat]
|
||||
if allowRepeatIFS, ok := defaultAllowRepeatIFSes[readerOptions.InputFileFormat]; ok {
|
||||
readerOptions.AllowRepeatIFS = allowRepeatIFS
|
||||
} else {
|
||||
return fmt.Errorf("unrecognized input format %q", readerOptions.InputFileFormat)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue