protected function configure() { $this->setName('api')->setDescription('Call an API')->addOption('in', NULL, InputOption::VALUE_REQUIRED, 'Input format (args,json)', 'args')->addOption('out', NULL, InputOption::VALUE_REQUIRED, 'Output format (' . implode(',', Encoder::getFormats()) . ')', Encoder::getDefaultFormat())->addArgument('Entity.action', InputArgument::REQUIRED)->addArgument('key=value', InputArgument::IS_ARRAY)->setHelp('Call an API Examples: cv api system.get cv api contact.get id=10 echo \'{"id":10, "api.Email.get": 1}\' | cv api contact.get --in=json NOTE: To change the default output format, set CV_OUTPUT. '); parent::configureBootOptions(); }
protected function configure() { $this->setName('php:eval')->setAliases(array('ev'))->setDescription('Evaluate a snippet of PHP code')->addArgument('code')->addOption('out', NULL, InputArgument::OPTIONAL, 'Specify return format (auto,' . implode(',', Encoder::getFormats()) . ')', 'auto')->setHelp(' Evaluate a snippet of PHP code Examples: cv ev \'civicrm_api3("System", "flush", array());\' cv ev \'if (rand(0,10)<5) echo "heads\\n"; else echo "tails\\n";\' When reading data, you may use "return": cv ev \'return CRM_Utils_System::version()\' cv ev \'return CRM_Utils_System::version()\' --out=shell cv ev \'return CRM_Utils_System::version()\' --out=json If the output format is set to "auto". This will be produce silent output -- unless you use a "return" statement. In that case, it will use the default (' . \Civi\Cv\Encoder::getDefaultFormat() . '). NOTE: To change the default output format, set CV_OUTPUT. '); parent::configureBootOptions(); }
protected function configure() { $this->setName('vars:show')->setDescription('Show the configuration of the local CiviCRM installation')->addOption('out', NULL, InputOption::VALUE_REQUIRED, 'Output format (' . implode(',', Encoder::getFormats()) . ')', Encoder::getDefaultFormat()); parent::configureBootOptions(); }