feat: 增加命令行工具的干运行模式和输出目录选项
This commit is contained in:
26
cmd/new.go
26
cmd/new.go
@@ -5,20 +5,22 @@ import (
|
||||
)
|
||||
|
||||
func CommandInit(root *cobra.Command) {
|
||||
cmd := &cobra.Command{
|
||||
Use: "new [project|module]",
|
||||
Short: "new project/module",
|
||||
}
|
||||
cmd := &cobra.Command{
|
||||
Use: "new [project|module]",
|
||||
Short: "new project/module",
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().BoolP("force", "f", false, "Force init project if exists")
|
||||
cmd.PersistentFlags().BoolP("force", "f", false, "Force overwrite existing files or directories")
|
||||
cmd.PersistentFlags().Bool("dry-run", false, "Preview actions without writing files")
|
||||
cmd.PersistentFlags().String("dir", ".", "Base directory for outputs")
|
||||
|
||||
cmds := []func(*cobra.Command){
|
||||
CommandNewProject,
|
||||
// deprecate CommandNewModule,
|
||||
CommandNewProvider,
|
||||
CommandNewEvent,
|
||||
CommandNewJob,
|
||||
}
|
||||
cmds := []func(*cobra.Command){
|
||||
CommandNewProject,
|
||||
// deprecate CommandNewModule,
|
||||
CommandNewProvider,
|
||||
CommandNewEvent,
|
||||
CommandNewJob,
|
||||
}
|
||||
|
||||
for _, c := range cmds {
|
||||
c(cmd)
|
||||
|
||||
Reference in New Issue
Block a user