Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,18 @@ public function installCommands($path, $namspace = 'app\command')
$this->add(new $class_name);
}
}

public function installUserCommands()
{
//get command from config
$commands = config('command', []);

foreach ($commands as $command) {
// check command class whether instanceof SymfonyCommand
if (!is_a($command, Commands::class, true)) {
continue;
}
$this->add(new $command);
}
}
}
3 changes: 3 additions & 0 deletions src/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public static function install()
{
copy(__DIR__ . "/webman", base_path()."/webman");
chmod(base_path()."/webman", 0755);

copy(__DIR__ . '/command.php', config_path() . '/command.php');
chmod(config_path() . '/command.php', 0644);

static::installByRelation();
}
Expand Down
5 changes: 5 additions & 0 deletions src/command.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [

];
1 change: 1 addition & 0 deletions src/webman
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ $cli->installInternalCommands();
if (is_dir($command_path = Util::guessPath(app_path(), '/command', true))) {
$cli->installCommands($command_path);
}
$cli->installUserCommands();

foreach (config('plugin', []) as $firm => $projects) {
if (isset($projects['app'])) {
Expand Down