github.com/bilus/oya@v0.0.3-0.20190301162104-da4acbd394c6/features/flags.feature (about)

     1  Feature: Running tasks
     2  
     3  Background:
     4     Given I'm in project dir
     5  
     6  Scenario: Pass flags and positional arguments to a task
     7    Given file ./Oyafile containing
     8      """
     9      Project: project
    10      task: |
    11        bashVariable=42
    12        $for i, arg in Args:
    13          echo Args[$i] = $Args[i]
    14        $end
    15        echo Flags.switch = $Flags.switch
    16        echo Flags.value = $Flags.value
    17        echo Flags.otherSwitch = $Flags.otherSwitch
    18        echo bashVariable = $$bashVariable
    19      """
    20    When I run "oya run task positional1 positional2 --switch --value=5 --other-switch"
    21    Then the command succeeds
    22    And the command outputs to stdout
    23    """
    24    Args[0] = positional1
    25    Args[1] = positional2
    26    Flags.switch = true
    27    Flags.value = 5
    28    Flags.otherSwitch = true
    29    bashVariable = 42
    30  
    31    """