Created resuable DumpApkCommand and added "badger"

This change refactors the dump commands to inherit from a base
DumpApkCommand and adds a command that prints out an ASCII
image of a badger if the user wrote "badger" instead of
"badging". The command is hidden from the help menu.

Bug: 73535002
Test: manual
Change-Id: I9bdd8a7bbf6a4282c4933e5c478f6d1d8e32d99e
diff --git a/tools/aapt2/cmd/Command.cpp b/tools/aapt2/cmd/Command.cpp
index 09411b9..bdee5c9 100644
--- a/tools/aapt2/cmd/Command.cpp
+++ b/tools/aapt2/cmd/Command.cpp
@@ -93,9 +93,13 @@
   flags_.push_back(Flag{name.to_string(), description.to_string(), func, false, 0, false});
 }
 
-void Command::AddOptionalSubcommand(std::unique_ptr<Command>&& subcommand) {
+void Command::AddOptionalSubcommand(std::unique_ptr<Command>&& subcommand, bool experimental) {
   subcommand->fullname_ = name_ + " " + subcommand->name_;
-  subcommands_.push_back(std::move(subcommand));
+  if (experimental) {
+    experimental_subcommands_.push_back(std::move(subcommand));
+  } else {
+    subcommands_.push_back(std::move(subcommand));
+  }
 }
 
 void Command::SetDescription(const android::StringPiece& description) {
@@ -162,7 +166,7 @@
   for (size_t i = 0; i < args.size(); i++) {
     StringPiece arg = args[i];
     if (*(arg.data()) != '-') {
-      // Continue parsing as the sub command if the first argument matches one of the subcommands
+      // Continue parsing as the subcommand if the first argument matches one of the subcommands
       if (i == 0) {
         for (auto& subcommand : subcommands_) {
           if (arg == subcommand->name_ || arg==subcommand->short_name_) {
@@ -170,6 +174,12 @@
                 std::vector<android::StringPiece>(args.begin() + 1, args.end()), out_error);
           }
         }
+        for (auto& subcommand : experimental_subcommands_) {
+          if (arg == subcommand->name_ || arg==subcommand->short_name_) {
+            return subcommand->Execute(
+              std::vector<android::StringPiece>(args.begin() + 1, args.end()), out_error);
+          }
+        }
       }
 
       file_args.push_back(arg.to_string());