Skip to content

Commit

Permalink
Allow common args
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoffland committed May 12, 2015
1 parent 0069b60 commit e02ceed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/duerer/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ App::App() :
options.pushCategory("Duerer Server");
options.addTarget("cache", cacheDir,
"Cache and serve files from this directory.");
options.add("common", "Common conversion command args")->setDefault("");
options.add("alarge-cmd", "Large avatar conversion command");
options.add("asmall-cmd", "Small avatar conversion command");
options.add("large-cmd", "Large image conversion command");
Expand All @@ -76,6 +77,11 @@ App::App() :
}


const string &App::getCommon() const {
return options["common"];
}


bool App::hasCmd(const string &size) const {
return options.has(size + "-cmd") && options[size + "-cmd"].hasValue();
}
Expand Down
1 change: 1 addition & 0 deletions src/duerer/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ namespace duerer {
const std::string &getCacheDir() const {return cacheDir;}
const std::string &getAWSBucket() const {return awsBucket;}

const std::string &getCommon() const;
bool hasCmd(const std::string &size) const;
const std::string &getCmd(const std::string &size) const;

Expand Down
1 change: 1 addition & 0 deletions src/duerer/Transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ void Transaction::convertImage() {
string cmd = app.getCmd(size);
cmd = String::replace(cmd, "\\$src", "orig");
cmd = String::replace(cmd, "\\$dst", size);
cmd = String::replace(cmd, "\\$common", app.getCommon());

Subprocess proc;
proc.setWorkingDirectory(path);
Expand Down

0 comments on commit e02ceed

Please sign in to comment.