main_utils.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_ZUCCHINI_MAIN_UTILS_H_
  5. #define COMPONENTS_ZUCCHINI_MAIN_UTILS_H_
  6. #include <iosfwd>
  7. #include "components/zucchini/zucchini.h"
  8. // Utilities to run Zucchini command based on command-line input, and to print
  9. // help messages.
  10. namespace base {
  11. class CommandLine;
  12. } // namespace base
  13. // To add a new Zucchini command:
  14. // 1. Declare the command's main function in zucchini_command.h. Its signature
  15. // must match CommandFunction.
  16. // 2. Define the command's main function in zucchini_command.cc.
  17. // 3. Add a new entry into |kCommands| in main_utils.cc.
  18. // Searches |command_line| for Zucchini commands. If a unique command is found,
  19. // runs it (passes |out| and |err|), and logs resource usage. Otherwise prints
  20. // help message to |err|. Returns Zucchini status code for error handling.
  21. zucchini::status::Code RunZucchiniCommand(const base::CommandLine& command_line,
  22. std::ostream& out,
  23. std::ostream& err);
  24. #endif // COMPONENTS_ZUCCHINI_MAIN_UTILS_H_