Added project files

This commit is contained in:
David J. Allen 2024-03-07 17:00:39 -07:00
parent 40615a97f8
commit be40387f4a
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC
10 changed files with 486 additions and 0 deletions

30
cmd/config.go Normal file
View file

@ -0,0 +1,30 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
configurator "github.com/OpenCHAMI/configurator/internal"
"github.com/OpenCHAMI/configurator/internal/util"
)
var configCmd = &cobra.Command{
Use: "config",
Short: "Create a new default config file",
Run: func(cmd *cobra.Command, args []string) {
// create a new config at all args (paths)
for _, path := range args {
// check and make sure something doesn't exist first
if exists, err := util.PathExists(path); exists || err != nil {
fmt.Printf("file or directory exists\n")
continue
}
configurator.SaveDefaultConfig(path)
}
},
}
func init() {
rootCmd.AddCommand(configCmd)
}