diff options
Diffstat (limited to 'cmd/gotosocial/admin.go')
-rw-r--r-- | cmd/gotosocial/admin.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/cmd/gotosocial/admin.go b/cmd/gotosocial/admin.go index 4bf71d612..0575452fb 100644 --- a/cmd/gotosocial/admin.go +++ b/cmd/gotosocial/admin.go @@ -21,6 +21,7 @@ package main import ( "github.com/spf13/cobra" "github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action/admin/account" + "github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action/admin/media/prune" "github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action/admin/trans" "github.com/superseriousbusiness/gotosocial/internal/config" ) @@ -152,5 +153,40 @@ func adminCommands() *cobra.Command { config.AddAdminTrans(adminImportCmd) adminCmd.AddCommand(adminImportCmd) + /* + ADMIN MEDIA COMMANDS + */ + + adminMediaCmd := &cobra.Command{ + Use: "media", + Short: "admin commands related stored media attachments/emojis", + } + + /* + ADMIN MEDIA PRUNE COMMANDS + */ + adminMediaPruneCmd := &cobra.Command{ + Use: "prune", + Short: "admin commands for pruning unused/orphaned media from storage", + } + config.AddAdminMediaPrune(adminMediaPruneCmd) + + adminMediaPruneOrphanedCmd := &cobra.Command{ + Use: "orphaned", + Short: "prune orphaned media from storage", + PreRunE: func(cmd *cobra.Command, args []string) error { + return preRun(preRunArgs{cmd: cmd}) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return run(cmd.Context(), prune.Orphaned) + }, + } + config.AddAdminMediaPrune(adminMediaPruneOrphanedCmd) + adminMediaPruneCmd.AddCommand(adminMediaPruneOrphanedCmd) + + adminMediaCmd.AddCommand(adminMediaPruneCmd) + + adminCmd.AddCommand(adminMediaCmd) + return adminCmd } |