1
0
Fork 0
forked from forgejo/forgejo

[CLI] implement forgejo-cli actions

(cherry picked from commit 08be2b226e)
(cherry picked from commit b6cfa88c6e)
(cherry picked from commit 59704200de)

[CLI] implement forgejo-cli actions generate-secret

(cherry picked from commit 6f7905c8ec)
(cherry picked from commit e085d6d273)

[CLI] implement forgejo-cli actions generate-secret (squash) NoInit

(cherry picked from commit 962c944eb2)

[CLI] implement forgejo-cli actions register

(cherry picked from commit 2f95143000)
(cherry picked from commit 42f2f8731e)

[CLI] implement forgejo-cli actions register (squash) no private

Do not go through the private API, directly modify the database

(cherry picked from commit 1ba7c0d39d)

[CLI] implement forgejo-cli actions

(cherry picked from commit 6f7905c8ec)
(cherry picked from commit e085d6d273)

[CLI] implement forgejo-cli actions generate-secret (squash) NoInit

(cherry picked from commit 962c944eb2)
(cherry picked from commit 4c121ef022)

Conflicts:
	cmd/forgejo/actions.go
	tests/integration/cmd_forgejo_actions_test.go
(cherry picked from commit 36997a48e3)

[CLI] implement forgejo-cli actions (squash) restore --version

Refs: https://codeberg.org/forgejo/forgejo/issues/1134
(cherry picked from commit 9739eb52d8)
This commit is contained in:
Earl Warren 2023-07-09 14:52:41 +02:00
parent af9e7d8e9e
commit 302c4e30ac
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
10 changed files with 632 additions and 24 deletions

View file

@ -61,8 +61,7 @@ func appGlobalFlags() []cli.Flag {
return []cli.Flag{
// make the builtin flags at the top
helpFlag,
// Forgejo: commented out because it would conflict at runtime with the --version
// cli.VersionFlag,
cli.VersionFlag,
// shared configuration flags, they are for global and for each sub-command at the same time
// eg: such command is valid: "./gitea --config /tmp/app.ini web --config /tmp/app.ini", while it's discouraged indeed
@ -168,7 +167,9 @@ func NewMainApp() *cli.App {
// that is NOT compatible with Gitea.
//
if executable == "forgejo-cli" {
subCmds = []*cli.Command{}
subCmds = []*cli.Command{
forgejo.CmdActions(context.Background()),
}
} else {
//
// Otherwise provide a Gitea compatible CLI which includes Forgejo
@ -210,7 +211,6 @@ func newMainApp(subCmds ...*cli.Command) *cli.App {
cmdConvert := util.ToPointer(*cmdDoctorConvert)
cmdConvert.Hidden = true // still support the legacy "./gitea doctor" by the hidden sub-command, remove it in next release
subCmdWithConfig = append(subCmdWithConfig, cmdConvert)
subCmdWithConfig = append(subCmdWithConfig, subCmds...)
// these sub-commands do not need the config file, and they do not depend on any path or environment variable.
subCmdStandalone := []*cli.Command{
@ -230,6 +230,7 @@ func newMainApp(subCmds ...*cli.Command) *cli.App {
}
app.Commands = append(app.Commands, subCmdWithConfig...)
app.Commands = append(app.Commands, subCmdStandalone...)
app.Commands = append(app.Commands, subCmds...)
if !checkCommandFlags(app) {
panic("some flags are incorrect") // this is a runtime check to help developers