1
0
mirror of https://github.com/minio/mc.git synced 2025-11-12 01:02:26 +03:00

Full cleanup of s3 client for mc

This commit is contained in:
Harshavardhana
2015-05-01 15:52:08 -07:00
parent 28315e7492
commit 78a78c072a
23 changed files with 1008 additions and 875 deletions

20
ls.go
View File

@@ -35,8 +35,8 @@ const (
printDate = "2006-01-02 15:04:05 MST"
)
// printItem prints item meta-data
func printItem(date time.Time, v int64, name string, fileType os.FileMode) {
// printContent prints content meta-data
func printContent(date time.Time, v int64, name string, fileType os.FileMode) {
fmt.Printf(console.Time("[%s] ", date.Local().Format(printDate)))
fmt.Printf(console.Size("%6s ", humanize.IBytes(uint64(v))))
@@ -57,12 +57,12 @@ func printItem(date time.Time, v int64, name string, fileType os.FileMode) {
// doList - list all entities inside a folder
func doList(clnt client.Client, targetURL string) error {
var err error
for itemCh := range clnt.List() {
if itemCh.Err != nil {
err = itemCh.Err
for contentCh := range clnt.List() {
if contentCh.Err != nil {
err = contentCh.Err
break
}
printItem(itemCh.Item.Time, itemCh.Item.Size, itemCh.Item.Name, itemCh.Item.FileType)
printContent(contentCh.Content.Time, contentCh.Content.Size, contentCh.Content.Name, contentCh.Content.FileType)
}
if err != nil {
return iodine.New(err, map[string]string{"Target": targetURL})
@@ -73,12 +73,12 @@ func doList(clnt client.Client, targetURL string) error {
// doListRecursive - list all entities inside folders and sub-folders recursively
func doListRecursive(clnt client.Client, targetURL string) error {
var err error
for itemCh := range clnt.ListRecursive() {
if itemCh.Err != nil {
err = itemCh.Err
for contentCh := range clnt.ListRecursive() {
if contentCh.Err != nil {
err = contentCh.Err
break
}
printItem(itemCh.Item.Time, itemCh.Item.Size, itemCh.Item.Name, itemCh.Item.FileType)
printContent(contentCh.Content.Time, contentCh.Content.Size, contentCh.Content.Name, contentCh.Content.FileType)
}
if err != nil {
return iodine.New(err, map[string]string{"Target": targetURL})