From 98119707fb45545fed66e62f8a18d51d193eca8b Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 15 Dec 2014 20:09:50 -0800 Subject: [PATCH] Move wrappers at pkgs/minio back to cmd/minio - as their usage is limited --- {pkgs => cmd}/minio/common.go | 4 ++-- {pkgs => cmd}/minio/encode.go | 4 ++-- {pkgs => cmd}/minio/erasure.go | 2 +- {pkgs => cmd}/minio/get.go | 4 ++-- cmd/minio/init.go | 1 + {pkgs => cmd}/minio/list.go | 4 ++-- cmd/minio/minio.go | 19 +++++++++---------- {pkgs => cmd}/minio/put.go | 4 ++-- cmd/minio/verify.go | 1 + pkgs/minio/init.go | 1 - pkgs/minio/verify.go | 1 - 11 files changed, 22 insertions(+), 23 deletions(-) rename {pkgs => cmd}/minio/common.go (97%) rename {pkgs => cmd}/minio/encode.go (93%) rename {pkgs => cmd}/minio/erasure.go (99%) rename {pkgs => cmd}/minio/get.go (91%) create mode 100644 cmd/minio/init.go rename {pkgs => cmd}/minio/list.go (86%) rename {pkgs => cmd}/minio/put.go (94%) create mode 100644 cmd/minio/verify.go delete mode 100644 pkgs/minio/init.go delete mode 100644 pkgs/minio/verify.go diff --git a/pkgs/minio/common.go b/cmd/minio/common.go similarity index 97% rename from pkgs/minio/common.go rename to cmd/minio/common.go index a799016bd..dbc4a853f 100644 --- a/pkgs/minio/common.go +++ b/cmd/minio/common.go @@ -1,4 +1,4 @@ -package minio +package main import ( "errors" @@ -75,7 +75,7 @@ func parseInput(c *cli.Context) (inputConfig, error) { return config, nil } -func Getobjectdir(basename string) string { +func getObjectdir(basename string) string { user, err := user.Current() if err != nil { log.Fatal(err) diff --git a/pkgs/minio/encode.go b/cmd/minio/encode.go similarity index 93% rename from pkgs/minio/encode.go rename to cmd/minio/encode.go index f28605b1d..9ba59fe40 100644 --- a/pkgs/minio/encode.go +++ b/cmd/minio/encode.go @@ -1,4 +1,4 @@ -package minio +package main import ( "log" @@ -6,7 +6,7 @@ import ( "github.com/codegangsta/cli" ) -func Encode(c *cli.Context) { +func encode(c *cli.Context) { config, err := parseInput(c) if err != nil { log.Fatal(err) diff --git a/pkgs/minio/erasure.go b/cmd/minio/erasure.go similarity index 99% rename from pkgs/minio/erasure.go rename to cmd/minio/erasure.go index 64d2cbb8f..eecbceece 100644 --- a/pkgs/minio/erasure.go +++ b/cmd/minio/erasure.go @@ -1,4 +1,4 @@ -package minio +package main import ( "bytes" diff --git a/pkgs/minio/get.go b/cmd/minio/get.go similarity index 91% rename from pkgs/minio/get.go rename to cmd/minio/get.go index 68f271965..1d1573477 100644 --- a/pkgs/minio/get.go +++ b/cmd/minio/get.go @@ -1,4 +1,4 @@ -package minio +package main import ( "io" @@ -8,7 +8,7 @@ import ( "github.com/codegangsta/cli" ) -func Get(c *cli.Context) { +func get(c *cli.Context) { config, err := parseInput(c) if err != nil { log.Fatal(err) diff --git a/cmd/minio/init.go b/cmd/minio/init.go new file mode 100644 index 000000000..06ab7d0f9 --- /dev/null +++ b/cmd/minio/init.go @@ -0,0 +1 @@ +package main diff --git a/pkgs/minio/list.go b/cmd/minio/list.go similarity index 86% rename from pkgs/minio/list.go rename to cmd/minio/list.go index 59d3769ad..179424d4c 100644 --- a/pkgs/minio/list.go +++ b/cmd/minio/list.go @@ -1,4 +1,4 @@ -package minio +package main import ( "io" @@ -8,7 +8,7 @@ import ( "github.com/codegangsta/cli" ) -func List(c *cli.Context) { +func list(c *cli.Context) { config, err := parseInput(c) if err != nil { log.Fatal(err) diff --git a/cmd/minio/minio.go b/cmd/minio/minio.go index 9fe2a5f82..798b88b8b 100644 --- a/cmd/minio/minio.go +++ b/cmd/minio/minio.go @@ -4,7 +4,6 @@ import ( "os" "github.com/codegangsta/cli" - "github.com/minio-io/minio/pkgs/minio" ) func main() { @@ -15,16 +14,16 @@ func main() { { Name: "encode", Usage: "erasure encode a byte stream", - Action: minio.Encode, + Action: encode, Flags: []cli.Flag{ cli.StringFlag{ Name: "root", - Value: minio.Getobjectdir(".minio/erasure"), + Value: getObjectdir(".minio/erasure"), Usage: "", }, cli.StringFlag{ Name: "staging", - Value: minio.Getobjectdir(".minio/staging"), + Value: getObjectdir(".minio/staging"), Usage: "", }, cli.StringFlag{ @@ -42,11 +41,11 @@ func main() { { Name: "get", Usage: "get an object", - Action: minio.Get, + Action: get, Flags: []cli.Flag{ cli.StringFlag{ Name: "root", - Value: minio.Getobjectdir(".minio/erasure"), + Value: getObjectdir(".minio/erasure"), Usage: "", }, cli.StringFlag{ @@ -64,11 +63,11 @@ func main() { { Name: "put", Usage: "put an object", - Action: minio.Put, + Action: put, Flags: []cli.Flag{ cli.StringFlag{ Name: "staging", - Value: minio.Getobjectdir(".minio/staging"), + Value: getObjectdir(".minio/staging"), Usage: "", }, cli.StringFlag{ @@ -81,11 +80,11 @@ func main() { { Name: "list", Usage: "list objects", - Action: minio.List, + Action: list, Flags: []cli.Flag{ cli.StringFlag{ Name: "root", - Value: minio.Getobjectdir(".minio/erasure"), + Value: getObjectdir(".minio/erasure"), Usage: "", }, }, diff --git a/pkgs/minio/put.go b/cmd/minio/put.go similarity index 94% rename from pkgs/minio/put.go rename to cmd/minio/put.go index 021d49556..2336b3bbc 100644 --- a/pkgs/minio/put.go +++ b/cmd/minio/put.go @@ -1,4 +1,4 @@ -package minio +package main import ( "log" @@ -8,7 +8,7 @@ import ( "github.com/codegangsta/cli" ) -func Put(c *cli.Context) { +func put(c *cli.Context) { config, err := parseInput(c) if err != nil { log.Fatal(err) diff --git a/cmd/minio/verify.go b/cmd/minio/verify.go new file mode 100644 index 000000000..06ab7d0f9 --- /dev/null +++ b/cmd/minio/verify.go @@ -0,0 +1 @@ +package main diff --git a/pkgs/minio/init.go b/pkgs/minio/init.go deleted file mode 100644 index c5576b1fd..000000000 --- a/pkgs/minio/init.go +++ /dev/null @@ -1 +0,0 @@ -package minio diff --git a/pkgs/minio/verify.go b/pkgs/minio/verify.go deleted file mode 100644 index c5576b1fd..000000000 --- a/pkgs/minio/verify.go +++ /dev/null @@ -1 +0,0 @@ -package minio