Skip to content

Commit

Permalink
feat(cli/modules): Added the modules flag -m to hhvms cli
Browse files Browse the repository at this point in the history
Summary: feat(cli/modules):

Added the --modules flag to the cli, +1 towards feature parity with the zend cli.
Closes #6270

Reviewed By: @jwatzman

Differential Revision: D2459135

fb-gh-sync-id: bf68023457263ef91fe54a6b7e2a17836145abef
  • Loading branch information
kaustavha authored and hhvm-bot committed Oct 13, 2015
1 parent ee81ae8 commit 5a2fad5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hphp/runtime/base/emulate-zend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ int emulate_zend(int argc, char** argv) {
need_file = false;
break;
}
if (strcmp(argv[cnt], "--modules") == 0) {
// zend has a -m flag but we're already using it for --mode
newargv.push_back("--modules");
cnt = argc; // no need to check the rest of options and arguments
need_file = false;
break;
}
if (strcmp(argv[cnt], "-f") == 0 || strcmp(argv[cnt], "--file") == 0) {
cnt++;
newargv.push_back(lint ? "-l" : "-f");
Expand Down
9 changes: 9 additions & 0 deletions hphp/runtime/base/program-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,7 @@ static int execute_program_impl(int argc, char** argv) {
desc.add_options()
("help", "display this message")
("version", "display version number")
("modules", "display modules")
("php", "emulate the standard php command line")
("compiler-id", "display the git hash for the compiler")
("repo-schema", "display the repository schema id")
Expand Down Expand Up @@ -1454,6 +1455,14 @@ static int execute_program_impl(int argc, char** argv) {
cout << "Repo schema: " << kRepoSchemaId << "\n";
return 0;
}
if (vm.count("modules")) {
Array exts = ExtensionRegistry::getLoaded();
cout << "[PHP Modules]" << "\n";
for (ArrayIter iter(exts); iter; ++iter) {
cout << iter.second().toString().toCppString() << "\n";
}
return 0;
}
if (vm.count("compiler-id")) {
cout << kCompilerId << "\n";
return 0;
Expand Down

0 comments on commit 5a2fad5

Please sign in to comment.