Exemple #1
0
func testSearch() {
	nodehandle.Search("x.x.x")
	nodehandle.Search("0.10.x")
	nodehandle.Search("5.x.x")
	nodehandle.Search("5.0.0")
	nodehandle.Search(`/^5(\.([0]|[1-9]\d?)){2}$/`)
	nodehandle.Search("latest")
	nodehandle.Search("1.x.x")
	nodehandle.Search("1.1.x")
	nodehandle.Search("3.x.x")
	nodehandle.Search("3.3.x")
}
Exemple #2
0
var searchCmd = &cobra.Command{
	Use:   "search",
	Short: "Search and Print Node.js version detail usage wildcard mode or regexp mode",
	Long: `Search  and Print Node.js version detail usage wildcard mode or regexp mode. e.g. :
gnvm search *.*.*          :Search and Print all Node.js versions detail, consistent with gnvm ls -r -d.
gnvm search 0.*.*          :Search and Print 0.0.0  ~ 0.99.99 range Node.js version detail.
gnvm search 0.10.*         :Search and Print 0.10.0 ~ 0.10.99 range Node.js version detail.
gnvm search /<regexp>/     :Search and Print <regexp> Node.js version detail.
gnvm search latest         :Search and Print latest   Node.js version detail.
gnvm search 0.10.10        :Search and Print 0.10.10  Node.js version detail.
`,
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) != 1 {
			P(ERROR, "%v must be one parameter, please check your input. See '%v'.\n", "gnvm search", "gnvm help search")
		} else {
			nodehandle.Search(args[0])
		}
	},
}

// sub cmd
var npmCmd = &cobra.Command{
	Use:   "npm",
	Short: "NPM version management",
	Long: `Download and intall any npm version. e.g. :
gnvm npm x.xx.xx          :Install x.xx.xx npm version.
gnvm npm latest           :Install latest  npm version.
gnvm npm global           :Install local Node.js version matching npm version.
`,
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) != 1 {