Skip to content

Commit 05f18cc

Browse files
committed
command that show what db is being used
1 parent 9af5672 commit 05f18cc

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

daemon/cmd/database_location.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
"path/filepath"
6+
7+
"github.com/spf13/cobra"
8+
9+
"github.com/cvmfs/docker-graphdriver/daemon/lib"
10+
)
11+
12+
func init() {
13+
rootCmd.AddCommand(dbLocationCmd)
14+
}
15+
16+
var dbLocationCmd = &cobra.Command{
17+
Use: "db-location",
18+
Short: "Print the location of the database",
19+
Aliases: []string{"where-db"},
20+
Run: func(cmd *cobra.Command, args []string) {
21+
absPath, err := filepath.Abs(lib.DatabaseLocation)
22+
if err != nil {
23+
lib.LogE(err).Warning("Error in getting the absolute path of the database")
24+
}
25+
fmt.Println(absPath)
26+
},
27+
}

0 commit comments

Comments
 (0)