aboutsummaryrefslogtreecommitdiffstats
path: root/qt-cli/cmd/new.go
blob: 7caf42dad9e12a63eda7ebc7d0c044f0ad9e051d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only

package cmd

import (
	"qtcli/prompt"
	"qtcli/util"

	"github.com/spf13/cobra"
)

var outputDir string
var customTemplateDir string
var licenseTemplatePath string

var newCmd = &cobra.Command{
	Use:   "new",
	Short: util.Msg("Create a new project or file(s)"),
	Run: func(cmd *cobra.Command, args []string) {
		prompt.RunNew()
	},
}

func init() {
	flags := newCmd.PersistentFlags()

	flags.StringVarP(
		&outputDir, "output-dir", "d", "",
		util.Msg("Output directory"))

	flags.StringVarP(
		&customTemplateDir, "template-dir", "p", "",
		util.Msg("Specify a path to the custom template directory"))

	flags.StringVarP(
		&licenseTemplatePath, "license-file", "l", "",
		util.Msg("Specify a path to the license template file"))

	rootCmd.AddCommand(newCmd)
}