summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/minicargo/main.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/minicargo/main.cpp b/tools/minicargo/main.cpp
index 9ddff1f3..7065b7f5 100644
--- a/tools/minicargo/main.cpp
+++ b/tools/minicargo/main.cpp
@@ -47,6 +47,8 @@ struct ProgramOptions
/// Build and run tests?
bool test = false;
+ ::std::vector<::std::string> features;
+
int parse(int argc, const char* argv[]);
void usage() const;
void help() const;
@@ -100,6 +102,7 @@ int main(int argc, const char* argv[])
Debug_SetPhase("Load Root");
auto dir = ::helpers::path(opts.directory ? opts.directory : ".");
auto m = PackageManifest::load_from_toml( dir / "Cargo.toml" );
+ m.set_features(opts.features, opts.features.empty());
// 2. Load all dependencies
Debug_SetPhase("Load Dependencies");
@@ -259,6 +262,19 @@ int ProgramOptions::parse(int argc, const char* argv[])
}
this->target = argv[++i];
}
+ else if( ::std::strcmp(arg, "--features") == 0 ) {
+ if(i+1 == argc) {
+ ::std::cerr << "Flag " << arg << " takes an argument" << ::std::endl;
+ return 1;
+ }
+ const auto* a = argv[++i];
+ while(const char* e = strchr(a, ','))
+ {
+ this->features.push_back( ::std::string(a, e) );
+ a = e + 1;
+ }
+ this->features.push_back( ::std::string(a) );
+ }
else if( ::std::strcmp(arg, "--pause") == 0 ) {
this->pause_before_quit = true;
}