build: split functionality into separate binaries

zot: registry server
zli: zot cli to interact with the zot registry
zui: zot ui (proposed)
zb: zot benchmark (proposed)

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
Ramkumar Chinchani
2022-01-11 01:15:35 +00:00
committed by Ramkumar Chinchani
parent c4d34b7269
commit 4896adad1b
12 changed files with 136 additions and 46 deletions
+31 -3
View File
@@ -157,7 +157,8 @@ func newVerifyCmd(conf *config.Config) *cobra.Command {
return verifyCmd
}
func NewRootCmd() *cobra.Command {
// "zot" - registry server.
func NewServerRootCmd() *cobra.Command {
showVersion := false
conf := config.New()
@@ -175,12 +176,39 @@ func NewRootCmd() *cobra.Command {
},
}
// "serve"
rootCmd.AddCommand(newServeCmd(conf))
rootCmd.AddCommand(newScrubCmd(conf))
// "verify"
rootCmd.AddCommand(newVerifyCmd(conf))
// "scrub"
rootCmd.AddCommand(newScrubCmd(conf))
// "version"
rootCmd.Flags().BoolVarP(&showVersion, "version", "v", false, "show the version and exit")
return rootCmd
}
// "zli" - client-side cli.
func NewCliRootCmd() *cobra.Command {
showVersion := false
rootCmd := &cobra.Command{
Use: "zli",
Short: "`zli`",
Long: "`zli`",
Run: func(cmd *cobra.Command, args []string) {
if showVersion {
log.Info().Str("distribution-spec", distspec.Version).Str("commit", config.Commit).
Str("binary-type", config.BinaryType).Str("go version", config.GoVersion).Msg("version")
}
_ = cmd.Usage()
cmd.SilenceErrors = false
},
}
// additional cmds
enableCli(rootCmd)
// "version"
rootCmd.Flags().BoolVarP(&showVersion, "version", "v", false, "show the version and exit")
return rootCmd