Skip to content

Commit 600a7f8

Browse files
committed
update, add some feature
1 parent 3b1881d commit 600a7f8

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/App.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class App extends AbstractApp
1717
/**
1818
* @var string
1919
*/
20-
private $delimiter = '/';
20+
public $delimiter = ':'; // '/' ':'
2121

2222
/**
2323
* addCommand
@@ -145,6 +145,7 @@ public function runAction($name, $action, $believable = false)
145145
}
146146

147147
$object::setName($name);
148+
$object->delimiter = $this->delimiter;
148149

149150
return $object->setAction($action)->run();
150151
}

src/Controller.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ abstract class Controller extends AbstractCommand
3939
*/
4040
protected $notFoundCallback = 'notFound';
4141

42+
/**
43+
* @var string
44+
*/
45+
public $delimiter = '/'; // '/' ':'
46+
47+
protected $showMore = true;
48+
4249
/**
4350
* load command configure
4451
*/
@@ -62,7 +69,7 @@ protected function configure()
6269
protected function execute($input, $output)
6370
{
6471
$action = $this->action ?: $this->defaultAction;
65-
$action = Helper::transName(trim($action, '/'));
72+
$action = Helper::transName(trim($action, $this->delimiter));
6673

6774
$method = $this->actionSuffix ? $action . ucfirst($this->actionSuffix) : $action;
6875

@@ -165,14 +172,16 @@ final protected function showCommandList()
165172
}
166173
}
167174

175+
$sep = $this->delimiter;
176+
$name = $sName . $sep;
168177
$this->output->mList([
169178
'Description:' => $classDes,
170-
'Usage:' => "$sName/[command] [arguments] [options]",
179+
'Usage:' => "{$name}[command] [arguments] [options]",
171180
'Group Name:' => "<info>$sName</info>",
172181
'Commands:' => $commands,
173182
'Options:' => [
174183
'--help,-h' => 'Show help of the command group or specified command action',
175-
"\nMore information please use: <cyan>$sName/[command] -h</cyan> OR <cyan>$sName/help [command]</cyan>"
184+
$this->showMore ? "\nMore information please use <cyan>{$name}[command] -h</cyan> OR <cyan>{$name}help [command]</cyan>" : ''
176185
],
177186
]);
178187
}

0 commit comments

Comments
 (0)