mirror of
https://codeberg.org/scip/anydb.git
synced 2025-12-17 04:20:59 +01:00
added db info command
This commit is contained in:
committed by
T.v.Dein
parent
3de65aa1c3
commit
8e400c6831
23
cmd/crud.go
23
cmd/crud.go
@@ -352,3 +352,26 @@ func Serve(conf *cfg.Config) *cobra.Command {
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func Info(conf *cfg.Config) *cobra.Command {
|
||||
var cmd = &cobra.Command{
|
||||
Use: "info",
|
||||
Short: "info",
|
||||
Long: `show info about database`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
// errors at this stage do not cause the usage to be shown
|
||||
cmd.SilenceUsage = true
|
||||
|
||||
info, err := conf.DB.Info()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return output.Info(os.Stdout, conf, info)
|
||||
},
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().StringVarP(&conf.Listen, "listen", "l", "localhost:8787", "host:port")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user