()
| 10 | ) |
| 11 | |
| 12 | func newRootCmd() *cobra.Command { |
| 13 | cmd := &cobra.Command{ |
| 14 | Use: "git-sync", |
| 15 | Short: "Sync, replicate, or probe git repositories over the smart HTTP protocol", |
| 16 | Long: `git-sync moves refs and objects between two git HTTP endpoints without |
| 17 | needing a working tree. It can mirror a source into a target (sync), do a |
| 18 | fast-forward-only mirror (replicate), preview the work to be done (plan), |
| 19 | seed an empty target (bootstrap), or inspect either side (probe, fetch).`, |
| 20 | Version: versioninfo.Version, |
| 21 | SilenceErrors: true, |
| 22 | SilenceUsage: true, |
| 23 | CompletionOptions: cobra.CompletionOptions{ |
| 24 | HiddenDefaultCmd: true, |
| 25 | }, |
| 26 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 27 | return cmd.Help() |
| 28 | }, |
| 29 | } |
| 30 | cmd.SetVersionTemplate(fmt.Sprintf("git-sync %s (commit %s, built %s)\n", |
| 31 | versioninfo.Version, versioninfo.Commit, versioninfo.Date)) |
| 32 | |
| 33 | cmd.AddCommand(newSyncCmd()) |
| 34 | cmd.AddCommand(newReplicateCmd()) |
| 35 | cmd.AddCommand(newPlanCmd()) |
| 36 | cmd.AddCommand(newBootstrapCmd()) |
| 37 | cmd.AddCommand(newProbeCmd()) |
| 38 | cmd.AddCommand(newFetchCmd()) |
| 39 | cmd.AddCommand(newConvertSHA256Cmd()) |
| 40 | cmd.AddCommand(newVersionCmd()) |
| 41 | |
| 42 | return cmd |
| 43 | } |
| 44 | |
| 45 | func printOutput(jsonOutput bool, value interface{ Lines() []string }) { |
| 46 | if jsonOutput { |
no test coverage detected