You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
495 B
Go
30 lines
495 B
Go
4 years ago
|
package configgen
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
|
||
|
"zero/tools/modelctl/model"
|
||
|
|
||
|
"github.com/urfave/cli"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
configFileName = "config.json"
|
||
|
)
|
||
|
|
||
|
func ConfigCommand(_ *cli.Context) error {
|
||
|
_, err := os.Stat(configFileName)
|
||
|
if err == nil {
|
||
|
return nil
|
||
|
}
|
||
|
file, err := os.OpenFile(configFileName, os.O_CREATE|os.O_WRONLY, model.ModeDirPerm)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
file.WriteString(configTemplate)
|
||
|
defer file.Close()
|
||
|
fmt.Println("config json template generate done ... ")
|
||
|
return nil
|
||
|
}
|