cypresslab/console-defaults-bundle

A bundle to add defaluts argument to the symfony2 console

0.4.0 2013-11-17 20:43 UTC

This package is auto-updated.

Last update: 2024-04-29 03:04:42 UTC


README

Code Coverage Build Status Scrutinizer Quality Score SensioLabsInsight

this bundle lets you define defaults parameters for your commands. It makes use of console events to work. So you need at least the 2.3 LTS version of symfony

Installation

to install just require the cypresslab/console-defaults-bundle at ~0.3 version. Read the complete instructions here

Usage

add the commands, with the defaults you want, under the cypress_console_defaults key. Here is an example

cypress_console_defaults:
    commands:
        "doctrine:fixtures:load":
            params: [ "--append", "--fixtures src/NS/DataFixtures" ]

        "rabbitmq:consumer":
            params: [ "-w" ]

        "cache:clear":
            params: [ "--no-warmup", "--no-optional-warmers"]

the next time you will call one of the defined command the bundle will add the parameters for you

$ ./app/console cache:clear
$ --- ConsoleDefaultsBundle You have defined some defaults for this command
$ --- proceeding with defaults: --no-warmup, --no-optional-warmers
$ Clearing the cache for the dev environment with debug true

From version 0.4 you can pass a regular expression as the command name. You need to use two slashes to wrap the command like this

cypress_console_defaults:
    commands:
        "/doctrine:(.*)/":
            params: [ "--no-interaction"]

With this configuration every doctrine:... command will have the "--no-interaction" flag

Use cases

  • default to --symlink for assets install
cypress_console_defaults:
    commands:
        "assets:install":
            params: [ "--symlink" ]
  • change the folder where the fixtures are loaded
cypress_console_defaults:
    commands:
        "doctrine:fixtures:load":
            params: [ "--fixtures my/personal/folder" ]
  • disable cache warmup
cypress_console_defaults:
    commands:
        "cache:clear":
            params: [ "--no-warmup", "--no-optional-warmers" ]

other ideas?

Bitdeli Badge