add force flag for cp helper
This commit is contained in:
parent
caa2800a7a
commit
aec383b974
@ -243,6 +243,9 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
||||
return result;
|
||||
}
|
||||
std::ostringstream oss("cp ", std::ostringstream::ate);
|
||||
if (parser.isForceOptSet()) {
|
||||
oss << "-f ";
|
||||
}
|
||||
if (parser.isRecursiveOptSet()) {
|
||||
oss << "-r ";
|
||||
}
|
||||
|
@ -242,19 +242,22 @@ class CpHelperParser {
|
||||
CpHelperParser(const uint8_t* data, size_t maxLen) : data(data), maxLen(maxLen) {}
|
||||
|
||||
ReturnValue_t parse() {
|
||||
if (maxLen < 1) {
|
||||
if (maxLen < 2) {
|
||||
return SerializeIF::STREAM_TOO_SHORT;
|
||||
}
|
||||
recursiveOpt = data[0];
|
||||
forceOpt = data[1];
|
||||
return parseDestTargetString(data + 1, maxLen - 1, destTgt);
|
||||
}
|
||||
const SourceTargetPair& destTgtPair() const { return destTgt; }
|
||||
bool isRecursiveOptSet() const { return recursiveOpt; }
|
||||
bool isForceOptSet() const { return forceOpt; }
|
||||
|
||||
private:
|
||||
const uint8_t* data;
|
||||
size_t maxLen;
|
||||
bool recursiveOpt = false;
|
||||
bool forceOpt = false;
|
||||
SourceTargetPair destTgt;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user