Skip to content
This repository was archived by the owner on Jan 16, 2021. It is now read-only.

Commit f2d808c

Browse files
committed
[webhooks] move webhooks code into its own package
- move webhooks related functions and commands into their own package
1 parent 37214d9 commit f2d808c

File tree

9 files changed

+914
-851
lines changed

9 files changed

+914
-851
lines changed

configure.go

Lines changed: 5 additions & 420 deletions
Large diffs are not rendered by default.

configure_test.go

Lines changed: 0 additions & 425 deletions
Large diffs are not rendered by default.

parse_commands.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"github.com/ParsePlatform/parse-cli/parsecli"
99
"github.com/ParsePlatform/parse-cli/parsecmd"
10+
"github.com/ParsePlatform/parse-cli/webhooks"
1011
"github.com/spf13/cobra"
1112
)
1213

@@ -32,7 +33,7 @@ http://parse.com`,
3233
c.AddCommand(parsecmd.NewDeployCmd(e))
3334
c.AddCommand(parsecmd.NewDevelopCmd(e))
3435
c.AddCommand(parsecmd.NewDownloadCmd(e))
35-
c.AddCommand(NewFunctionHooksCmd(e))
36+
c.AddCommand(webhooks.NewFunctionHooksCmd(e))
3637
c.AddCommand(parsecmd.NewGenerateCmd(e))
3738
c.AddCommand(parsecmd.NewJsSdkCmd(e))
3839
c.AddCommand(NewListCmd(e))
@@ -42,7 +43,7 @@ http://parse.com`,
4243
c.AddCommand(parsecmd.NewReleasesCmd(e))
4344
c.AddCommand(parsecmd.NewRollbackCmd(e))
4445
c.AddCommand(parsecmd.NewSymbolsCmd(e))
45-
c.AddCommand(NewTriggerHooksCmd(e))
46+
c.AddCommand(webhooks.NewTriggerHooksCmd(e))
4647
c.AddCommand(NewUpdateCmd(e))
4748
c.AddCommand(NewVersionCmd(e))
4849

functions.go renamed to webhooks/functions.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package webhooks
22

33
import (
44
"errors"
@@ -19,6 +19,14 @@ type functionHook struct {
1919
Warning string `json:"warning,omitempty"`
2020
}
2121

22+
func getConfirmation(message string, e *parsecli.Env) bool {
23+
fmt.Fprintf(e.Out, message)
24+
var confirm string
25+
fmt.Fscanf(e.In, "%s\n", &confirm)
26+
lower := strings.ToLower(confirm)
27+
return lower != "" && strings.HasPrefix(lower, "y")
28+
}
29+
2230
func (f functionHook) String() string {
2331
if f.URL != "" {
2432
return fmt.Sprintf("Function name: %q, URL: %q", f.FunctionName, f.URL)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package webhooks
22

33
import (
44
"encoding/json"

0 commit comments

Comments
 (0)