Search code examples
phpbashsymfonyconsolesymfony-console

Console Command options shall not remove whitespaces


I have a command within a bash-script:

/usr/bin/env php foo.php $@

With this option:

$this->addOption(
    'prefix',
    null,
    InputOption::VALUE_OPTIONAL,
    'Prefix for each commit message',
    '- '
);

When I run the command

bin/foo some:command --prefix 'Meh '
bin/foo some:command --prefix "Meh "
bin/foo some:command --prefix='Meh '
bin/foo some:command --prefix="Meh "

And take a look at the option

var_dump( $input->getOption('prefix') );

Then it trims the whitespaces

string(3) "Meh"

Why is that? How do I suppress that or correctly put the options in my command?

Thanks in advance!


Solution

  • Nevermind. It is

    /usr/bin/env php foo.php "$@"
    

    The quotes are important