From e5961df9afde0459a4ccd85636fe28c2633b4018 Mon Sep 17 00:00:00 2001 From: Tong Zhang Date: Fri, 28 Feb 2025 10:12:34 -0500 Subject: [PATCH] REF: add json5 option to -M option for pva tools. - explicitly request format for JSON5 via "-M json5" - while "-M json" return the regular JSON --- pvtoolsSrc/pvget.cpp | 2 ++ pvtoolsSrc/pvutils.h | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pvtoolsSrc/pvget.cpp b/pvtoolsSrc/pvget.cpp index f5081908..7405f8ef 100644 --- a/pvtoolsSrc/pvget.cpp +++ b/pvtoolsSrc/pvget.cpp @@ -309,6 +309,8 @@ int MAIN (int argc, char *argv[]) outmode = pvd::PVStructure::Formatter::NT; } else if(strcmp(optarg, "json")==0) { outmode = pvd::PVStructure::Formatter::JSON; + } else if(strcmp(optarg, "json5")==0) { + outmode = pvd::PVStructure::Formatter::JSON5; } else { fprintf(stderr, "Unknown output mode '%s'\n", optarg); outmode = pvd::PVStructure::Formatter::Raw; diff --git a/pvtoolsSrc/pvutils.h b/pvtoolsSrc/pvutils.h index 3eea5949..b932850c 100644 --- a/pvtoolsSrc/pvutils.h +++ b/pvtoolsSrc/pvutils.h @@ -26,13 +26,13 @@ namespace pva = epics::pvAccess; "options:\n" \ " -h: Help: Print this message\n" \ " -V: Print version and exit\n" \ - " -r : Request, specifies what fields to return and options, default is '%s'\n" \ - " -w : Wait time, specifies timeout, default is %f second(s)\n" \ - " -p : Set default provider name, default is '%s'\n" \ - " -M : Output mode. default is 'nt'\n" \ - " -v: Show entire structure (implies Raw mode)\n" \ - " -q: Quiet mode, print only error messages\n" \ - " -d: Enable debug output\n" + " -r : Request, specifies what fields to return and options, default is '%s'\n" \ + " -w : Wait time, specifies timeout, default is %f second(s)\n" \ + " -p : Set default provider name, default is '%s'\n" \ + " -M : Output mode. default is 'nt'\n" \ + " -v: Show entire structure (implies Raw mode)\n" \ + " -q: Quiet mode, print only error messages\n" \ + " -d: Enable debug output\n" extern double timeout; extern bool debugFlag;