pvxput handle JSON
disable CLI for 3.15
This commit is contained in:
1 parent
2b99e3c6ee
commit
8cb8d4bf69
3 files changed
+24
-6
No files matched your search
@@ -177,9 +177,10 @@ jobs:
|
||||
if: ${{ always() && runner.os == 'macOS' }}
|
||||
run: otool -D -L -l bundle/usr/*/lib/*.dylib lib/*/*.dylib bin/*/pvxinfo
|
||||
- name: readelf
|
||||
if: ${{ always() && runner.os == 'Linux' }}
|
||||
if: ${{ always() && runner.os == 'Linux' && matrix.base != '3.14' }}
|
||||
run: find bundle/usr lib -name '*.so' -print0 | xargs -0 readelf -d bin/linux-*/pvxinfo
|
||||
- name: Host info
|
||||
if: ${{ matrix.base != '3.14' }}
|
||||
run: python .ci/cue.py --add-path "{TOP}/bin/{EPICS_HOST_ARCH}" --add-path "{TOP}/bundle/usr/{EPICS_HOST_ARCH}/lib" exec pvxinfo -D
|
||||
- name: Test env setup
|
||||
run: echo "UBSAN_OPTIONS=log_path=$PWD/UBSAN:suppressions=$PWD/.ci-local/ubsan.supp:report_error_type=1:print_stacktrace=1" >> $GITHUB_ENV
|
||||
|
||||
@@ -5,6 +5,8 @@ include $(TOP)/configure/CONFIG
|
||||
# ADD MACRO DEFINITIONS AFTER THIS LINE
|
||||
#=============================
|
||||
|
||||
ifdef BASE_3_15
|
||||
|
||||
# access to private headers
|
||||
USR_CPPFLAGS += -I$(TOP)/src
|
||||
|
||||
@@ -34,6 +36,8 @@ pvxlist_SRCS += list.cpp
|
||||
PROD += pvxmshim
|
||||
pvxmshim_SRCS += mshim.cpp
|
||||
|
||||
endif # BASE_3_15
|
||||
|
||||
#===========================
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
|
||||
+18
-5
@@ -12,8 +12,11 @@
|
||||
#include <epicsGetopt.h>
|
||||
#include <epicsThread.h>
|
||||
|
||||
#define PVXS_ENABLE_EXPERT_API
|
||||
|
||||
#include <pvxs/client.h>
|
||||
#include <pvxs/log.h>
|
||||
#include <pvxs/json.h>
|
||||
#include "utilpvt.h"
|
||||
#include "evhelper.h"
|
||||
|
||||
@@ -85,9 +88,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
if(argc-optind==1 && std::string(argv[optind]).find_first_of('=')==std::string::npos) {
|
||||
// only one field assignment, and field name omitted.
|
||||
// implies .value
|
||||
// if JSON map, treat as entire struct. Others imply .value
|
||||
|
||||
values["value"] = argv[optind];
|
||||
auto sval(argv[optind]);
|
||||
values[sval[0]=='{' ? "" : "value"] = sval;
|
||||
|
||||
} else {
|
||||
for(auto n : range(optind, argc)) {
|
||||
@@ -120,9 +124,18 @@ int main(int argc, char *argv[])
|
||||
val.unmark(false, true);
|
||||
for(auto& pair : values) {
|
||||
try{
|
||||
val[pair.first] = pair.second;
|
||||
}catch(NoConvert& e){
|
||||
throw std::runtime_error(SB()<<"Unable to assign "<<pair.first<<" from \""<<escape(pair.second)<<"\"");
|
||||
auto fld(val);
|
||||
if(!pair.first.empty())
|
||||
fld = val.lookup(pair.first);
|
||||
auto& sv(pair.second);
|
||||
if(!sv.empty() && (sv[0]=='{' || sv[0]=='[' || sv[0]=='"'))
|
||||
json::Parse(pair.second).into(fld);
|
||||
else
|
||||
fld.from(sv);
|
||||
}catch(std::exception& e){
|
||||
throw std::runtime_error(SB()<<"Unable to assign "<<pair.first
|
||||
<<" from \""<<escape(pair.second)<<"\""
|
||||
<<" : "<<e.what());
|
||||
}
|
||||
}
|
||||
if(verbose) {
|
||||
|
||||
Reference in new issue
Block a user