MCPcopy Create free account
hub / github.com/entireio/git-sync / newRootCmd

Function newRootCmd

cmd/git-sync/root.go:12–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10)
11
12func 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
17needing a working tree. It can mirror a source into a target (sync), do a
18fast-forward-only mirror (replicate), preview the work to be done (plan),
19seed 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
45func printOutput(jsonOutput bool, value interface{ Lines() []string }) {
46 if jsonOutput {

Callers 1

runFunction · 0.85

Calls 8

newSyncCmdFunction · 0.85
newReplicateCmdFunction · 0.85
newPlanCmdFunction · 0.85
newBootstrapCmdFunction · 0.85
newProbeCmdFunction · 0.85
newFetchCmdFunction · 0.85
newConvertSHA256CmdFunction · 0.85
newVersionCmdFunction · 0.85

Tested by

no test coverage detected