git.cweiske.de
/
shpub.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Word-Case headers; too many applications break without it
[shpub.git]
/
src
/
shpub
/
Cli.php
diff --git
a/src/shpub/Cli.php
b/src/shpub/Cli.php
index 5b46fcdd1f80748c7ee7dd67c025068390d8112b..f807d329712a0ee00ea27dd94360a1835c7daf30 100644
(file)
--- a/
src/shpub/Cli.php
+++ b/
src/shpub/Cli.php
@@
-35,13
+35,13
@@
class Cli
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;
case 'reply':
$this->requireValidHost();
$cmd->run($res->command->args['url']);
break;
case 'reply':
$this->requireValidHost();
- $cmd = new Command_Reply($this->cfg
->host
);
+ $cmd = new Command_Reply($this->cfg);
$cmd->run(
$res->command->args['url'],
implode(' ', $res->command->args['text'])
$cmd->run(
$res->command->args['url'],
implode(' ', $res->command->args['text'])
@@
-79,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) {
@@
-99,7
+105,7
@@
class Cli
{
$optParser = new \Console_CommandLine();
$optParser->description = 'shpub';
{
$optParser = new \Console_CommandLine();
$optParser->description = 'shpub';
- $optParser->version = '0.0.
0
';
+ $optParser->version = '0.0.
2
';
$optParser->subcommand_required = true;
$optParser->addOption(
$optParser->subcommand_required = true;
$optParser->addOption(
@@
-124,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(
@@
-146,7
+162,7
@@
class Cli
$cmd->addArgument(
'user',
[
$cmd->addArgument(
'user',
[
- 'optional' =>
fals
e,
+ 'optional' =>
tru
e,
'description' => 'User URL',
]
);
'description' => 'User URL',
]
);