forked from forgejo/forgejo
[CLI] implement forgejo-cli actions
(cherry picked from commit08be2b226e
) (cherry picked from commitb6cfa88c6e
) (cherry picked from commit59704200de
) [CLI] implement forgejo-cli actions generate-secret (cherry picked from commit6f7905c8ec
) (cherry picked from commite085d6d273
) [CLI] implement forgejo-cli actions generate-secret (squash) NoInit (cherry picked from commit962c944eb2
) [CLI] implement forgejo-cli actions register (cherry picked from commit2f95143000
) (cherry picked from commit42f2f8731e
) [CLI] implement forgejo-cli actions register (squash) no private Do not go through the private API, directly modify the database (cherry picked from commit1ba7c0d39d
) [CLI] implement forgejo-cli actions (cherry picked from commit6f7905c8ec
) (cherry picked from commite085d6d273
) [CLI] implement forgejo-cli actions generate-secret (squash) NoInit (cherry picked from commit962c944eb2
) (cherry picked from commit4c121ef022
) Conflicts: cmd/forgejo/actions.go tests/integration/cmd_forgejo_actions_test.go (cherry picked from commit36997a48e3
) [CLI] implement forgejo-cli actions (squash) restore --version Refs: https://codeberg.org/forgejo/forgejo/issues/1134 (cherry picked from commit9739eb52d8
)
This commit is contained in:
parent
af9e7d8e9e
commit
302c4e30ac
10 changed files with 632 additions and 24 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue