Skip to content

Releases: nette/command-line

Released version 1.9.1

23 Feb 03:20
@dg dg

Choose a tag to compare

A code quality release that tightens static analysis and cleans up internals.

  • Fixed all PHPStan errors and improved phpDoc annotations
  • Switched to singleline declare statements across the codebase

Released version 1.9.0

12 Jan 05:49
@dg dg

Choose a tag to compare

Requirements

  • PHP 8.2 or higher is now required

New Features

Fluent API for Parser

New methods for defining options programmatically:

  • addSwitch() - adds a flag without value (e.g. --verbose)
  • addOption() - adds an option with value (e.g. --format json)
  • addArgument() - adds a positional argument
  • addFromHelp() - extracts options from formatted help text
$parser = (new Parser)
    ->addSwitch('--verbose', '-v', description: 'Enable verbose mode')
    ->addOption('--format', '-f', optionalValue: true, fallback: 'json')
    ->addArgument('file');

Early-Exit Parsing with parseOnly()

New method for parsing only specific options without validation:

// Check --help before full validation
if ($parser->parseOnly(['--help'])['--help']) {
    $parser->help();
    exit;
}

$args = $parser->parse();  // full parsing with validation

Useful for --help and --version options that should work without providing required arguments.

Internal Changes

  • Parser refactored to use Option objects internally instead of arrays
  • Enum validation now runs before normalizer (BC break)
  • Used #[Deprecated] attribute for deprecated constants

Released version 1.8.3

30 Oct 23:27
@dg dg

Choose a tag to compare

  • support for PHP 8.5
  • optimized global function calls

Released version 1.8.2

15 Dec 19:43
@dg dg

Choose a tag to compare

support for PHP 8.4

Released version 1.8

12 Feb 20:00
@dg dg

Choose a tag to compare

requires PHP 8.0

Released version 1.7

26 Nov 23:15
@dg dg

Choose a tag to compare

  • support for PHP 8.3
  • Parser: added Normalizer
  • constants are PascalCase

Released version 1.6

12 Dec 18:04
@dg dg

Choose a tag to compare

  • updated detectColors()

Released version 1.5

05 May 13:27
@dg dg

Choose a tag to compare

  • added Console::detectColors()
  • requires PHP 7.2

For the details you can have a look at the diff.

Released version 1.4.0

05 Feb 22:46
@dg dg

Choose a tag to compare

  • requires PHP 7.1
  • uses PHP 7.1 features
  • added PHP 7.1 scalar and return type hints
  • added declare(strict_types=1);

Released version 1.3

14 Jul 07:48
@dg dg

Choose a tag to compare

  • supports PHP up to 7.2
  • coding style: fixes, lowercase true/false/null

For the details you can have a look at the diff.