2014-12-08 22:40:48 -05:00
|
|
|
package main
|
2014-12-09 06:32:31 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/codegangsta/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
func put(c *cli.Context) {
|
|
|
|
config, err := parseInput(c)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
filePath := c.Args().Get(0)
|
|
|
|
if len(filePath) == 0 {
|
|
|
|
log.Fatal("Please specify a valid object name \n # erasure-demo put <OBJECTNAME>")
|
|
|
|
}
|
|
|
|
inputFile, err := os.Open(filePath)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
switch config.storageDriver {
|
|
|
|
case "fs":
|
|
|
|
{
|
|
|
|
fsPut(config, c.Args().Get(0), inputFile)
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
log.Fatal("Unknown driver")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|