void SC_TerminalClient::interpretCmdLine(PyrSymbol* method, SC_StringBuffer& cmdLine) { setCmdLine(cmdLine); cmdLine.reset(); runLibrary(method); flush(); }
void SC_LanguageClient::setCmdLinef(const char* fmt, ...) { va_list ap; va_start(ap, fmt); mScratch.reset(); mScratch.vappendf(fmt, ap); va_end(ap); setCmdLine(mScratch); }
void SC_LanguageClient::setCmdLinef(const char* fmt, ...) { SC_StringBuffer & scratch = mHiddenClient->mScratch; va_list ap; va_start(ap, fmt); scratch.reset(); scratch.vappendf(fmt, ap); va_end(ap); setCmdLine(scratch.getData()); }
void SC_TerminalClient::interpretCmdLine(const char *cmdLine, size_t size, bool silent) { setCmdLine(cmdLine, size); runLibrary(resolveMethodSymbol(silent)); flush(); }
KGpgDelKey::KGpgDelKey(QObject *parent, const KGpgKeyNode::List &keys) : KGpgTransaction(parent), m_keys(keys) { setCmdLine(); }
KGpgDelKey::KGpgDelKey(QObject *parent, KGpgKeyNode *key) : KGpgTransaction(parent) { m_keys << key; setCmdLine(); }
void SC_LanguageClient::setCmdLine(const char* str) { setCmdLine(str, strlen(str)); }
void Invocation::parse(bool completion) { processOptions(completion); const bool takeComposition = !cmdLine.empty(); if (takeComposition) { composition = cmdLine[0]; cmdName = composition; cmdLine.erase(cmdLine.begin()); if (composition.empty()) { // "." and "" are treated equivalently, but the former one can also // be distinguished from missing composition. composition = "."; } } std::vector<std::string> names; // Treat "." as an alias for "". if (takeComposition && (composition.empty() || composition == ".")) { names.assign({ std::string() }); } else { names = split(composition, '.'); if (std::count_if(names.cbegin(), names.cend(), std::mem_fn(&std::string::empty)) > 1U) { names.assign({ composition }); } } auto processAlias = [this, completion](const std::string &name) { const std::string rhsString = aliasResolver(name); if (rhsString.empty()) { cmdLine.insert(cmdLine.begin(), name); return; } const std::vector<std::string> &rhs = breakIntoArgs(rhsString); setCmdLine(applyAlias(rhs, cmdLine, completion)); }; // Break composition by a '.' and apply aliases from right to left, commands // that are not aliases are just prepended to current command-line. namespace adaptors = boost::adaptors; for (const std::string &name : adaptors::reverse(names)) { if (!name.empty()) { processAlias(name); continue; } if (defCmdLine.empty()) { continue; } std::vector<std::string> args = breakIntoArgs(defCmdLine); cmdLine.insert(cmdLine.cbegin(), args.cbegin(), args.cend()); setCmdLine(cmdLine); if (!cmdLine.empty()) { std::vector<std::string> names = split(cmdLine.front(), '.'); cmdLine.erase(cmdLine.begin()); for (const std::string &name : adaptors::reverse(names)) { processAlias(name); } } } if (cmdLine.empty()) { cmdName.clear(); } else { cmdName = cmdLine[0]; cmdLine.erase(cmdLine.begin()); } }
void SC_TerminalClient::interpretCmdLine(PyrSymbol* method, const char *cmdLine, size_t size) { setCmdLine(cmdLine, size); runLibrary(method); flush(); }
void SC_LanguageClient::setCmdLine(const SC_StringBuffer& strBuf) { setCmdLine(strBuf.getData(), strBuf.getSize()); }