git.cweiske.de
/
shpub.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use default host if none given
[shpub.git]
/
src
/
shpub
/
Cli.php
diff --git
a/src/shpub/Cli.php
b/src/shpub/Cli.php
index fb22d3fb5db9c7b9bc4427c035f3c44add22a1ee..44cf8c86744ecaf7b149a1b3039cd3026ed4b69e 100644
(file)
--- a/
src/shpub/Cli.php
+++ b/
src/shpub/Cli.php
@@
-27,11
+27,27
@@
class Cli
$res->command->options['force']
);
break;
$res->command->options['force']
);
break;
+
+ case 'server':
+ $cmd = new Command_Server($this->cfg);
+ $cmd->run($res->command->options['verbose']);
+ break;
+
case 'like':
$this->requireValidHost();
case 'like':
$this->requireValidHost();
- $cmd = new Command_Like($this->cfg
->host
);
+ $cmd = new Command_Like($this->cfg);
$cmd->run($res->command->args['url']);
break;
$cmd->run($res->command->args['url']);
break;
+
+ case 'reply':
+ $this->requireValidHost();
+ $cmd = new Command_Reply($this->cfg);
+ $cmd->run(
+ $res->command->args['url'],
+ implode(' ', $res->command->args['text'])
+ );
+ break;
+
default:
var_dump($this->cfg->host, $res);
Log::err('FIXME');
default:
var_dump($this->cfg->host, $res);
Log::err('FIXME');
@@
-63,10
+79,16
@@
class Cli
} else {
$this->cfg->host = $this->cfg->hosts[$key];
}
} else {
$this->cfg->host = $this->cfg->hosts[$key];
}
+ } else {
+ $key = $this->cfg->getDefaultHost();
+ if ($key !== null) {
+ $this->cfg->host = $this->cfg->hosts[$key];
+ }
}
if ($opts['user'] !== null) {
$this->cfg->host->user = $opts['user'];
}
}
if ($opts['user'] !== null) {
$this->cfg->host->user = $opts['user'];
}
+ $this->cfg->setDebug($opts['debug']);
return $res;
} catch (\Exception $exc) {
return $res;
} catch (\Exception $exc) {
@@
-108,6
+130,16
@@
class Cli
'default' => null,
)
);
'default' => null,
)
);
+ $optParser->addOption(
+ 'debug',
+ array(
+ 'short_name' => '-d',
+ 'long_name' => '--debug',
+ 'description' => 'Verbose output',
+ 'action' => 'StoreTrue',
+ 'default' => false,
+ )
+ );
$cmd = $optParser->addCommand('connect');
$cmd->addOption(
$cmd = $optParser->addCommand('connect');
$cmd->addOption(
@@
-130,7
+162,7
@@
class Cli
$cmd->addArgument(
'user',
[
$cmd->addArgument(
'user',
[
- 'optional' =>
fals
e,
+ 'optional' =>
tru
e,
'description' => 'User URL',
]
);
'description' => 'User URL',
]
);
@@
-142,6
+174,18
@@
class Cli
]
);
]
);
+ $cmd = $optParser->addCommand('server');
+ $cmd->addOption(
+ 'verbose',
+ array(
+ 'short_name' => '-v',
+ 'long_name' => '--verbose',
+ 'description' => 'Show more server infos',
+ 'action' => 'StoreTrue',
+ 'default' => false,
+ )
+ );
+
//$cmd = $optParser->addCommand('post');
$cmd = $optParser->addCommand('reply');
$cmd->addArgument(
//$cmd = $optParser->addCommand('post');
$cmd = $optParser->addCommand('reply');
$cmd->addArgument(
@@
-155,6
+199,7
@@
class Cli
'text',
[
'optional' => false,
'text',
[
'optional' => false,
+ 'multiple' => true,
'description' => 'Reply text',
]
);
'description' => 'Reply text',
]
);
@@
-181,6
+226,8
@@
class Cli
'Server data incomplete. "shpub connect" first.'
);
}
'Server data incomplete. "shpub connect" first.'
);
}
+
+ $this->cfg->host->loadEndpoints();
}
}
?>
}
}
?>