Skip to content

Commit

Permalink
Added pre-defined exit codes
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Nov 25, 2021
1 parent fd3533b commit d3d7d9e
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Expand Up @@ -12,15 +12,16 @@ composer require jbzoo/cli
```


### Usage

```php
use JBZoo\SkeletonPhp\Cli;

// Just use it!
$object = new Cli();
$object->doSomeStreetMagic(':)');
```
### See also

* https://github.com/kevinlebrun/colors.php
* https://packagist.org/packages/php-school/cli-menu
* https://github.com/nunomaduro/collision
* https://packagist.org/packages/splitbrain/php-cli
* https://github.com/php-school/terminal
* https://github.com/hoaproject/Console
* https://github.com/thephpleague/climate
* https://tldp.org/LDP/abs/html/exitcodes.html


## Unit tests and check code style
Expand Down
69 changes: 69 additions & 0 deletions src/Codes.php
@@ -0,0 +1,69 @@
<?php

/**
* JBZoo Toolbox - Cli
*
* This file is part of the JBZoo Toolbox project.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Cli
* @license MIT
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @link https://github.com/JBZoo/Cli
*/

declare(strict_types=1);

namespace JBZoo\Cli;

/**
* Class Codes
* @package JBZoo\Cli
*/
class Codes
{
// General codes
public const OK = 0;
public const GENERAL_ERROR = 1;
public const MISUSE_OF_SHELL_BUILTINS = 2;

// Error types
public const INVOKED_COMMAND_CANNOT_EXECUTE = 126;
public const COMMAND_NOT_FOUND = 127;
public const INVALID_EXIT_ARGUMENT = 128;

// Signals
public const HANGUP = 129;
public const INTERRUPT = 130;
public const QUIT_AND_DUMP_CORE = 131;
public const ILLEGAL_INSTRUCTION = 132;
public const TRACE_TRAP = 133;
public const BREAKPOINT_TRAP = 133;
public const PROCESS_ABORTED = 134;
public const ACCESS_TO_UNDEFINED_PORTION_OF_MEMORY_OBJECT = 135;
public const FLOATING_POINT_EXCEPTION = 136;
public const ERRONEOUS_ARITHMETIC_OPERATION = 136;
public const KILLED = 137;
public const TERMINATE_IMMEDIATELY = 137;
public const SEGMENTATION_VIOLATION = 139;
public const WRITE_TO_PIPE_WITH_NO_ONE_READING = 141;
public const SIGNAL_RAISED_BY_ALARM = 142;
public const TERMINATION = 143;
public const CHILD_PROCESS_TERMINATED = 145;
public const CONTINUE_IF_STOPPED = 146;
public const STOP_EXECUTING_TEMPORARILY = 147;
public const TERMINAL_STOP_SIGNAL = 148;
public const BACKGROUND_PROCESS_ATTEMPTING_TO_READ_FROM_TTY = 149;
public const BACKGROUND_PROCESS_ATTEMPTING_TO_WRITE_TO_TTY = 150;
public const URGENT_DATA_AVAILABLE_ON_SOCKET = 151;
public const CPU_TIME_LIMIT_EXCEEDED = 152;
public const FILE_SIZE_LIMIT_EXCEEDED = 153;
public const SIGNAL_RAISED_BY_TIMER_COUNTING_VIRTUAL_TIME = 154;
public const VIRTUAL_TIMER_EXPIRED = 154;
public const PROFILING_TIMER_EXPIRED = 155;
public const POLLABLE_EVENT = 157;
public const BAD_SYSCALL = 159;

// See also: ./symfony/process/Process.php
}

0 comments on commit d3d7d9e

Please sign in to comment.