Move donut cmd into ./mc
This commit is contained in:
@@ -1 +0,0 @@
|
||||
donut
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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()) {
|
||||
@@ -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)
|
||||
+16
-11
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user