Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/en/appendices/5-5-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ bin/cake upgrade rector --rules cakephp55 <path/to/app/src>
`BadRequestException` (HTTP 400). See
[HTTP Method Overrides](../controllers/request-response#http-method-overrides).

### Console

- `--quiet` now also skips options defined with `prompt`. Previously these
were asked while arguments were parsed, before `--quiet` took effect. A
required option left without a value now fails with the usual missing option
error instead of waiting for input.
- Commands are switched to non-interactive mode before `initialize()` runs, so
prompts in `initialize()` respect `--quiet` and `--no-interaction` too.

## Deprecations

### Database
Expand All @@ -65,6 +74,15 @@ bin/cake upgrade rector --rules cakephp55 <path/to/app/src>
the path expression is used if not set.
- `FunctionsBuilder::jsonExists()` was added.

### Console

- `ConsoleIo::isInteractive()` was added.
- `--no-interaction` was added to the default command options. It disables
prompts, which answer with their default value, while keeping the normal
output level. Unlike `--quiet` it does not hide output. If your application
already defines a `no-interaction` option, you can remove it, or keep it.
The option definition in your application replaces the default one.

### TestSuite

- `Cake\TestSuite\Fixture\DeleteStrategy` was added. This fixture strategy
Expand Down
17 changes: 17 additions & 0 deletions docs/en/console-commands/input-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,20 @@ $selection = $io->askChoice('Red or Green?', ['R', 'G'], 'R');

Selection validation is case-insensitive.

When a command runs with `--quiet` or `--no-interaction`, prompts are not
shown and `ask()` and `askChoice()` return their default value. Use
`$io->isInteractive()` to check whether prompts are enabled, for example to
skip a confirmation step. Options defined with `prompt` are not asked either;
a required option without a value then fails with a missing option error.

```text
bin/cake my_command --no-interaction
```

::: info Added in version 5.5.0
`ConsoleIo::isInteractive()` and the `--no-interaction` option were added.
:::

## Creating Files

`method` Cake\\Console\\ConsoleIo::**createFile**(string $path, string $contents, bool $forceOverwrite = false): bool
Expand Down Expand Up @@ -409,6 +423,9 @@ You can control the output level of commands, by using the `--quiet` and
`--verbose` options. These options are added by default, and allow you to
consistently control output levels inside your CakePHP commands.

`--quiet` also disables interactive prompts. To disable prompts but keep the
normal output, use `--no-interaction` instead.

The `--quiet` and `--verbose` options also control how logging data is
output to stdout/stderr. Normally info and higher log messages are output to
stdout/stderr. When `--verbose` is used, debug logs will be output to stdout.
Expand Down