terminal

An Elegent wrapper around Symfony's Process component.

Downloads
277.8K
Stars
506
Committers
13

Bot releases are visible (Hide)

terminal - symfony/process ^6.0 support Latest Release

Published by TitasGailius over 2 years ago

terminal - PHP 8.1 Support

Published by TitasGailius almost 3 years ago

terminal - PHP 8 Support

Published by TitasGailius over 3 years ago

PHP 8 Support

To use Terminal with PHP 8.x, please upgrade Terminal to the ^1.0 version.

  1. Update your composer.json to use the latest version of the terminal: "titasgailius/terminal": "^1.0".
  2. Note that the Builder::retry is now a protected method. It's very unlikely that you were was using this method..
terminal - Add "assertNotExecuted"

Published by TitasGailius almost 4 years ago

Alternatively you can also check that a given command was not executed. You may accomplish this by calling the Terminal::assertNotExecuted method after calling Terminal::fake.

Terminal::fake();

Terminal::assertNotExecuted('php artisan migrate');
terminal - Enable/Disable TTY & set max time since last output (idleTimeout)

Published by TitasGailius over 4 years ago

TTY

You may enable or disable TTY mode:

Terminal::enableTty()->run(...);

Terminal::disableTty()->run(...);

Idle Timeout

You may specify max allowed time since last output:

// Seconds.
Terminal::idleTimeout(20)->run(...);

// Carbon.
Terminal::idleTimeout(Carbon::now()->addSeconds(20))->run(...);

// DateInterval.
Terminal::idleTimeout(new DateInterval('PT20S'))->run(...);
terminal - Expose `runProcess` method publically

Published by TitasGailius over 4 years ago

terminal - Send output to Laravel's Artisan command or Symfony's Console command

Published by TitasGailius over 4 years ago

Output via Laravel Artisan Command

If you run Terminal from the Laravel's Artisan command, you may send the output to the console by
passing an instance of the Command to the output method:

public function handle()
{
    Terminal::output($this)->run('echo Hello, World');
}

Output via Symfony Console Command

If you run Terminal from the Symfony's Console command, you may send the output to the console by
passing an instance of the OutputInterface to the output method:

protected function execute(InputInterface $input, OutputInterface $output)
{
    Terminal::output($output)->run('echo Hello, World');
}
terminal - Bump symfony/process to "^4.4.2" to support Terminal::data feature

Published by TitasGailius over 4 years ago

terminal - Add support for Symfony/Process v4

Published by TitasGailius over 4 years ago

terminal - Implemented "toString".

Published by TitasGailius over 4 years ago

  • Reset captured commands after each test.
  • Introduce a test that checks if a command passed as an array is executed correctly.
  • Implemented the "toString" method that returns the current (or a given) command as a string.
terminal - Fixes a bug with "retries" option.

Published by TitasGailius over 4 years ago

Fixes a bug with "retries" option.

terminal - Fix "Builder" proxy

Published by TitasGailius over 4 years ago

There was a typo when proxying missing methods of the Builder instance to the Process instance.

PR: https://github.com/TitasGailius/terminal/pull/6

terminal - Set Input

Published by TitasGailius over 4 years ago

This release makes it possible to set input for the Symfony Process:

Terminal::input($input)->run('rm -rf vendor');
terminal - Fixes a typo

Published by TitasGailius over 4 years ago

terminal - Pass data to the command line script

Published by TitasGailius over 4 years ago

Data

If you need to pass any data to your command line, it's better to bind it using the with method.
Terminal can escape and prepare the values for you. Reference these values using the {{ $key }} syntax.

Terminal::with([
    'firstname' => 'John',
    'lastname' => 'Doe',
])->run('echo Hello, {{ $firstname}} {{ $lastname }}');

Alternatively, you may pass the key-value pair in separate parameters.

Terminal::with('greeting', 'World')
        ->run('echo Hello, {{ $greeting }}');
terminal - Initial Release

Published by TitasGailius over 4 years ago

Initial release