diff --git a/main.go b/main.go index c0f5e691..26033a44 100644 --- a/main.go +++ b/main.go @@ -143,7 +143,7 @@ func registerApp() *cli.App { registerCmd(mbCmd) // Make a bucket. registerCmd(catCmd) // Display contents of a file. registerCmd(rmCmd) // Remove a file or bucket - registerCmd(pigCmd) // Write contents of stdin to a file. + registerCmd(pipeCmd) // Write contents of stdin to a file. registerCmd(cpCmd) // Copy objects and files from multiple sources to single destination. registerCmd(mirrorCmd) // Mirror objects and files from single source to multiple destinations. registerCmd(sessionCmd) // Manage sessions for copy and mirror. diff --git a/pig-main.go b/pipe-main.go similarity index 80% rename from pig-main.go rename to pipe-main.go index 927fbc21..7acb0b04 100644 --- a/pig-main.go +++ b/pipe-main.go @@ -25,10 +25,10 @@ import ( ) // Display contents of a file. -var pigCmd = cli.Command{ - Name: "pig", - Usage: "Write contents of stdin to files. Pig is the opposite of cat command.", - Action: mainPig, +var pipeCmd = cli.Command{ + Name: "pipe", + Usage: "Write contents of stdin to one or more targets. Pipe is the opposite of cat command.", + Action: mainPipe, CustomHelpTemplate: `NAME: mc {{.Name}} - {{.Usage}} @@ -51,15 +51,15 @@ EXAMPLES: `, } -// checkPigSyntax performs command-line input validation for pig command. -func checkPigSyntax(ctx *cli.Context) { +// checkPipeSyntax performs command-line input validation for pipe command. +func checkPipeSyntax(ctx *cli.Context) { if !ctx.Args().Present() || ctx.Args().First() == "help" { - cli.ShowCommandHelpAndExit(ctx, "pig", 1) // last argument is exit code + cli.ShowCommandHelpAndExit(ctx, "pipe", 1) // last argument is exit code } } -// pig writes contents of stdin a collection of URLs. -func pig(targetURLs []string) *probe.Error { +// pipe writes contents of stdin a collection of URLs. +func pipe(targetURLs []string) *probe.Error { // Stream from stdin to multiple objects until EOF. // Ignore size, since os.Stat() would not return proper size all the time for local filesystem for example /proc files. err := putTargets(targetURLs, 0, os.Stdin) @@ -74,14 +74,14 @@ func pig(targetURLs []string) *probe.Error { return err.Trace() } -// mainPig is the main entry point for pig command. -func mainPig(ctx *cli.Context) { - checkPigSyntax(ctx) +// mainPipe is the main entry point for pipe command. +func mainPipe(ctx *cli.Context) { + checkPipeSyntax(ctx) // extract URLs. URLs, err := args2URLs(ctx.Args()) fatalIf(err.Trace(ctx.Args()...), "Unable to parse arguments.") - err = pig(URLs) + err = pipe(URLs) fatalIf(err.Trace(URLs...), "Unable to write to one or more targets.") } diff --git a/pig_test.go b/pipe_test.go similarity index 89% rename from pig_test.go rename to pipe_test.go index 4b4357d5..1914eba2 100644 --- a/pig_test.go +++ b/pipe_test.go @@ -25,13 +25,13 @@ import ( . "gopkg.in/check.v1" ) -func (s *TestSuite) TestPigFail(c *C) { +func (s *TestSuite) TestPipeFail(c *C) { /// filesystem root, err := ioutil.TempDir(os.TempDir(), "cmd-") c.Assert(err, IsNil) defer os.RemoveAll(root) - err = app.Run([]string{os.Args[0], "pig", server.URL + "/bucket/"}) + err = app.Run([]string{os.Args[0], "pipe", server.URL + "/bucket/"}) c.Assert(err, IsNil) c.Assert(console.IsExited, Equals, true)