6 public function __construct(Config $cfg)
11 public static function opts(\Console_CommandLine $optParser)
13 $cmd = $optParser->addCommand('upload');
14 $cmd->description = 'Directly upload files to the media endpoint';
20 'description' => 'File paths',
25 public function run(\Console_CommandLine_Result $cmdRes)
27 if ($this->cfg->host->endpoints->media == '') {
28 Log::err('Host as no media endpoint');
32 $req = new Request($this->cfg->host, $this->cfg);
34 foreach ($cmdRes->args['files'] as $filePath) {
35 if (!file_exists($filePath)) {
36 Log::err('File does not exist: ' . $filePath);
40 $url = $req->uploadToMediaEndpoint($filePath);
41 Log::info('Uploaded file ' . $filePath);