[ARVADOS] updated: 1.1.4-584-gbe0cdc781

Git user git at public.curoverse.com
Tue Jul 10 23:01:00 EDT 2018


Summary of changes:
 lib/cmd/cmd.go | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

       via  be0cdc7814a49fa093b86b698a9756971ba80fcf (commit)
      from  688319dca9cbbb27452a0062943bb38b6935254e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit be0cdc7814a49fa093b86b698a9756971ba80fcf
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Tue Jul 10 23:00:06 2018 -0400

    Fix: subcommand not recognized in $0 when no CLI args are given.
    
    refs #13779
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/lib/cmd/cmd.go b/lib/cmd/cmd.go
index 353167e80..8c65cf7ac 100644
--- a/lib/cmd/cmd.go
+++ b/lib/cmd/cmd.go
@@ -52,19 +52,15 @@ func (v Version) RunCommand(prog string, args []string, stdin io.Reader, stdout,
 type Multi map[string]Handler
 
 func (m Multi) RunCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int {
-	if len(args) < 1 {
-		fmt.Fprintf(stderr, "usage: %s command [args]\n", prog)
-		m.Usage(stderr)
-		return 2
-	}
 	_, basename := filepath.Split(prog)
-	if strings.HasPrefix(basename, "arvados-") {
-		basename = basename[8:]
-	} else if strings.HasPrefix(basename, "crunch-") {
-		basename = basename[7:]
-	}
+	basename = strings.TrimPrefix(basename, "arvados-")
+	basename = strings.TrimPrefix(basename, "crunch-")
 	if cmd, ok := m[basename]; ok {
 		return cmd.RunCommand(prog, args, stdin, stdout, stderr)
+	} else if len(args) < 1 {
+		fmt.Fprintf(stderr, "usage: %s command [args]\n", prog)
+		m.Usage(stderr)
+		return 2
 	} else if cmd, ok = m[args[0]]; ok {
 		return cmd.RunCommand(prog+" "+args[0], args[1:], stdin, stdout, stderr)
 	} else {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list