-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from alleyinteractive/mantle-bin
Feature: bin/mantle
- Loading branch information
Showing
14 changed files
with
138 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
define( 'MANTLE_ISOLATION_MODE', true ); | ||
defined( 'MANTLE_BASE_DIR' ) || define( 'MANTLE_BASE_DIR', dirname( __DIR__ ) ); | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Load Composer | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Check if Composer has been installed and attempt to load it. You can remove | ||
| this block of code if Composer is being loaded outside of the plugin. | ||
| | ||
*/ | ||
|
||
if ( file_exists( __DIR__ . '/../vendor/autoload.php' ) ) { | ||
require __DIR__ . '/../vendor/autoload.php'; | ||
} elseif ( ! class_exists( Mantle\Contracts\Console\Kernel::class ) ) { | ||
echo 'You need to run `composer install` to use bin/mantle. If your `vendor/autoload.php` file is in a different location, you must modify `bin/mantle` to load it.' . PHP_EOL; | ||
exit( 1 ); | ||
} | ||
|
||
$app = require_once __DIR__ . '/../bootstrap/app.php'; | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Run the Console Mantle Application | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Load the Mantle application and run the console application. With isolation | ||
| mode enabled, we shouldn't have a dependency on WordPress. | ||
| | ||
*/ | ||
|
||
$kernel = $app->make( Mantle\Contracts\Console\Kernel::class ); | ||
|
||
$status = $kernel->handle( | ||
$input = new Symfony\Component\Console\Input\ArgvInput, | ||
new Symfony\Component\Console\Output\ConsoleOutput(), | ||
); | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Shutdown The Application | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Once the application has finished running, we will fire off the shutdown | ||
| events so that any final work may be done by the application before it | ||
| is shut down gracefully. | ||
| | ||
*/ | ||
|
||
$kernel->terminate( $input, $status ); | ||
|
||
exit( $status ); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* Console Commands | ||
* | ||
* @package Mantle | ||
*/ | ||
|
||
use Mantle\Facade\Console; | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Console Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here is where you can register all of your Closure based console commands. | ||
| Each Closure is bound to a command instance allowing a simple approach | ||
| to interacting with each command's IO methods. Even though this | ||
| file is included in your application configuration, feel free to | ||
| remove it if you are not using console commands. | ||
| | ||
*/ | ||
|
||
Console::command( 'hello {name}', function ( $name ) { | ||
$this->info( "Hello, {$name}!" ); | ||
} )->describe( 'Greet a user by name' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters