added CSV output mode, enhanced parser tests

This commit is contained in:
2022-10-23 16:57:30 +02:00
parent b5c802403b
commit 138ae51936
11 changed files with 148 additions and 104 deletions

View File

@@ -60,6 +60,7 @@ type Modeflag struct {
S bool
Y bool
A bool
C bool
}
// used for switching printers
@@ -69,6 +70,7 @@ const (
Markdown
Shell
Yaml
CSV
Ascii
)
@@ -130,6 +132,8 @@ func (conf *Config) PrepareModeFlags(flag Modeflag) {
conf.OutputMode = Shell
case flag.Y:
conf.OutputMode = Yaml
case flag.C:
conf.OutputMode = CSV
default:
conf.OutputMode = Ascii
}
@@ -152,3 +156,10 @@ func (c *Config) CheckEnv() {
}
}
}
func (c *Config) ApplyDefaults() {
// mode specific defaults
if c.OutputMode == Yaml || c.OutputMode == CSV {
c.NoNumbering = true
}
}