From 522cbab47ca08a483fd01e83871f25794fec14e4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 14 Sep 2021 19:22:42 +0300 Subject: [PATCH] [#791] cmd: Implement application observing storage engine Implement skeleton of `neofs-lens` app which is going to be used for working with storage engine's data. Signed-off-by: Leonard Lyubich --- cmd/neofs-lens/root.go | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 cmd/neofs-lens/root.go diff --git a/cmd/neofs-lens/root.go b/cmd/neofs-lens/root.go new file mode 100644 index 000000000..e3c1792cf --- /dev/null +++ b/cmd/neofs-lens/root.go @@ -0,0 +1,44 @@ +package main + +import ( + "fmt" + "os" + + "github.com/nspcc-dev/neofs-node/misc" + "github.com/spf13/cobra" +) + +var command = &cobra.Command{ + Use: "neofs-lens", + Short: "NeoFS Storage Engine Lens", + Long: `NeoFS Storage Engine Lens provides tools to browse the contents of the NeoFS storage engine.`, + RunE: entryPoint, + SilenceUsage: true, +} + +func entryPoint(cmd *cobra.Command, _ []string) error { + printVersion, err := cmd.Flags().GetBool("version") + if err == nil && printVersion { + fmt.Printf("Version: %s \nBuild: %s \nDebug: %s\n", + misc.Version, + misc.Build, + misc.Debug, + ) + return nil + } + + return cmd.Usage() +} + +func init() { + command.AddCommand( + // sub-commands + ) +} + +func main() { + err := command.Execute() + if err != nil { + os.Exit(1) + } +}