• Poul-Henning Kamp's avatar
    Add support for JSON CLI responses. · e0b9077c
    Poul-Henning Kamp authored
    To get JSON back, the first argument must be "-j".
    
    Currently only "help -j" is implemented, but that
    will helpfully tell you which commands support
    json output.
    
    All JSON output has the form:
    
    	[ version#, [<cli_command>],
    		stuff
    	]
    
    For instance:
    
    	[ 1, ["help", "-j"],
    	  {
    	  "request": "help",
    	  "syntax": "help [<command>]",
    	  "help": "\tShow command/protocol help.",
    	  "minarg": 0, "maxarg": 1, "flags": "", "json": true
    	  },
    	  {
    	  "request": "ping",
    	  "syntax": "ping [<timestamp>]",
    	  "help": "\tKeep connection alive.",
    	  "minarg": 0, "maxarg": 1, "flags": "", "json": false
    	  },
    	  ...
    	]
    
    The string quoting for weird characters in JSON is XXX incomplete.
    
    Prodded for by:	Kristian
    e0b9077c
b00008.vtc 585 Bytes