Skip to content

Commit

Permalink
pkg/cmd: move root to own package
Browse files Browse the repository at this point in the history
  • Loading branch information
jzelinskie committed Dec 7, 2021
1 parent 475f1a1 commit f446a16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cmd/spicedb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"google.golang.org/grpc/balancer"

consistentbalancer "github.com/authzed/spicedb/pkg/balancer"
"github.com/authzed/spicedb/pkg/cmd"
"github.com/authzed/spicedb/pkg/cmd/root"
"github.com/authzed/spicedb/pkg/cmd/version"
)

Expand Down Expand Up @@ -48,8 +48,8 @@ func main() {
// enable consistent hashring grpc load balancer
balancer.Register(consistentbalancer.NewConsistentHashringBuilder(xxhash.Sum64, hashringReplicationFactor, backendsPerKey))

rootCmd := cmd.NewRootCmd()
cmd.RegisterRootFlags(rootCmd)
rootCmd := root.NewCommand()
root.RegisterFlags(rootCmd)

versionCmd := version.NewCommand(rootCmd.Use)
version.RegisterVersionFlags(versionCmd)
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/root.go → pkg/cmd/root/root.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmd
package root

import (
"fmt"
Expand All @@ -8,12 +8,12 @@ import (
"github.com/spf13/cobra"
)

func RegisterRootFlags(cmd *cobra.Command) {
func RegisterFlags(cmd *cobra.Command) {
cobrautil.RegisterZeroLogFlags(cmd.PersistentFlags(), "log")
cobrautil.RegisterOpenTelemetryFlags(cmd.PersistentFlags(), "otel", cmd.Use)
}

func NewRootCmd() *cobra.Command {
func NewCommand() *cobra.Command {
return &cobra.Command{
Use: "spicedb",
Short: "A modern permissions database",
Expand Down

0 comments on commit f446a16

Please sign in to comment.