hoster/cmd/hoster_cli/hoster.go
2024-09-11 11:41:04 +02:00

58 lines
1.1 KiB
Go

package hoster_cli
import (
"os"
"path/filepath"
"gitea.codeblob.work/pk/hoster/cmd/hoster_cli/commands"
"gitea.codeblob.work/pk/hoster/internals/conf"
"github.com/kataras/golog"
"github.com/urfave/cli/v2"
)
func Execute() {
homeDir, err := os.UserHomeDir()
if err != nil {
golog.Fatalf("Error getting home directory: %v", err)
}
conf.LoadConfig(filepath.Join(homeDir, ".hoster.yml"))
app := &cli.App{
Name: "hoster",
Usage: "Hoster",
Version: "1.0.3",
Commands: []*cli.Command{
{
Name: "new",
Usage: "Setup a new hosting project.",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "name",
Aliases: []string{"n"},
Usage: "The name of the project",
Required: true,
},
&cli.StringFlag{
Name: "domain",
Aliases: []string{"d"},
Usage: "The description of the project",
Required: true,
},
},
Action: commands.CmdNew,
},
{
Name: "check",
Usage: "Check if newer versions of docker images are available",
Action: commands.CmdCheckUpdated,
},
},
}
if err := app.Run(os.Args); err != nil {
golog.Fatal(err)
}
}