Commit Graph

70 Commits

Author SHA1 Message Date
Mikkel Paulson
caad562c11 [Console] Add callback support to Console\Question autocompleter
In order to enable more dynamic use cases such as word-by-word
autocomplete and path-based autocomplete, update the autocomplete logic
of the Question object and its helper to accept a callback function.
This function is called on each keystroke and should return an array of
possibilities to present to the user.

The original logic only accepted an array, which required
implementations to anticipate in advance all possible input values.

This change is fully backwards-compatible, but reimplements the old
behaviour by initializing a "dumb" callback function that always returns
the same array regardless of input.
2019-04-08 17:48:46 +02:00
Jérôme Vasseur
eb355314b0 Add an iterate method to the ProgressBar class 2019-01-30 21:33:07 +01:00
Fabien Potencier
51a359c079 Merge branch '4.2' into short-array-master
* 4.2:
  fixed CS
  fixed CS
  fixed tests
  fixed CS
  fixed CS
  fixed CS
  fixed short array CS in comments
  fixed CS in ExpressionLanguage fixtures
  fixed CS in generated files
  fixed CS on generated container files
  fixed CS on Form PHP templates
  fixed CS on YAML fixtures
  fixed fixtures
  switched array() to []
2019-01-16 22:53:39 +01:00
Fabien Potencier
e03db43894 fixed CS 2019-01-16 22:31:25 +01:00
Gabriel Ostrolucký
db750ed8ae [Console] Add hyperlinks support 2018-12-10 04:47:46 +01:00
Chris de Kok
cec531707f [Console] Add support for error ouput in the CommandTester 2018-09-23 13:34:50 +02:00
Roland Franssen
09f8ad935d [Console] Support formatted text cutting 2018-09-04 22:10:01 +02:00
Nicolas Grekas
8895bc1b5b [Process][Console] deprecated defining commands as strings 2018-07-06 20:45:13 +02:00
Tobias Schultze
5100071caf [Console] add support for iterable in output 2018-04-06 18:29:06 +02:00
Pierre du Plessis
9ec51a1797 [Console] Modify console output and print multiple modifyable sections 2018-03-20 15:41:20 +01:00
Pierre du Plessis
83d52f02f9 [Console] Add option to automatically run suggested command if there is only 1 alternative 2018-02-22 07:25:54 +01:00
Nicolas Grekas
8606c155cc Merge branch '3.4'
* 3.4:
  implement reset() in DumpDataCollector
  [Console][HttpKernel] Handle new SHELL_VERBOSITY, also configures the default logger
2017-10-11 10:25:05 +02:00
Nicolas Grekas
87bd741f2d [Console][HttpKernel] Handle new SHELL_VERBOSITY, also configures the default logger 2017-10-04 19:17:25 +02:00
Nicolas Grekas
3a9653df72 Merge branch '3.4'
* 3.4:
  [Console] Add protected static $defaultName to set the default name of a Command
  removed sf2 references
  [Console] Allow commands to provide a default name for compile time registration
  [DI] Case sensitive parameter names
2017-08-25 12:57:40 +02:00
Nicolas Grekas
eda7d42955 [Console] Add protected static $defaultName to set the default name of a Command 2017-08-24 16:43:56 +02:00
Robin Chalas
5d9ae6b56f [Console] Allow commands to provide a default name for compile time registration 2017-08-16 21:44:58 +02:00
Nicolas Grekas
501c1b5d0e Merge branch '3.4'
* 3.4:
  Made some SecurityBundle tests case-insensitive to prepare for future Symfony versions
  [Console] Added a case-insensitive fallback for console command names
  fix merge
  [DI] Fix dumping abstract with YamlDumper
  restrict reflection doc block
  [DI] Fix YamlDumper not dumping abstract and autoconfigure
2017-08-15 10:24:11 +02:00
Thanos Polymeneas
04df2832ab [Console] Added a case-insensitive fallback for console command names 2017-08-12 10:14:42 +02:00
Fabien Potencier
7695112601 feature #22317 [Console] Make SymfonyQuestionHelper::ask optional by default (ro0NL)
This PR was merged into the 4.0-dev branch.

Discussion
----------

[Console] Make SymfonyQuestionHelper::ask optional by default

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes (nothing in core depends on it)
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

i noticed when writing commands i always keep doing

```php
$io = new SymfonyStyle($input, $output);
$answer = $io->ask('...', null, function ($value) { return $value; });

// instead of just
$answer = $io->ask('...');
```

only to bypass a built-in validation, of which im not sure why it's there. Note the base question helper doesnt make this assumption...

Commits
-------

2da429cd0a [Console] Make SymfonyQuestionHelper::ask optional by default
2017-07-22 20:13:43 +02:00
Nicolas Grekas
d024d79559 Merge branch '3.4'
* 3.4: (22 commits)
  use Precise on Travis to keep PHP LDAP support
  Fix case sensitive sameSite cookie
  [PropertyInfo] Use rawurlencode to escape PSR-6 keys
  fix(security): ensure the 'route' index is set before attempting to use it
  Fix registering lazy command services with autoconfigure enabled
  Fix the design of the profiler exceptions when there is no message
  [Config] Minor fix
  document the TwigRenderer class deprecation
  [Security] added more tests
  [Security] fixed default target path when referer contains a query string
  [Security] simplified tests
  [Security] refactored tests
  [WebProfilerBundle][TwigBundle] Fix infinite js loop on exception pages
  [FrameworkBundle] fix ValidatorCacheWarmer: use serializing ArrayAdapter
  Change "this" to "that" to avoid confusion
  [VarDumper] Move locale sniffing to dump() time
  [VarDumper] Use "C" locale when using "comma" flags
  [Config] Make ClassExistenceResource throw on invalid parents
  [DebugBundle] Added min_depth to Configuration
  [Console] Add a factory command loader for standalone application with lazy-loading needs
  ...
2017-07-21 13:08:07 +02:00
Fabien Potencier
b9cc0890c4 feature #22317 [Console] Make SymfonyQuestionHelper::ask optional by default (ro0NL)
This PR was merged into the 4.0-dev branch.

Discussion
----------

[Console] Make SymfonyQuestionHelper::ask optional by default

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes (nothing in core depends on it)
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

i noticed when writing commands i always keep doing

```php
$io = new SymfonyStyle($input, $output);
$answer = $io->ask('...', null, function ($value) { return $value; });

// instead of just
$answer = $io->ask('...');
```

only to bypass a built-in validation, of which im not sure why it's there. Note the base question helper doesnt make this assumption...

Commits
-------

2da429cd0a [Console] Make SymfonyQuestionHelper::ask optional by default
2017-07-20 19:25:39 +02:00
Maxime Steinhausser
9b40b4af65 [Console] Add a factory command loader for standalone application with lazy-loading needs 2017-07-15 10:43:17 +02:00
Nicolas Grekas
bdaa7b118e Merge branch '3.4'
* 3.4:
  Add TokenProcessor
  [DI] Handle root namespace in service definitions
  Add support for command lazy-loading
  Use rawurlencode() to transform the Cookie into a string
  [TwigBundle] Added a RuntimeExtensionInterface to take advantage of autoconfigure
  [Process] Fix parsing args on Windows
  Add exculde verbosity test
  [HttpKernel][VarDumper] Truncate profiler data & optim perf
  [DI] Allow imports in string format for YAML
  [Validator] Allow to use a property path to get value to compare in comparison constraints
  [Security] Fix authentication.failure event not dispatched on AccountStatusException
  add option to define the access decision manager
  Add support for doctrin/dbal 2.6 types
2017-07-12 16:12:10 +02:00
Robin Chalas
7f97519624 Add support for command lazy-loading 2017-07-12 11:59:19 +02:00
Christian Flothmann
4bae9aa3da [Console] remove remaining deprecated features 2017-05-25 10:45:41 +02:00
Michael Babker
80f329c330 Remove deprecated console.exception event 2017-05-21 09:38:50 -05:00
Robin Chalas
4cde3b9fcb [Console] Remove deprecated features 2017-05-21 12:24:34 +02:00
Roland Franssen
2da429cd0a [Console] Make SymfonyQuestionHelper::ask optional by default 2017-04-06 21:05:17 +02:00
Robin Chalas
b21ce850e7 [Console] Allow to catch CommandNotFoundException 2017-03-29 21:37:27 +02:00
Fabien Potencier
ba4d6bce29 feature #18140 [Console] Add console.ERROR event and deprecate console.EXCEPTION (wouterj)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Console] Add console.ERROR event and deprecate console.EXCEPTION

| Q | A |
| --- | --- |
| Branch | master |
| Bug fix? | yes |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | yes |
| Tests pass? | yes |
| Fixed tickets | - |
| License | MIT |
| Doc PR | todo |
## The Problem

The current `console.EXCEPTION` event is only dispatched for exceptions during the execution of `Command#execute()`. All other exceptions (e.g. the ones thrown by listeners to events) are catched by the `try ... catch` loop in `Application#doRunCommand()`. This means that there is _no way to override exception handling_.
## The Solution

This PR adds a `console.ERROR` event which has the same scope as the default `try ... catch` loop. This allows to customize all exception handling.

In order to keep BC, a new event was created and `console.EXCEPTION` was deprecated.

Commits
-------

c02a4c9857 Added a console.ERROR event
2017-03-22 16:10:45 -07:00
Robin Chalas
80867422ac [Console] Explicitly passed options without value (or empty) should remain empty 2017-03-01 00:35:20 +01:00
WouterJ
c02a4c9857 Added a console.ERROR event 2017-02-04 18:07:02 +01:00
Robin Chalas
919041c1ad
Add Console ExceptionListener
Handle non string-castable inputs

Cleanup input for display

Naming changes

InputInterface doesnt have a toString()

Logger must be private

Remove useless doc blocks

Tweak tests
2017-01-23 23:15:00 +01:00
Benjamin Cremer
7743989675 Move AddConsoleCommandPass from FrameworkBundle to Console. 2017-01-11 13:05:48 +01:00
Geoffrey Brier
b57a83fce6 [Console] Add Lockable trait 2016-06-23 13:42:36 +02:00
Robin Chalas
a0b4ae724c
Reference changes that ease command testing in 3.2 2016-06-22 21:54:18 +02:00
Arjan Keeman
20c81b2bd6 [Console] Add non-auto column width functionality 2016-03-01 18:31:09 +01:00
Nicolas Grekas
1bd125ec4a Merge branch '3.0'
* 3.0: (105 commits)
  [Console] remove readline support
  bumped Symfony version to 3.0.3
  updated VERSION for 3.0.2
  updated CHANGELOG for 3.0.2
  [Routing] added a suggestion to add the HttpFoundation component.
  [FrameworkBundle] fix assets and templating tests
  [ClassLoader] fix ApcClassLoader tests on HHVM
  [travis] Add some comments
  changed operator from and to &&
  [DependencyInjection] Remove unused parameter
  [Process] Fix transient tests for incremental outputs
  [Console] Add missing `@require` annotation in test
  Fix merge
  [appveyor] Fix failure reporting
  [#17634] move DebugBundle license file
  Limit Ldap component version for the 3.0 branch
  backport GlobTest from 2.7 branch
  Move licenses according to new best practices
  [FrameworkBundle] Remove unused code in test
  [2.3] Fixed an undefined variable in Glob::toRegex
  ...

Conflicts:
	.travis.yml
	composer.json
	src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
	src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php
	src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml
	src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml
	src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig
	src/Symfony/Component/Console/CHANGELOG.md
	src/Symfony/Component/HttpKernel/Kernel.php
	src/Symfony/Component/PropertyInfo/Tests/PropertyInfoExtractorTest.php
	src/Symfony/Component/Yaml/Tests/ParserTest.php
2016-02-04 13:57:09 +01:00
Christian Flothmann
0e45a4a5de [Console] remove readline support 2016-02-03 19:01:35 +01:00
Marek Pietrzak
a16b1a0228 [console] Add truncate method to FormatterHelper 2016-01-25 13:26:46 +01:00
Michaël Perrin
8b63d6209d [Console] Use readline for user input when available
This allows to use arrow keys in the terminal instead of having weird characters
2015-08-01 11:46:56 +02:00
Bernhard Schussek
27a2280d29 Merge branch '2.5'
* 2.5: (33 commits)
  [Validator] Added Swedish translations
  [Validator] Fixed ExpressionValidator when the validation root is not an object
  [Validator] Fixed: Made it possible (again) to pass a class name to Validator::validatePropertyValue()
  Fix incorrect romanian plural translations
  fix axes handling in Crawler::filterXPath()
  fix some docblocks
  Fixed self-reference in 'service_container' service breaks garbage collection (and clone).
  [Process] Fix tests when pcntl is not available.
  [DependencyInjection] Roll back changes made to generated files.
  [Console] Roll back changes made to fixture files.
  Issue #11489 Added some CA and ES translations
  [Validator] Added more detailed inline documentation
  [Validator] Removed information from the violation output if the value is an array, object or resource
  partially reverted previous commit
  fixed CS
  Add point about ConsoleLogger to Console 2.5 changelog
  [Validator] Fixed failing tests
  [Validator] CS fixes
  [FrameworkBundle] Made ConstraintValidatorFactory aware of the legacy validators
  [Validator] Added extensive test coverage for the constraint validators for the different APIs
  ...

Conflicts:
	src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf
2014-08-05 11:07:51 +02:00
Jeroen De Dauw
874482632b Add point about ConsoleLogger to Console 2.5 changelog 2014-07-29 13:56:02 +02:00
Romain Neutron
edc1bfeb2b [Console] Add process helper tests 2014-06-11 08:54:52 +02:00
Fabien Potencier
faffe7e3a8 [Console] added a Process helper 2014-06-10 19:20:02 +02:00
Fabien Potencier
c413f89723 [Console] added a better way to ask questions to the user 2014-04-01 14:31:41 +02:00
Grégoire Pineau
6786f6db18 [Console] Rename Command::setProcessName to Command::setProcessTitle
To be more consistant with the underlying system.
2014-03-18 00:05:29 +01:00
Fabien Potencier
39c495f814 [Console] deprecated TableHelper in favor of Table 2014-03-03 14:12:09 +01:00
Fabien Potencier
4e76aa3fbc [Console] added ProgressBar (to replace the stateful ProgressHelper class) 2014-03-01 07:33:14 +01:00
Daniel Gomes
418de05b35 [Console] Added the possibility to set a different default command 2014-01-07 16:22:10 +01:00