From deb889d2fb8cb680201da3cc9f168a736cf6ff5b Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 23 Mar 2015 14:15:16 -0700 Subject: [PATCH] Move donut cmd into ./mc --- cmd/donut/.gitignore | 1 - cmd/donut/main.go | 58 -------------------------- cmd/donut/cmd-cp.go => donut-cmd-cp.go | 2 +- cmd/donut/cmd-mb.go => donut-cmd-mb.go | 4 +- donut-options.go | 27 +++++++----- 5 files changed, 19 insertions(+), 73 deletions(-) delete mode 100644 cmd/donut/.gitignore delete mode 100644 cmd/donut/main.go rename cmd/donut/cmd-cp.go => donut-cmd-cp.go (97%) rename cmd/donut/cmd-mb.go => donut-cmd-mb.go (91%) diff --git a/cmd/donut/.gitignore b/cmd/donut/.gitignore deleted file mode 100644 index 11abcb13..00000000 --- a/cmd/donut/.gitignore +++ /dev/null @@ -1 +0,0 @@ -donut \ No newline at end of file diff --git a/cmd/donut/main.go b/cmd/donut/main.go deleted file mode 100644 index 85b470fe..00000000 --- a/cmd/donut/main.go +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Minimalist Object Storage, (C) 2014,2015 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package main - -import ( - "log" - "os" - "os/user" - - "github.com/codegangsta/cli" -) - -func init() { - // Check for the environment early on and gracefuly report. - _, err := user.Current() - if err != nil { - log.Fatalf("mc: Unable to obtain user's home directory. \nError: %s\n", err) - } -} - -var cp = cli.Command{ - Name: "cp", - Action: doDonutCp, -} - -var mb = cli.Command{ - Name: "mb", - Action: doMakeBucketCmd, -} - -var options = []cli.Command{ - cp, - mb, -} - -func main() { - app := cli.NewApp() - app.Usage = "Minio Client for S3 Compatible Object Storage" - app.Version = "0.1.0" - app.Commands = options - app.Author = "Minio.io" - app.EnableBashCompletion = true - app.Run(os.Args) -} diff --git a/cmd/donut/cmd-cp.go b/donut-cmd-cp.go similarity index 97% rename from cmd/donut/cmd-cp.go rename to donut-cmd-cp.go index 7a0d4703..04294791 100644 --- a/cmd/donut/cmd-cp.go +++ b/donut-cmd-cp.go @@ -11,7 +11,7 @@ import ( "github.com/minio-io/mc/pkg/donut" ) -func doDonutCp(c *cli.Context) { +func doDonutCPCmd(c *cli.Context) { var e donut.Donut e = donut.NewDonutDriver("testdir") switch len(c.Args()) { diff --git a/cmd/donut/cmd-mb.go b/donut-cmd-mb.go similarity index 91% rename from cmd/donut/cmd-mb.go rename to donut-cmd-mb.go index 43f6f911..96e15c9f 100644 --- a/cmd/donut/cmd-mb.go +++ b/donut-cmd-mb.go @@ -23,8 +23,8 @@ import ( "github.com/minio-io/mc/pkg/donut" ) -// doMakeBucketCmd creates a new bucket -func doMakeBucketCmd(c *cli.Context) { +// doMakeDonutBucketCmd creates a new bucket +func doMakeDonutBucketCmd(c *cli.Context) { urlArg1, err := url.Parse(c.Args().Get(0)) if err != nil { panic(err) diff --git a/donut-options.go b/donut-options.go index 91be0ccd..e736723d 100644 --- a/donut-options.go +++ b/donut-options.go @@ -4,13 +4,6 @@ import ( "github.com/codegangsta/cli" ) -var formatCmd = cli.Command{ - Name: "format", - Usage: "format disk", - Description: "format a given disk", - Action: doFormatCmd, -} - var healCmd = cli.Command{ Name: "heal", Usage: "heal donut", @@ -39,15 +32,27 @@ var rebalanceCmd = cli.Command{ Action: doRebalanceCmd, } +var cpDonutCmd = cli.Command{ + Name: "cp", + Usage: "cp", + Description: "", + Action: doDonutCPCmd, +} + +var mbDonutCmd = cli.Command{ + Name: "mb", + Usage: "mb", + Description: "", + Action: doMakeDonutBucketCmd, +} + var donutOptions = []cli.Command{ - formatCmd, healCmd, attachCmd, detachCmd, rebalanceCmd, -} - -func doFormatCmd(c *cli.Context) { + cpDonutCmd, + mbDonutCmd, } func doHealCmd(c *cli.Context) {