mirror of
https://github.com/minio/minio.git
synced 2024-12-29 00:23:21 -05:00
40 lines
644 B
Go
40 lines
644 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/codegangsta/cli"
|
|
)
|
|
|
|
func put(c *cli.Context) {
|
|
config, err := parseInput(c)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
objectPath := c.Args().Get(0)
|
|
var filePath string
|
|
switch len(c.Args()) {
|
|
case 1:
|
|
filePath = objectPath
|
|
case 2:
|
|
filePath = c.Args().Get(1)
|
|
default:
|
|
log.Fatal("Please specify a valid object name \n # erasure-demo put [OBJECTNAME] [FILENAME]")
|
|
}
|
|
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")
|
|
}
|
|
}
|
|
}
|