示例#1
0
文件: cli.cpp 项目: jakubsvehla/hex
void CLI::Run (int argc, char ** argv)
{
  Editor editor;

  if (argc < 2) Usage(EXIT_FAILURE);

  // Handle special options --help and --version
  if (strcmp(argv[1], "-h") == 0 ||
      strcmp(argv[1], "--help") == 0) Usage(EXIT_SUCCESS);

  if (strcmp(argv[1], "-v") == 0 ||
      strcmp(argv[1], "--version") == 0) Version();

  // Initialize editor
  editor.Init();

  editor.OpenFile(argv[1]);

  // Start editor
  editor.Run();

}