Merge "list all valid flags (commands) to soong_ui upon unknown command" am: b3af19caa2 am: 996117ca37

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1965381

Change-Id: If7a509e0ab238af5e6fe25f032f942358d7ee0f8
This commit is contained in:
Usta Shrestha
2022-01-29 07:13:17 +00:00
committed by Automerger Merge Worker

View File

@@ -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)",
@@ -571,7 +571,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.