Example #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
}
Example #2
0
func NewJsSdkCmd(e *parsecli.Env) *cobra.Command {
	j := jsSDKCmd{}
	cmd := &cobra.Command{
		Use:   "jssdk [version]",
		Short: "Sets the Parse JavaScript SDK version to use in Cloud Code",
		Long: `Sets the Parse JavaScript SDK version to use in Cloud Code. ` +
			`Prints the version number currently set if none is specified.`,
		Run: parsecli.RunWithArgsClient(e, j.run),
	}
	cmd.Flags().BoolVarP(&j.all, "all", "a", j.all,
		"Shows all available JavaScript SDK version")
	return cmd
}