Merge pull request 'Add force flag for cp helper' (#667) from extend-cp-helper into v4.0.0-dev
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
Reviewed-on: #667
This commit is contained in:
commit
3a59cd301b
@ -246,6 +246,9 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::ostringstream oss("cp ", std::ostringstream::ate);
|
std::ostringstream oss("cp ", std::ostringstream::ate);
|
||||||
|
if (parser.isForceOptSet()) {
|
||||||
|
oss << "-f ";
|
||||||
|
}
|
||||||
if (parser.isRecursiveOptSet()) {
|
if (parser.isRecursiveOptSet()) {
|
||||||
oss << "-r ";
|
oss << "-r ";
|
||||||
}
|
}
|
||||||
|
@ -249,19 +249,22 @@ class CpHelperParser {
|
|||||||
CpHelperParser(const uint8_t* data, size_t maxLen) : data(data), maxLen(maxLen) {}
|
CpHelperParser(const uint8_t* data, size_t maxLen) : data(data), maxLen(maxLen) {}
|
||||||
|
|
||||||
ReturnValue_t parse() {
|
ReturnValue_t parse() {
|
||||||
if (maxLen < 1) {
|
if (maxLen < 2) {
|
||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
}
|
}
|
||||||
recursiveOpt = data[0];
|
recursiveOpt = data[0];
|
||||||
return parseDestTargetString(data + 1, maxLen - 1, destTgt);
|
forceOpt = data[1];
|
||||||
|
return parseDestTargetString(data + 2, maxLen - 2, destTgt);
|
||||||
}
|
}
|
||||||
const SourceTargetPair& destTgtPair() const { return destTgt; }
|
const SourceTargetPair& destTgtPair() const { return destTgt; }
|
||||||
bool isRecursiveOptSet() const { return recursiveOpt; }
|
bool isRecursiveOptSet() const { return recursiveOpt; }
|
||||||
|
bool isForceOptSet() const { return forceOpt; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const uint8_t* data;
|
const uint8_t* data;
|
||||||
size_t maxLen;
|
size_t maxLen;
|
||||||
bool recursiveOpt = false;
|
bool recursiveOpt = false;
|
||||||
|
bool forceOpt = false;
|
||||||
SourceTargetPair destTgt;
|
SourceTargetPair destTgt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user