Merge pull request #1277 from abperiasamy/cat-review

cat code review
This commit is contained in:
Anand Babu (AB) Periasamy
2015-11-12 00:17:41 -08:00
2 changed files with 13 additions and 22 deletions
+5 -15
View File
@@ -42,24 +42,18 @@ USAGE:
mc {{.Name}} SOURCE [SOURCE...]
EXAMPLES:
1. Concantenate an object from Amazon S3 cloud storage to mplayer standard input.
1. Stream an object from Amazon S3 cloud storage to mplayer standard input.
$ mc {{.Name}} https://s3.amazonaws.com/ferenginar/klingon_opera_aktuh_maylotah.ogg | mplayer -
2. Concantenate contents of file1.txt and stdin to standard output.
$ mc {{.Name}} file1.txt - > file.txt
3. Concantenate multiple files from the local filesystem to standard output.
3. Concantenate multiple files to one.
$ mc {{.Name}} part.* > complete.img
4. Concatenate a non english file name from Amazon S3 cloud storage.
$ mc {{.Name}} s3/andoria/本語 > /tmp/本語
5. Behave like operating system ‘cat’ tool. Useful for alias cat='mc --mimic cat'.
$ echo "Hello, World!" | mc --mimic {{.Name}}
Hello, World!
6. Concantenate an object with space characters from Amazon S3 cloud storage.
$ mc {{.Name}} 's3/miniocloud/Readme First.txt' | head -1
4. Behave like operating system ‘cat’ tool. Useful for aliasing.
$ alias {{.Name}}='mc --mimic {{.Name}}'
$ {{.Name}} /etc/issue.txt
`,
}
@@ -101,10 +95,6 @@ func catURL(sourceURL string) *probe.Error {
// catOut reads from reader stream and writes to stdout.
func catOut(r io.Reader) *probe.Error {
// Do not forget to flush after stdout.
// out := bufio.NewWriter(os.Stdout)
// defer out.Flush()
// Read till EOF.
if _, err := io.Copy(os.Stdout, r); err != nil {
switch e := err.(type) {
+8 -7
View File
@@ -66,20 +66,21 @@ EXAMPLES:
...
4. List files with non-English characters on Amazon S3 cloud storage.
$ mc ls s3/andoria/本...
$ mc {{.Name}} s3/andoria/本...
[2015-05-19 17:28:22 PDT] 41B 本語.md
5. List folders with space separated names on Amazon S3 cloud storage.
$ mc ls 's3/miniocloud/Community Files/'
$ mc {{.Name}} 's3/miniocloud/Community Files/'
[2015-05-19 17:28:22 PDT] 41B 本語.md
6. Behave like an operating system ‘ls’. [HINT: Add it to your shell alias].
$ mc --mimic ls
6. Behave like operating system ‘ls’ tool. Useful for aliasing.
$ alias ls='mc --mimic ls'
$ {{.Name}}
[2015-05-19 17:28:22 PDT] 41B 本語.md
7. List incomplete uploads of objects on Amazon S3.
$ mc ls --incomplete s3/mybucket
[2015-10-19 22:28:02 PDT] 32MiB backup/server112-11Nov15.tgz
7. List incomplete (previously failed) uploads of objects on Amazon S3.
$ mc {{.Name}} --incomplete s3/mybucket
[2015-10-19 22:28:02 PDT] 41MiB backup/server112-11Nov15.tgz
`,
}