mirror of
https://github.com/davidallendj/configurator.git
synced 2025-12-19 19:17:01 -07:00
Added check to remove duplicates in 'inspect' cmd
This commit is contained in:
parent
8fba2347b7
commit
c822531fde
1 changed files with 8 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/OpenCHAMI/configurator/pkg/generator"
|
"github.com/OpenCHAMI/configurator/pkg/generator"
|
||||||
|
"github.com/OpenCHAMI/configurator/pkg/util"
|
||||||
"github.com/rodaine/table"
|
"github.com/rodaine/table"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
@ -26,11 +27,16 @@ var inspectCmd = &cobra.Command{
|
||||||
return strings.ToUpper(fmt.Sprintf(format, vals...))
|
return strings.ToUpper(fmt.Sprintf(format, vals...))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove duplicate args from CLI
|
// remove duplicate clean paths from CLI
|
||||||
|
paths := make([]string, len(args))
|
||||||
|
for _, path := range args {
|
||||||
|
paths = append(paths, filepath.Clean(path))
|
||||||
|
}
|
||||||
|
paths = util.RemoveDuplicates(paths)
|
||||||
|
|
||||||
// load specific plugins from positional args
|
// load specific plugins from positional args
|
||||||
var generators = make(map[string]generator.Generator)
|
var generators = make(map[string]generator.Generator)
|
||||||
for _, path := range args {
|
for _, path := range paths {
|
||||||
err := filepath.Walk(path, func(path string, info fs.FileInfo, err error) error {
|
err := filepath.Walk(path, func(path string, info fs.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue