From 6feae38aa37906bb18fb35b5b1a527b72557a700 Mon Sep 17 00:00:00 2001 From: Usta Date: Mon, 13 Dec 2021 12:31:50 -0500 Subject: [PATCH] list all valid flags (commands) to soong_ui upon unknown command Test: m nothing Bug: N/A Change-Id: I0dd94c18e945a0ef4311b076d49086281ef288af --- cmd/soong_ui/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go index 9ee373e79..fc2e8e1da 100644 --- a/cmd/soong_ui/main.go +++ b/cmd/soong_ui/main.go @@ -67,7 +67,7 @@ type command struct { } // list of supported commands (flags) supported by soong ui -var commands []command = []command{ +var commands = []command{ { flag: "--make-mode", description: "build the modules by the target name (i.e. soong_docs)", @@ -562,7 +562,11 @@ func getCommand(args []string) (*command, []string, error) { } // command not found - return nil, nil, fmt.Errorf("Command not found: %q", args) + flags := make([]string, len(commands)) + for i, c := range commands { + flags[i] = c.flag + } + return nil, nil, fmt.Errorf("Command not found: %q\nDid you mean one of these: %q", args, flags) } // For Bazel support, this moves files and directories from e.g. out/dist/$f to DIST_DIR/$f if necessary.