simplify commands and version handling

This commit is contained in:
Willy Kloucek
2022-01-03 13:53:27 +01:00
parent eee0d0c4c8
commit e0656daaa0
41 changed files with 437 additions and 499 deletions
+6 -19
View File
@@ -4,10 +4,10 @@ import (
"errors"
"os"
"github.com/owncloud/ocis/ocis-pkg/clihelper"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"
"github.com/owncloud/ocis/ocis-pkg/shared"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
@@ -16,24 +16,16 @@ import (
func Execute() error {
cfg := config.DefaultConfig()
app := &cli.App{
Name: "ocis",
Version: version.String,
Usage: "ownCloud Infinite Scale Stack",
Compiled: version.Compiled(),
app := clihelper.DefaultApp(&cli.App{
Name: "ocis",
Usage: "ownCloud Infinite Scale Stack",
Before: func(c *cli.Context) error {
// TODO: what do do?
//cfg.Service.Version = version.String
return ParseConfig(c, cfg)
},
Authors: []*cli.Author{
{
Name: "ownCloud GmbH",
Email: "support@owncloud.com",
},
},
}
})
for _, fn := range register.Commands {
app.Commands = append(
@@ -47,11 +39,6 @@ func Execute() error {
Usage: "Show the help",
}
cli.VersionFlag = &cli.BoolFlag{
Name: "version,v",
Usage: "Print the version",
}
return app.Run(os.Args)
}