diff options
Diffstat (limited to 'main_utils.h')
-rw-r--r-- | main_utils.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/main_utils.h b/main_utils.h new file mode 100644 index 0000000..addb830 --- /dev/null +++ b/main_utils.h @@ -0,0 +1,35 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_ZUCCHINI_MAIN_UTILS_H_ +#define COMPONENTS_ZUCCHINI_MAIN_UTILS_H_ + +#include <iosfwd> + +#include "base/files/file_path.h" +#include "components/zucchini/zucchini.h" + +// Utilities to run Zucchini command based on command-line input, and to print +// help messages. + +namespace base { + +class CommandLine; + +} // namespace base + +// To add a new Zucchini command: +// 1. Declare the command's main function in zucchini_command.h. Its signature +// must match CommandFunction. +// 2. Define the command's main function in zucchini_command.cc. +// 3. Add a new entry into |kCommands| in main_utils.cc. + +// Searches |command_line| for Zucchini commands. If a unique command is found, +// runs it (passes |out| and |err|), and logs resource usage. Otherwise prints +// help message to |err|. Returns Zucchini status code for error handling. +zucchini::status::Code RunZucchiniCommand(const base::CommandLine& command_line, + std::ostream& out, + std::ostream& err); + +#endif // COMPONENTS_ZUCCHINI_MAIN_UTILS_H_ |