parsav  Diff

Differences From Artifact [f2643e6a8b]:

To Artifact [36fb1b8ec6]:


   337    337   			srv:setup(cnf) 
   338    338   		elseif lib.str.cmp(mode.arglist(0),'conf') == 0 then
   339    339   			srv:setup(cnf) 
   340    340   			srv:conprep(lib.store.prepmode.conf)
   341    341   			var cfmode: lib.cmdparse {
   342    342   				help = {'h','display this list'};
   343    343   				no_notify = {'n', "don't instruct the server to refresh its configuration cache after making changes; useful for \"transactional\" configuration changes."};
          344  +				raw = {'r', 'print output suitable for use in scripting rather than human consumption'};
   344    345   			}
   345    346   			cfmode:parse(mode.arglist.ct, &mode.arglist(0))
   346    347   			if cfmode.help then
   347    348   				[ lib.emit(false, 1, 'usage: ', `argv[0], ' conf ', cfmode.type.helptxt.flags, ' <cmd> [<args>…]', cfmode.type.helptxt.opts, cmdhelp {
   348    349   					{ 'conf set <setting> <value>', 'add or a change a server configuration parameter to the database' };
   349    350   					{ 'conf get <setting>', 'report the value of a server setting' };
   350    351   					{ 'conf reset <setting>', 'reset a server setting to its default value' };
................................................................................
   365    366   				else goto cmderr end
   366    367   			elseif cfmode.arglist.ct == 2 and
   367    368   				lib.str.cmp(cfmode.arglist(0),'reset') == 0 or
   368    369   				lib.str.cmp(cfmode.arglist(0),'clear') == 0 or
   369    370   				lib.str.cmp(cfmode.arglist(0),'unset') == 0 then
   370    371   				dlg:conf_reset(cfmode.arglist(1))
   371    372   				lib.report('parameter cleared')
          373  +			elseif cfmode.arglist.ct == 2 and
          374  +				lib.str.cmp(cfmode.arglist(0),'get') == 0 then
          375  +				var val = dlg:conf(cfmode.arglist(1))
          376  +				if val:ref() then
          377  +					lib.report('parameter read')
          378  +					[ lib.emit(true, 1, `cfmode.arglist(1), ' = "', `{val.ptr,val.ct}, '"') ]
          379  +				else
          380  +					lib.warn('no such parameter present in configuration store')
          381  +				end
   372    382   			elseif cfmode.arglist.ct == 3 and
   373    383   				lib.str.cmp(cfmode.arglist(0),'set') == 0 then
   374    384   				dlg:conf_set(cfmode.arglist(1),cfmode.arglist(2))
   375    385   				lib.report('parameter set')
   376    386   			else goto cmderr end
   377    387   
   378    388   			-- successful commands fall through