Esempio n. 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
}
Esempio n. 2
0
func NewDefaultCmd(e *parsecli.Env) *cobra.Command {
	d := defaultCmd{}
	return &cobra.Command{
		Use:   "default [app]",
		Short: "Sets or gets the default Parse App",
		Long: `Gets the default Parse App. If an argument is given, sets the ` +
			`default Parse App.`,
		Run: parsecli.RunWithArgs(e, d.run),
	}
}
Esempio n. 3
0
func NewListCmd(e *parsecli.Env) *cobra.Command {
	l := listCmd{}
	return &cobra.Command{
		Use:   "list [app]",
		Short: "Lists properties of given Parse app and Parse apps associated with given project",
		Long: `Lists Parse apps and aliases added to the current Cloud Code directory
when executed inside the directory.
Additionally, it prints the list of Parse apps associated with current Parse account.
If an optional app name is provided, it prints all the keys for that app.`,
		Run: parsecli.RunWithArgs(e, l.run),
	}
}
Esempio n. 4
0
func NewAddCmd(e *parsecli.Env) *cobra.Command {
	a := &addCmd{
		MakeDefault: false,
		apps:        &parsecli.Apps{},
		verbose:     true,
	}
	cmd := &cobra.Command{
		Use:   "add [app]",
		Short: "Adds a new Parse App to config in current Cloud Code directory",
		Long: `Adds a new Parse App to config in current Cloud Code directory.
If an argument is given, the added application can also be referenced by that name.`,
		Run: parsecli.RunWithArgs(e, a.run),
	}
	cmd.Flags().BoolVarP(&a.MakeDefault, "default", "d", a.MakeDefault,
		"Make the selected app default")
	return cmd
}