Beispiel #1
0
func NewConfigureCmd(e *parsecli.Env) *cobra.Command {
	var c configureCmd

	cmd := &cobra.Command{
		Use:   "configure",
		Short: "Configure various Parse settings",
		Long:  "Configure various Parse settings like account keys, project type, and more.",
		Run: func(c *cobra.Command, args []string) {
			c.Help()
		},
	}

	keyCmd := &cobra.Command{
		Use:     "accountkey",
		Short:   "Store Parse account key on machine",
		Long:    "Stores Parse account key in ~/.parse/netrc.",
		Run:     parsecli.RunNoArgs(e, c.accountKey),
		Aliases: []string{"key"},
	}
	keyCmd.Flags().BoolVarP(&c.isDefault, "default", "d", c.isDefault,
		"Make this token a system default")
	cmd.AddCommand(keyCmd)

	emailCmd := &cobra.Command{
		Use:     "email [id]",
		Short:   "Configures the parser email for this project",
		Long:    "Configures the parser email for current project.",
		Run:     parsecli.RunWithArgs(e, c.parserEmail),
		Aliases: []string{"user"},
	}
	cmd.AddCommand(emailCmd)

	projectCmd := &cobra.Command{
		Use:   "project [type]",
		Short: "Set the project type to one among listed options",
		Long:  "Set the project type to one among listed options. For instance, 'parse'",
		Run:   parsecli.RunWithArgs(e, c.projectType),
	}
	cmd.AddCommand(projectCmd)

	hooksCmd := &cobra.Command{
		Use:   "hooks [filename]",
		Short: "Configure webhooks according to given config file",
		Long: `Configure webhooks for the app based on the given configuration json file.
For more details read: https://parse.com/docs/cloudcode/guide#command-line-webhooks
`,
		Run:     parsecli.RunWithArgsClient(e, c.hooks.HooksCmd),
		Aliases: []string{"webhooks"},
	}
	hooksCmd.Flags().BoolVarP(&c.hooks.HooksStrict, "strict", "s", c.hooks.HooksStrict,
		"Configure hooks in strict mode, i.e., do not automatically fix errors.")
	hooksCmd.Flags().StringVarP(&c.hooks.BaseURL, "base", "b", c.hooks.BaseURL,
		`Base url to use while parsing the webhook url field.
If provided, the config file can have relative urls.`)
	cmd.AddCommand(hooksCmd)

	return cmd
}
Beispiel #2
0
func NewUpdateCmd(e *parsecli.Env) *cobra.Command {
	var u updateCmd
	return &cobra.Command{
		Use:   "update",
		Short: "Updates this tool to the latest version",
		Long:  "Updates this tool to the latest version.",
		Run:   parsecli.RunNoArgs(e, u.run),
	}
}
Beispiel #3
0
func NewVersionCmd(e *parsecli.Env) *cobra.Command {
	var c versionCmd
	cmd := &cobra.Command{
		Use:     "version",
		Short:   "Gets the Command Line Tools version",
		Long:    `Gets the Command Line Tools version.`,
		Run:     parsecli.RunNoArgs(e, c.run),
		Aliases: []string{"cliversion"},
	}
	return cmd
}
Beispiel #4
0
func NewGenerateCmd(e *parsecli.Env) *cobra.Command {
	c := generateCmd{}
	cmd := &cobra.Command{
		Use:   "generate",
		Short: "Generates a sample express app in the current project directory",
		Long:  "Generates a sample express app in the current project directory.",
		Run:   parsecli.RunNoArgs(e, c.run),
	}
	cmd.Flags().StringVarP(&c.generateType, "type", "t", expressEjs, "Type of templates to use for generation.")
	return cmd
}
Beispiel #5
0
func NewMigrateCmd(e *parsecli.Env) *cobra.Command {
	var m migrateCmd
	cmd := &cobra.Command{
		Use:   "migrate",
		Short: "Migrate project config format to preferred format",
		Long: `Use this on projects with legacy config format to migrate
to the preferred format.
`,
		Run: parsecli.RunNoArgs(e, m.run),
	}
	cmd.Flags().BoolVarP(&m.retainMaster, "retain", "r", m.retainMaster,
		"Retain any master keys present in config during migration")
	return cmd
}
Beispiel #6
0
func NewNewCmd(e *parsecli.Env) *cobra.Command {
	nc := newCmd{addApplication: true}
	cmd := &cobra.Command{
		Use:   "new",
		Short: "Adds Cloud Code to an existing Parse app, additional can create a new Parse app",
		Long: `Adds Cloud Code to an existing Parse app, additional can create a new Parse app.
You can also use it in non-interactive mode by using the various flags available.
`,
		Run: parsecli.RunNoArgs(e, nc.run),
	}
	cmd.Flags().BoolVarP(&nc.configOnly, "init", "i", nc.configOnly,
		"Create a Cloud Code project only with configuration.")
	cmd.Flags().BoolVarP(&nc.noCode, "nocode", "n", nc.noCode,
		"Do not set up a Cloud Code project for the app. Typically used in conjunction with 'create' option")
	cmd.Flags().BoolVarP(&nc.createNewApp, "create", "c", nc.createNewApp,
		"Set this flag to true if you want to create a new Parse app.")
	cmd.Flags().StringVarP(&nc.parseAppName, "app", "a", nc.parseAppName,
		"Name of the Parse app you want to create or set up Cloud Code project for.")
	cmd.Flags().StringVarP(&nc.codeLocation, "loc", "l", nc.codeLocation,
		"Location, relative to the current directory, at which the Cloud Code project will be set up.")
	return cmd
}