Skip to content

Commit 7e4d7ea

Browse files
committed
Merge pull request #8 from jruby/search-options
Add support for -X? and -X...
2 parents 1b35b97 + c0432b8 commit 7e4d7ea

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

argparser.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <climits>
88
#include <memory>
99
#include <string>
10+
#include <algorithm>
1011
#include <unistd.h>
1112
#include "utilsfuncs.h"
1213
#include "argparser.h"
@@ -360,6 +361,8 @@ bool ArgParser::parseArgs(int argc, char *argv[]) {
360361
return false;
361362
} else if (strcmp(it->c_str(), "-Xproperties") == 0) {
362363
progArgs.push_back(std::string("--properties"));
364+
} else if (endsWith(*it, "?") || endsWith(*it, "...")) {
365+
progArgs.push_back(*it);
363366
} else if (it->compare(0, 2, "-X", 2) == 0 && islower(it->c_str()[2])) {
364367
// Any other /-X([a-z].*)/ get turned into a -Djruby.\1 property
365368
std::string propPart = it->substr(2);
@@ -658,3 +661,7 @@ void ArgParser::addOptionsToCommandLine(list<string> & commandLine) {
658661
commandLine.insert(commandLine.end(), bootclass);
659662
commandLine.insert(commandLine.end(), progArgs.begin(), progArgs.end());
660663
}
664+
665+
bool ArgParser::endsWith(const std::string &string, const std::string &end) {
666+
return std::equal(string.begin() + string.size() - end.size(), string.end(), end.begin());
667+
}

argparser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class ArgParser {
5151
void addToBootClassPath(const char *path, bool onlyIfExists = false);
5252
void addJarsToClassPathFrom(const char *dir);
5353
void addOptionsToCommandLine(std::list<std::string> & commandLine);
54+
bool endsWith(const std::string &string, const std::string &end);
5455

5556
protected:
5657
bool separateProcess;

0 commit comments

Comments
 (0)