From 22da2bab5c59d54cf6f21fbcbbb575d52223d99e Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Sat, 30 May 2015 18:03:34 -0700 Subject: [PATCH] alias support for ls --- cmd-ls.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd-ls.go b/cmd-ls.go index 583180e9..3a764e3f 100644 --- a/cmd-ls.go +++ b/cmd-ls.go @@ -75,7 +75,13 @@ EXAMPLES: // runListCmd - is a handler for mc ls command func runListCmd(ctx *cli.Context) { - if !ctx.Args().Present() || ctx.Args().First() == "help" { + args := ctx.Args() + + if globalAliasFlag { + if !ctx.Args().Present() { + args = []string{"."} + } + } else if !ctx.Args().Present() || ctx.Args().First() == "help" { cli.ShowCommandHelpAndExit(ctx, "ls", 1) // last argument is exit code } if !isMcConfigExist() { @@ -92,7 +98,7 @@ func runListCmd(ctx *cli.Context) { }) } targetURLConfigMap := make(map[string]*hostConfig) - for _, arg := range ctx.Args() { + for _, arg := range args { targetURL, err := getExpandedURL(arg, config.Aliases) if err != nil { switch e := iodine.ToError(err).(type) {