Exemplo n.º 1
0
func init() {
	nflag.Configure(nflag.ConfigOptions{
		ProgramDescription: "This program will enable the bootstrapping of existing or new projects.",
	})

	nflag.Set("bootstrap", nflag.Flag{
		Descriptor:   "Bootstrap a new project.",
		Type:         "string",
		AllowNothing: false,
		Required:     false,
	})

	nflag.Set("get-dependencies", nflag.Flag{
		Descriptor:   "Get the dependencies of an existing project.",
		Type:         "bool",
		DefaultValue: false,
		AllowNothing: true,
	})

	nflag.Set("get-type-dependencies", nflag.Flag{
		Descriptor:   "Get the dependencies of a particular type (for example, typescript).",
		Type:         "string",
		AllowNothing: false,
		Required:     false,
	})

	nflag.Set("install-dependencies", nflag.Flag{
		Descriptor:   "Install the dependencies of an existing project.",
		Type:         "bool",
		DefaultValue: false,
		AllowNothing: true,
	})
}
Exemplo n.º 2
0
// Init the compiler
func init() {
	nflag.Configure(nflag.ConfigOptions{ProgramDescription: "Unified compiler for specialized project components."})
	nflag.Set("compile", nflag.Flag{Type: "string", DefaultValue: "all", Required: false, AllowNothing: true})
	currentDirectory, _ = os.Getwd() // Get the current working directory from os and assign it to currentDirectory

	executableNotInstalled = " is not installed on this system."
	dirDoesNotExistInSrc = " is not a directory inside src/."
}
Exemplo n.º 3
0
// Initialization
func init() {
	NodeGroupOrNode = "Node Group or Node"
	NodeGroupOrNodeAlreadyExists = NodeGroupOrNode + " already exists."
	NodeGroupOrNodeDoesntExist = NodeGroupOrNode + " does not exist."
	ProvideNodeGroupOrNode = "Please provide a " + NodeGroupOrNode + " using " + nflag.Config.FlagString + "node"
	InvalidProperty = "The property provided is not a valid one for a " + NodeGroupOrNode + "."

	nflag.Configure(nflag.ConfigOptions{
		ProgramDescription: "This is the local (client side) CLI for Metis that orchestrate your Cluster remotely.",
		ShowHelpIfNoArgs:   true, // Show Help if no arguments are provided
	})
	homeDir, _ := homedir.Dir()     // Get the home directory of the user
	root = homeDir + "/.metis-cli/" // Set the Root of the config to the user's .metis-cli dir
}
Exemplo n.º 4
0
// Initialization
func init() {
	nflag.Configure(nflag.ConfigOptions{ShowHelpIfNoArgs: true, ProgramDescription: "Frala CLI tool for file parsing and Po conversion."})

	nflag.Set("convert-terms", nflag.Flag{ // Create the convert-terms flag
		Type:         "bool",
		Descriptor:   "Use convert-terms to declare the action of Terms to Po conversion. Don't pass for Po to Terms conversion.",
		AllowNothing: true,
	})

	nflag.Set("lang", nflag.Flag{ // Create the lang Flag
		Descriptor:   "Language to parse files, Terms to Po conversion, or Po to Terms conversion.",
		Type:         "string",
		DefaultValue: frala.Config.DefaultLanguage, // Set DefaultValue to whatever is already set in frala
		AllowNothing: true,                         // Allow nothing, since we'll just default to DefaultValue
	})

	nflag.Set("parse", nflag.Flag{ // Create the parse flag
		Descriptor: "Files to parse. Accepts comma-separated values.",
		Type:       "string",
	})

	nflag.Set("po", nflag.Flag{ // Create the po flag
		Descriptor: "Po file you wish to convert to Terms or save Terms to.",
		Type:       "string",
	})

	currentWorkingDirectory, getWdErr := os.Getwd()

	if getWdErr != nil { // If there was an error getting the working directory
		absolutePathToDir, absolutePathErr := filepath.Abs(".") // Attempt to get the absolute path of the directory

		if absolutePathErr == nil { // If there was no issue getting the absolute path of the directory
			currentWorkingDirectory = absolutePathToDir // Change currentWorkingDirectory to absolutePathToDir
		} else { // If there was an issue getting the the current working directory
			fmt.Println("Unable to determine the current working directory. Exiting.")
			os.Exit(1)
		}
	}

	nflag.Set("target-dir", nflag.Flag{ // Create the target-dir flag
		Descriptor:   "Target directory to save parsed files or Po content to.",
		DefaultValue: currentWorkingDirectory, // Current working directory
		Type:         "string",
	})
}