From 1e1c6e21e508ee8e09a678daea3bdc400f01c0be Mon Sep 17 00:00:00 2001 From: Nathaniel Cook Date: Thu, 24 May 2018 11:34:39 -0600 Subject: [PATCH] chore(idp): Rename cmd/idp to cmd/influx --- .gitignore | 2 +- Makefile | 6 +-- cmd/idp/main.go | 63 ----------------------- cmd/{idp => influx}/authorization.go | 2 +- cmd/{idp => influx}/bucket.go | 2 +- cmd/{idp => influx}/ifql.go | 0 cmd/{idp => influx}/internal/tabwriter.go | 0 cmd/influx/main.go | 63 +++++++++++++++++++++++ cmd/{idp => influx}/organization.go | 2 +- cmd/{idp => influx}/user.go | 2 +- 10 files changed, 71 insertions(+), 71 deletions(-) delete mode 100644 cmd/idp/main.go rename cmd/{idp => influx}/authorization.go (99%) rename cmd/{idp => influx}/bucket.go (99%) rename cmd/{idp => influx}/ifql.go (100%) rename cmd/{idp => influx}/internal/tabwriter.go (100%) create mode 100644 cmd/influx/main.go rename cmd/{idp => influx}/organization.go (98%) rename cmd/{idp => influx}/user.go (98%) diff --git a/.gitignore b/.gitignore index 3d5978c323..f57b23b19f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ idpdb.bolt /dist # Project binaries. -/idp +/influx /idpd /ifqld /bin diff --git a/Makefile b/Makefile index 5c4cc519ab..a18e9bd44d 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ SOURCES := $(shell find . -name '*.go' -not -name '*_test.go') SOURCES_NO_VENDOR := $(shell find . -path ./vendor -prune -o -name "*.go" -not -name '*_test.go' -print) # List of binary cmds to build -CMDS := bin/idp bin/idpd bin/ifqld +CMDS := bin/influx bin/idpd bin/ifqld # List of utilities to build as part of the build process UTILS := bin/pigeon bin/cmpgen bin/goreleaser @@ -49,8 +49,8 @@ subdirs: $(SUBDIRS) bin/ifqld: $(SOURCES) $(GO_BUILD) -i -o bin/ifqld ./cmd/ifqld -bin/idp: $(SOURCES) - $(GO_BUILD) -i -o bin/idp ./cmd/idp +bin/influx: $(SOURCES) + $(GO_BUILD) -i -o bin/influx ./cmd/influx bin/idpd: $(SOURCES) $(GO_BUILD) -i -o bin/idpd ./cmd/idpd diff --git a/cmd/idp/main.go b/cmd/idp/main.go deleted file mode 100644 index f7fa790de8..0000000000 --- a/cmd/idp/main.go +++ /dev/null @@ -1,63 +0,0 @@ -package main - -import ( - "fmt" - "os" - - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -func main() { - Execute() -} - -var idpCmd = &cobra.Command{ - Use: "idp", - Short: "IDP Client", - Run: idpF, -} - -func init() { - idpCmd.AddCommand(authorizationCmd) - idpCmd.AddCommand(bucketCmd) - idpCmd.AddCommand(ifqlCmd) - idpCmd.AddCommand(organizationCmd) - idpCmd.AddCommand(userCmd) -} - -// Flags contains all the CLI flag values for idp. -type Flags struct { - token string - host string -} - -var flags Flags - -func init() { - viper.SetEnvPrefix("IDP") - - idpCmd.PersistentFlags().StringVarP(&flags.token, "token", "t", "", "API token to be used throughout client calls") - viper.BindEnv("TOKEN") - if h := viper.GetString("TOKEN"); h != "" { - flags.token = h - } - - idpCmd.PersistentFlags().StringVar(&flags.host, "host", "http://localhost:9999", "HTTP address of IDP") - viper.BindEnv("HOST") - if h := viper.GetString("HOST"); h != "" { - flags.host = h - } -} - -func idpF(cmd *cobra.Command, args []string) { - cmd.Usage() -} - -// Execute executes the idpd command -func Execute() { - if err := idpCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(1) - } -} diff --git a/cmd/idp/authorization.go b/cmd/influx/authorization.go similarity index 99% rename from cmd/idp/authorization.go rename to cmd/influx/authorization.go index 6a6ec551d2..1f74719b0c 100644 --- a/cmd/idp/authorization.go +++ b/cmd/influx/authorization.go @@ -6,7 +6,7 @@ import ( "os" "github.com/influxdata/platform" - "github.com/influxdata/platform/cmd/idp/internal" + "github.com/influxdata/platform/cmd/influx/internal" "github.com/influxdata/platform/http" "github.com/spf13/cobra" ) diff --git a/cmd/idp/bucket.go b/cmd/influx/bucket.go similarity index 99% rename from cmd/idp/bucket.go rename to cmd/influx/bucket.go index 67d378ede1..f00223dbf5 100644 --- a/cmd/idp/bucket.go +++ b/cmd/influx/bucket.go @@ -7,7 +7,7 @@ import ( "time" "github.com/influxdata/platform" - "github.com/influxdata/platform/cmd/idp/internal" + "github.com/influxdata/platform/cmd/influx/internal" "github.com/influxdata/platform/http" "github.com/spf13/cobra" ) diff --git a/cmd/idp/ifql.go b/cmd/influx/ifql.go similarity index 100% rename from cmd/idp/ifql.go rename to cmd/influx/ifql.go diff --git a/cmd/idp/internal/tabwriter.go b/cmd/influx/internal/tabwriter.go similarity index 100% rename from cmd/idp/internal/tabwriter.go rename to cmd/influx/internal/tabwriter.go diff --git a/cmd/influx/main.go b/cmd/influx/main.go new file mode 100644 index 0000000000..1a738352e7 --- /dev/null +++ b/cmd/influx/main.go @@ -0,0 +1,63 @@ +package main + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func main() { + Execute() +} + +var influxCmd = &cobra.Command{ + Use: "influx", + Short: "Influx Client", + Run: influxF, +} + +func init() { + influxCmd.AddCommand(authorizationCmd) + influxCmd.AddCommand(bucketCmd) + influxCmd.AddCommand(ifqlCmd) + influxCmd.AddCommand(organizationCmd) + influxCmd.AddCommand(userCmd) +} + +// Flags contains all the CLI flag values for influx. +type Flags struct { + token string + host string +} + +var flags Flags + +func init() { + viper.SetEnvPrefix("INFLUX") + + influxCmd.PersistentFlags().StringVarP(&flags.token, "token", "t", "", "API token to be used throughout client calls") + viper.BindEnv("TOKEN") + if h := viper.GetString("TOKEN"); h != "" { + flags.token = h + } + + influxCmd.PersistentFlags().StringVar(&flags.host, "host", "http://localhost:9999", "HTTP address of Influx") + viper.BindEnv("HOST") + if h := viper.GetString("HOST"); h != "" { + flags.host = h + } +} + +func influxF(cmd *cobra.Command, args []string) { + cmd.Usage() +} + +// Execute executes the influx command +func Execute() { + if err := influxCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} diff --git a/cmd/idp/organization.go b/cmd/influx/organization.go similarity index 98% rename from cmd/idp/organization.go rename to cmd/influx/organization.go index 3257af62fe..845488a513 100644 --- a/cmd/idp/organization.go +++ b/cmd/influx/organization.go @@ -6,7 +6,7 @@ import ( "os" "github.com/influxdata/platform" - "github.com/influxdata/platform/cmd/idp/internal" + "github.com/influxdata/platform/cmd/influx/internal" "github.com/influxdata/platform/http" "github.com/spf13/cobra" ) diff --git a/cmd/idp/user.go b/cmd/influx/user.go similarity index 98% rename from cmd/idp/user.go rename to cmd/influx/user.go index f3d2454dce..8daef8e7cd 100644 --- a/cmd/idp/user.go +++ b/cmd/influx/user.go @@ -6,7 +6,7 @@ import ( "os" "github.com/influxdata/platform" - "github.com/influxdata/platform/cmd/idp/internal" + "github.com/influxdata/platform/cmd/influx/internal" "github.com/influxdata/platform/http" "github.com/spf13/cobra" )