85 lines
2.2 KiB
Go
85 lines
2.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
func main() {
|
|
app := &cli.App{
|
|
Name: "abra",
|
|
Usage: "The cooperative cloud utility belt 🎩🐇",
|
|
Version: "TBA",
|
|
Commands: []*cli.Command{
|
|
{
|
|
Name: "server",
|
|
ArgsUsage: "<host>",
|
|
Usage: "Interact with the servers hosting your Coop-Cloud apps",
|
|
Subcommands: []*cli.Command{
|
|
{
|
|
Name: "list",
|
|
Aliases: []string{"ls"},
|
|
Usage: "List locally-defined servers.",
|
|
ArgsUsage: " ", // Removes "[arguments]" from help. Empty str's are ignored
|
|
HideHelp: true,
|
|
},
|
|
{
|
|
Name: "add",
|
|
Usage: "Add a server, reachable on <host>.",
|
|
ArgsUsage: "<host> [<user>] [<port>]",
|
|
Description: "[<user>], [<port>] SSH connection details",
|
|
HideHelp: true,
|
|
},
|
|
{
|
|
Name: "new",
|
|
Usage: "Creates a VPS from a provider in your terminal!",
|
|
Description: "Use a provider plugin to create an actual new server resource (VPS or otherwise) which can then be used to house a new Co-op Cloud installation.",
|
|
ArgsUsage: "<provider>",
|
|
HideHelp: true,
|
|
},
|
|
{
|
|
Name: "remove",
|
|
Aliases: []string{"rm"},
|
|
Usage: "Remove server <host>",
|
|
HideHelp: true,
|
|
},
|
|
{
|
|
Name: "init",
|
|
Usage: "Set up a server for Docker swarm",
|
|
HideHelp: true,
|
|
ArgsUsage: "<host>",
|
|
Description: `This initialisation explicitly chooses the "single host swarm" mode
|
|
which uses the default IPv4 address as the advertising address. This
|
|
can be re-configured later for more advanced use cases.
|
|
|
|
POWERED BY
|
|
docker swarm init
|
|
docker network create ...`,
|
|
},
|
|
{
|
|
Name: "apps",
|
|
Usage: `Alias for "abra app ls --server <host>"`,
|
|
HideHelp: true,
|
|
ArgsUsage: " ", // Removes "[arguments]" from help. Empty str's are ignored
|
|
Flags: []cli.Flag{
|
|
&cli.BoolFlag{
|
|
Name: "status",
|
|
Value: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
Action: func(c *cli.Context) error { fmt.Println("server"); return nil },
|
|
},
|
|
},
|
|
}
|
|
|
|
err := app.Run(os.Args)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|