mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-25 21:39:10 +00:00
Remove unused jsonMode and fix output
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
78cafe45d4
commit
932b39fd08
@ -51,7 +51,6 @@ type command struct {
|
|||||||
type config struct {
|
type config struct {
|
||||||
output string
|
output string
|
||||||
format string
|
format string
|
||||||
jsonMode bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCommand constructs a generate-cdi command with the specified logger
|
// NewCommand constructs a generate-cdi command with the specified logger
|
||||||
@ -150,7 +149,7 @@ func (m command) run(c *cli.Context, cfg *config) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = writeToOutput(cfg.jsonMode, data, outputTo)
|
err = writeToOutput(cfg.format, data, outputTo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to write output: %v", err)
|
return fmt.Errorf("failed to write output: %v", err)
|
||||||
}
|
}
|
||||||
@ -172,13 +171,12 @@ func formatFromFilename(filename string) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeToOutput(jsonMode bool, data []byte, output io.Writer) error {
|
func writeToOutput(format string, data []byte, output io.Writer) error {
|
||||||
if !jsonMode {
|
if format == formatYAML {
|
||||||
_, err := output.Write([]byte("---\n"))
|
_, err := output.Write([]byte("---\n"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to write YAML separator: %v", err)
|
return fmt.Errorf("failed to write YAML separator: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
_, err := output.Write(data)
|
_, err := output.Write(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user