github.com/jbendotnet/noms@v0.0.0-20190904222105-c43e4293ea92/cmd/noms/noms_stats.go (about) 1 // Copyright 2017 Attic Labs, Inc. All rights reserved. 2 // Licensed under the Apache License, version 2.0: 3 // http://www.apache.org/licenses/LICENSE-2.0 4 5 package main 6 7 import ( 8 "fmt" 9 10 "github.com/attic-labs/kingpin" 11 12 "github.com/attic-labs/noms/cmd/util" 13 "github.com/attic-labs/noms/go/config" 14 "github.com/attic-labs/noms/go/d" 15 ) 16 17 func nomsStats(noms *kingpin.Application) (*kingpin.CmdClause, util.KingpinHandler) { 18 stats := noms.Command("stats", "Shows stats summary for a Noms Database.") 19 database := stats.Arg("database", "See Spelling Objects at https://github.com/attic-labs/noms/blob/master/doc/spelling.md for details on the database argument.").Required().String() 20 21 return stats, func(input string) int { 22 cfg := config.NewResolver() 23 store, err := cfg.GetDatabase(*database) 24 d.CheckError(err) 25 defer store.Close() 26 27 fmt.Println(store.StatsSummary()) 28 return 0 29 } 30 }