pvRequest parsing
This commit is contained in:
+7
-1
@@ -25,6 +25,7 @@ void usage(const char* argv0)
|
||||
std::cerr<<"Usage: "<<argv0<<" <opts> [pvname ...]\n"
|
||||
"\n"
|
||||
" -h Show this message.\n"
|
||||
" -r <req> pvRequest condition.\n"
|
||||
" -v Make more noise.\n"
|
||||
" -d Shorthand for $PVXS_LOG=\"pvxs.*=DEBUG\". Make a lot of noise.\n"
|
||||
" -w <sec> Operation timeout in seconds. default 5 sec.\n"
|
||||
@@ -38,10 +39,11 @@ int main(int argc, char *argv[])
|
||||
logger_config_env(); // from $PVXS_LOG
|
||||
double timeout = 5.0;
|
||||
bool verbose = false;
|
||||
std::string request("field()");
|
||||
|
||||
{
|
||||
int opt;
|
||||
while ((opt = getopt(argc, argv, "hvdw:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "hvdw:r:")) != -1) {
|
||||
switch(opt) {
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
@@ -58,6 +60,9 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
request = optarg;
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
std::cerr<<"\nUnknown argument: "<<char(opt)<<std::endl;
|
||||
@@ -79,6 +84,7 @@ int main(int argc, char *argv[])
|
||||
for(auto n : range(optind, argc)) {
|
||||
|
||||
ops.push_back(ctxt.get(argv[n])
|
||||
.pvRequest(request)
|
||||
.result([&argv, n, &remaining, &done](client::Result&& result) {
|
||||
std::cout<<argv[n]<<"\n"<<result();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user