Ejemplo n.º 1
0
// sub cmd
var lsCmd = &cobra.Command{
	Use:   "ls",
	Short: "List show all <local> <remote> node.exe version",
	Long: `List show all <local> <remote> node.exe version e.g.
gnvm ls
gnvm ls --remote`,
	Run: func(cmd *cobra.Command, args []string) {

		// check args
		if len(args) > 0 {
			P(WARING, "gnvm ls no parameter, please check your input. See '%v'.\n", "gnvm help ls")
		}

		if remote == true {
			nodehandle.LsRemote()
		} else {
			// check local ls
			nodehandle.LS(true)
		}
	},
}

// sub cmd
var nodeVersionCmd = &cobra.Command{
	Use:   "node-version",
	Short: "Show <global> <latest> node.exe version",
	Long: `Show <global> <latest> node.exe version e.g.
gnvm node-version
gnvm node-version latest
gnvm node-version latest --remote
Ejemplo n.º 2
0
			P(WARING, "%v no parameter, please check your input. See '%v'.\n", "gnvm ls", "gnvm help ls")
		} else {
			switch {
			case !remote && !detail:
				if io {
					P(WARING, "%v no support flag %v, please check your input. See '%v'.\n", "gnvm ls", "-i", "gnvm help ls")
				}
				if limit != 0 {
					P(WARING, "%v no support flag %v, please check your input. See '%v'.\n", "gnvm ls", "-l", "gnvm help ls")
				}
				nodehandle.LS(true)
			case remote && !detail:
				if limit != 0 {
					P(WARING, "%v no support flag %v, please check your input. See '%v'.\n", "gnvm ls -r", "-l", "gnvm help ls")
				}
				nodehandle.LsRemote(-1, io)
			case remote && detail:
				if limit < 0 {
					P(WARING, "%v must be positive integer, please check your input. See '%v'.\n", "--limit", "gnvm help ls")
				} else {
					nodehandle.LsRemote(limit, io)
				}
			case !remote && detail:
				P(ERROR, "flag %v depends on %v flag, e.g. '%v', See '%v'.", "-d", "-r", "gnvm ls -r -d", "gnvm help ls", "\n")
			}
		}
	},
}

// sub cmd
var nodeVersionCmd = &cobra.Command{