diff --git a/main.go b/main.go new file mode 100644 index 0000000000..c9094d500b --- /dev/null +++ b/main.go @@ -0,0 +1,17 @@ +package main + +import ( + "os" + + "github.com/owncloud/reva-phoenix/service" +) + +func main() { + + revaphoenixCommand := service.NewRevaPhoenixCommand("reva-phoenix") + + if err := revaphoenixCommand.Execute(); err != nil { + os.Exit(1) + } + +} diff --git a/reva-phoenix b/reva-phoenix index 75180dfc3c..0ec1fcbe20 100755 Binary files a/reva-phoenix and b/reva-phoenix differ diff --git a/service.go b/service.go deleted file mode 100644 index de0464b877..0000000000 --- a/service.go +++ /dev/null @@ -1,52 +0,0 @@ -package service - -import ( - "os" - "path/filepath" - - "github.com/spf13/cobra" -) - -// func main() { - -// revaphoenixCommand, allCommandFns := NewRevaPhoenixCommand() - -// basename := filepath.Base(os.Args[0]) -// if err := commandFor(basename, revaphoenixCommand, allCommandFns).Execute(); err != nil { -// os.Exit(1) -// } -// } - -// NewRevaPhoenixCommand is the entry point for reva-phoenix -func NewRevaPhoenixCommand() (*cobra.Command, []func() *cobra.Command) { - - cmd := &cobra.Command{ - Use: "reva-phoenix", - Short: "Request a new project", - Run: func(cmd *cobra.Command, args []string) { - if len(args) != 0 { - cmd.Help() - os.Exit(1) - } - - }, - } - - return cmd, nil -} - -// func commandFor(basename string, defaultCommand *cobra.Command, commands []func() *cobra.Command) *cobra.Command { -// for _, commandFn := range commands { -// command := commandFn() -// if command.Name() == basename { -// return command -// } -// for _, alias := range command.Aliases { -// if alias == basename { -// return command -// } -// } -// } - -// return defaultCommand -// } diff --git a/service/service.go b/service/service.go new file mode 100644 index 0000000000..56c566d3da --- /dev/null +++ b/service/service.go @@ -0,0 +1,24 @@ +package service + +import ( + "os" + + "github.com/spf13/cobra" +) + +// NewRevaPhoenixCommand is the entry point for reva-phoenix +func NewRevaPhoenixCommand(name string) (*cobra.Command) { + cmd := &cobra.Command{ + Use: name, + Short: "Request a new project", + Run: func(cmd *cobra.Command, args []string) { + if len(args) != 0 { + cmd.Help() + os.Exit(1) + } + + }, + } + + return cmd +} \ No newline at end of file