Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Oct 11, 2021

String tasks do not have their options resolved properly when the options are defined in the command itself.
Global options are resolved properly as described here: https://github.com/php-taskman/core#define-global-command-options

I don't know if what I'm doing in the PR is really the proper way. Could you maybe point me in the right direction @drupol ?

Working example:

globals:
    options:
        env:
            description: Environment
            default: dev

commands:
    test:command:
        tasks:
            - echo "Running on environment ${options.env}"

Result:

 [Exec] Running echo "Running on environment dev"
Running on environment dev
 [Exec] Done in 0.002s

Non working example:

commands:
    test:command:
        tasks:
            - echo "Running on environment ${options.env}"
        options:
            env:
                description: Environment
                default: dev

Result:

 [Exec] Running echo "Running on environment ${options.env}"
sh: 1: Bad substitution
 [Exec]  Exit code 2  Time 0.002s

Also when defining both global and command option in the same yaml file you get an error:
An option named "env" already exists.

@ghost ghost force-pushed the resolve-command-options branch from 6d57fd9 to a2d92d1 Compare October 11, 2021 13:29
@ghost ghost changed the base branch from master to 1.x October 11, 2021 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants