aboutsummaryrefslogtreecommitdiff
path: root/main_utils.h
blob: 6c97aad767412e339b016a24635d04c128cc63ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// 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 "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_