commands: move kv subcommands to subdirs

pull/3584/head
Frank Schroeder 2017-10-17 13:22:23 +02:00 committed by Frank Schröder
parent e16ef316d4
commit ce1ec000ca
12 changed files with 23 additions and 23 deletions

View File

@ -18,11 +18,11 @@ import (
"github.com/hashicorp/consul/command/keygen" "github.com/hashicorp/consul/command/keygen"
"github.com/hashicorp/consul/command/keyring" "github.com/hashicorp/consul/command/keyring"
"github.com/hashicorp/consul/command/kv" "github.com/hashicorp/consul/command/kv"
"github.com/hashicorp/consul/command/kvdel" kvdel "github.com/hashicorp/consul/command/kv/del"
"github.com/hashicorp/consul/command/kvexp" kvexp "github.com/hashicorp/consul/command/kv/exp"
"github.com/hashicorp/consul/command/kvget" kvget "github.com/hashicorp/consul/command/kv/get"
"github.com/hashicorp/consul/command/kvimp" kvimp "github.com/hashicorp/consul/command/kv/imp"
"github.com/hashicorp/consul/command/kvput" kvput "github.com/hashicorp/consul/command/kv/put"
"github.com/hashicorp/consul/command/leave" "github.com/hashicorp/consul/command/leave"
"github.com/hashicorp/consul/command/lock" "github.com/hashicorp/consul/command/lock"
"github.com/hashicorp/consul/command/maint" "github.com/hashicorp/consul/command/maint"

View File

@ -1,4 +1,4 @@
package kvdel package del
import ( import (
"flag" "flag"

View File

@ -1,4 +1,4 @@
package kvdel package del
import ( import (
"strconv" "strconv"

View File

@ -1,4 +1,4 @@
package kvexp package exp
import ( import (
"encoding/json" "encoding/json"
@ -7,7 +7,7 @@ import (
"github.com/hashicorp/consul/api" "github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/command/flags" "github.com/hashicorp/consul/command/flags"
"github.com/hashicorp/consul/command/kvimpexp" "github.com/hashicorp/consul/command/kv/impexp"
"github.com/mitchellh/cli" "github.com/mitchellh/cli"
) )
@ -72,9 +72,9 @@ func (c *cmd) Run(args []string) int {
return 1 return 1
} }
exported := make([]*kvimpexp.Entry, len(pairs)) exported := make([]*impexp.Entry, len(pairs))
for i, pair := range pairs { for i, pair := range pairs {
exported[i] = kvimpexp.ToEntry(pair) exported[i] = impexp.ToEntry(pair)
} }
marshaled, err := json.MarshalIndent(exported, "", "\t") marshaled, err := json.MarshalIndent(exported, "", "\t")

View File

@ -1,4 +1,4 @@
package kvexp package exp
import ( import (
"encoding/base64" "encoding/base64"
@ -8,7 +8,7 @@ import (
"github.com/hashicorp/consul/agent" "github.com/hashicorp/consul/agent"
"github.com/hashicorp/consul/api" "github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/command/kvimpexp" "github.com/hashicorp/consul/command/kv/impexp"
"github.com/mitchellh/cli" "github.com/mitchellh/cli"
) )
@ -53,7 +53,7 @@ func TestKVExportCommand_Run(t *testing.T) {
output := ui.OutputWriter.String() output := ui.OutputWriter.String()
var exported []*kvimpexp.Entry var exported []*impexp.Entry
err := json.Unmarshal([]byte(output), &exported) err := json.Unmarshal([]byte(output), &exported)
if err != nil { if err != nil {
t.Fatalf("bad: %d", code) t.Fatalf("bad: %d", code)

View File

@ -1,4 +1,4 @@
package kvget package get
import ( import (
"bytes" "bytes"

View File

@ -1,4 +1,4 @@
package kvget package get
import ( import (
"encoding/base64" "encoding/base64"

View File

@ -1,4 +1,4 @@
package kvimp package imp
import ( import (
"bytes" "bytes"
@ -13,7 +13,7 @@ import (
"github.com/hashicorp/consul/api" "github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/command/flags" "github.com/hashicorp/consul/command/flags"
"github.com/hashicorp/consul/command/kvimpexp" "github.com/hashicorp/consul/command/kv/impexp"
"github.com/mitchellh/cli" "github.com/mitchellh/cli"
) )
@ -61,7 +61,7 @@ func (c *cmd) Run(args []string) int {
return 1 return 1
} }
var entries []*kvimpexp.Entry var entries []*impexp.Entry
if err := json.Unmarshal([]byte(data), &entries); err != nil { if err := json.Unmarshal([]byte(data), &entries); err != nil {
c.UI.Error(fmt.Sprintf("Cannot unmarshal data: %s", err)) c.UI.Error(fmt.Sprintf("Cannot unmarshal data: %s", err))
return 1 return 1

View File

@ -1,4 +1,4 @@
package kvimp package imp
import ( import (
"strings" "strings"

View File

@ -1,4 +1,4 @@
package kvimpexp package impexp
import ( import (
"encoding/base64" "encoding/base64"

View File

@ -1,4 +1,4 @@
package kvput package put
import ( import (
"bytes" "bytes"

View File

@ -1,4 +1,4 @@
package kvput package put
import ( import (
"bytes" "bytes"