proxygen
Main.cpp File Reference
#include <fizz/tool/Commands.h>
#include <folly/ssl/Init.h>
#include <glog/logging.h>
#include <iostream>
#include <string>
#include <vector>

Go to the source code of this file.

Functions

void showUsage ()
 
int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 27 of file Main.cpp.

References fizz::tool::fizzUtilities, i, folly::ssl::init(), and showUsage().

27  {
28  google::InitGoogleLogging(argv[0]);
29  FLAGS_logtostderr = 1;
31  std::vector<std::string> arguments;
32  for (int i = 0; i < argc; i++) {
33  arguments.push_back(argv[i]);
34  }
35 
36  if (arguments.size() < 2) {
37  showUsage();
38  return 1;
39  } else {
40  if (fizzUtilities.count(arguments[1])) {
41  return fizzUtilities.at(arguments[1])(arguments);
42  } else {
43  std::cerr << "Unknown command '" << arguments[1] << "'." << std::endl;
44  showUsage();
45  return 1;
46  }
47  }
48  return 0;
49 }
void init()
Definition: Init.cpp:54
void showUsage()
Definition: Main.cpp:19
char ** argv
const std::map< std::string, std::function< int(const std::vector< std::string > &)> > fizzUtilities
Definition: Commands.h:23
void showUsage ( )

Definition at line 19 of file Main.cpp.

References fizz::tool::fizzUtilities.

Referenced by main().

19  {
20  std::cerr << "Supported commands:" << std::endl;
21  for (const auto& command : fizzUtilities) {
22  std::cerr << " - " << command.first << std::endl;
23  }
24  std::cerr << std::endl;
25 }
const std::map< std::string, std::function< int(const std::vector< std::string > &)> > fizzUtilities
Definition: Commands.h:23