| 1 | // SPDX-License-Identifier: AGPL-3.0-or-later |
| 2 | |
| 3 | package main |
| 4 | |
| 5 | import ( |
| 6 | "fmt" |
| 7 | "os" |
| 8 | |
| 9 | "github.com/spf13/cobra" |
| 10 | ) |
| 11 | |
| 12 | var rootCmd = &cobra.Command{ |
| 13 | Use: "shithubd", |
| 14 | Short: "shithub server: web, ssh, worker, and admin tooling", |
| 15 | Long: "shithubd is the entrypoint binary for shithub — a feature-complete, AGPL-licensed clone of GitHub.\nSubcommands cover the HTTP web server, the SSH dispatcher, background workers, migrations, and operational helpers.", |
| 16 | SilenceUsage: true, |
| 17 | SilenceErrors: true, |
| 18 | } |
| 19 | |
| 20 | // Execute runs the root command and exits non-zero on error. |
| 21 | func Execute() { |
| 22 | if err := rootCmd.Execute(); err != nil { |
| 23 | fmt.Fprintln(os.Stderr, "shithubd:", err) |
| 24 | os.Exit(1) |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | func init() { |
| 29 | rootCmd.AddCommand(versionCmd) |
| 30 | rootCmd.AddCommand(webCmd) |
| 31 | rootCmd.AddCommand(migrateCmd) |
| 32 | rootCmd.AddCommand(seedCmd) |
| 33 | |
| 34 | // worker, hook, hooks (reinstall) registered in their own files. |
| 35 | // ssh-authkeys and ssh-shell are registered in cmd/shithubd/ssh.go. |
| 36 | rootCmd.AddCommand(storageCmd) |
| 37 | rootCmd.AddCommand(adminCmd) |
| 38 | rootCmd.AddCommand(configCmd) |
| 39 | rootCmd.AddCommand(gpgBackfillAllCmd) |
| 40 | } |
| 41 |