mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-23 22:29:59 -05:00
add service package
This commit is contained in:
17
main.go
Normal file
17
main.go
Normal file
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
BIN
reva-phoenix
BIN
reva-phoenix
Binary file not shown.
52
service.go
52
service.go
@@ -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
|
||||
// }
|
||||
24
service/service.go
Normal file
24
service/service.go
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user