summaryrefslogtreecommitdiffstats
path: root/cmd/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/main.go')
-rw-r--r--cmd/main.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/cmd/main.go b/cmd/main.go
index 6e3d46cc35..b48a6143d7 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -124,6 +124,7 @@ func NewMainApp(version, versionExtra string) *cli.App {
var subCmdsStandalone []*cli.Command = make([]*cli.Command, 0, 10)
var subCmdWithConfig []*cli.Command = make([]*cli.Command, 0, 10)
+ var globalFlags []cli.Flag = make([]cli.Flag, 0, 10)
//
// If the executable is forgejo-cli, provide a Forgejo specific CLI
@@ -131,6 +132,15 @@ func NewMainApp(version, versionExtra string) *cli.App {
//
if executable == "forgejo-cli" {
subCmdsStandalone = append(subCmdsStandalone, forgejo.CmdActions(context.Background()))
+ subCmdWithConfig = append(subCmdWithConfig, forgejo.CmdF3(context.Background()))
+ globalFlags = append(globalFlags, []cli.Flag{
+ &cli.BoolFlag{
+ Name: "quiet",
+ },
+ &cli.BoolFlag{
+ Name: "verbose",
+ },
+ }...)
} else {
//
// Otherwise provide a Gitea compatible CLI which includes Forgejo
@@ -142,10 +152,10 @@ func NewMainApp(version, versionExtra string) *cli.App {
subCmdWithConfig = append(subCmdWithConfig, CmdActions)
}
- return innerNewMainApp(version, versionExtra, subCmdsStandalone, subCmdWithConfig)
+ return innerNewMainApp(version, versionExtra, subCmdsStandalone, subCmdWithConfig, globalFlags)
}
-func innerNewMainApp(version, versionExtra string, subCmdsStandaloneArgs, subCmdWithConfigArgs []*cli.Command) *cli.App {
+func innerNewMainApp(version, versionExtra string, subCmdsStandaloneArgs, subCmdWithConfigArgs []*cli.Command, globalFlagsArgs []cli.Flag) *cli.App {
app := cli.NewApp()
app.HelpName = "forgejo"
app.Name = "Forgejo"
@@ -185,6 +195,7 @@ func innerNewMainApp(version, versionExtra string, subCmdsStandaloneArgs, subCmd
app.DefaultCommand = CmdWeb.Name
globalFlags := appGlobalFlags()
+ globalFlags = append(globalFlags, globalFlagsArgs...)
app.Flags = append(app.Flags, cli.VersionFlag)
app.Flags = append(app.Flags, globalFlags...)
app.HideHelp = true // use our own help action to show helps (with more information like default config)