()
| 64 | } |
| 65 | |
| 66 | func NewInitDatabaseCmd() *cobra.Command { |
| 67 | cmd := &cobra.Command{ |
| 68 | Use: "init", |
| 69 | Short: "Create an empty database.", |
| 70 | RunE: func(cmd *cobra.Command, args []string) error { |
| 71 | printBackendInfo() |
| 72 | name := viper.GetString(KeyBackend) |
| 73 | if graph.IsRegistered(name) && !graph.IsPersistent(name) { |
| 74 | return ErrNotPersistent |
| 75 | } |
| 76 | // TODO: maybe check read-only flag in config before that? |
| 77 | if err := initDatabase(); err != nil { |
| 78 | return err |
| 79 | } |
| 80 | return nil |
| 81 | }, |
| 82 | } |
| 83 | return cmd |
| 84 | } |
| 85 | |
| 86 | func NewLoadDatabaseCmd() *cobra.Command { |
| 87 | cmd := &cobra.Command{ |
no test coverage detected