GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ArtARTs36/ShellCommand: shell command wrapper

BranchesTags
Open more actions menu

Latest commit

 

History

86 Commits
86 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
src
src
 
 
tests/Unit
tests/Unit
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.mr-linter.yml
.mr-linter.yml
 
 
.php-cs-fixer.php
.php-cs-fixer.php
 
 
README.MD
README.MD
 
 
composer.json
composer.json
 
 
phpunit.xml
phpunit.xml
 
 

Repository files navigation

ShellCommand - wrapper for calls console commands

PHP Composer License: MIT Total Downloads


Installation:

Run: composer require artarts36/shell-command


Examples:

1. Arguments && Options

use ArtARTs36\ShellCommand\ShellCommand;

$command = ShellCommand::make('git')->addArgument('push')->addOption('force');

var_dump($command->__toString()); // git 'push' --force 2>&1

2. Execute Commands

use ArtARTs36\ShellCommand\ShellCommand;

$command = ShellCommand::make('git')->addArgument('pull');
$result = $command->execute();

var_dump($result->getCommandLine());
var_dump($result->getCode());
var_dump($result->getDate());
var_dump($result->getResult());
var_dump($result->getError());

3. SSH

To use ssh, you need to connect the library "artarts36/shell-command-ssh-executor":

Run command artarts36/shell-command-ssh-executor

$connection = \ArtARTs36\ShellCommandSshExecutor\SSH\Connection::withPassword(
    'remote.host',
    'user',
    'password'
);

$command = \ArtARTs36\ShellCommand\ShellCommand::make('ls');

$command->setExecutor(new \ArtARTs36\ShellCommandSshExecutor\SshCommandExecutor($connection));

var_dump($command->getShellResult());

4. Mocking

$executor = new \ArtARTs36\ShellCommand\Executors\TestExecutor();

$command = new \ArtARTs36\ShellCommand\ShellCommand('reboot');

$executor->addSuccess('OK');

$command->execute($executor);

About

shell command wrapper

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.