mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
make inspect behave like pilosactl version
This commit is contained in:
parent
c419c082da
commit
f463ab9d9b
2 changed files with 9 additions and 11 deletions
|
|
@ -3,11 +3,9 @@ package cmd
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/pilosa/pilosa/ctl"
|
||||
)
|
||||
|
|
@ -16,11 +14,19 @@ var inspecter = ctl.NewInspectCommand(os.Stdin, os.Stdout, os.Stderr)
|
|||
|
||||
var inspectCmd = &cobra.Command{
|
||||
Use: "inspect",
|
||||
Short: "inspect - inspect a pilosa data file",
|
||||
Short: "get stats on pilosa data file",
|
||||
Long: `
|
||||
Inspects a data file and provides stats.
|
||||
`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) == 0 {
|
||||
fmt.Println("path required")
|
||||
return
|
||||
} else if len(args) > 1 {
|
||||
fmt.Println("only one path allowed")
|
||||
return
|
||||
}
|
||||
inspecter.Path = args[0]
|
||||
if err := inspecter.Run(context.Background()); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
|
@ -28,12 +34,5 @@ Inspects a data file and provides stats.
|
|||
}
|
||||
|
||||
func init() {
|
||||
inspectCmd.Flags().StringVarP(&inspecter.Path, "file", "i", "", "File to inspect")
|
||||
|
||||
err := viper.BindPFlags(inspectCmd.Flags())
|
||||
if err != nil {
|
||||
log.Fatalf("Error binding inspect flags: %v", err)
|
||||
}
|
||||
|
||||
RootCmd.AddCommand(inspectCmd)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ The format of the CSV file is:
|
|||
The file should contain no headers.
|
||||
`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println(cmd.Flags())
|
||||
if len(args) == 0 {
|
||||
fmt.Println("path required")
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue