Contents

--output option

Use the --output (or -o) option to specify a different output file name, or "-" for STDOUT. By default the output filename is the grammar or parser name converted from camel-case to underscore.

Scenario: Specify a different file name

@command-line

  • Given a file named "binary.rtlr" with:
    grammar BinaryGrammar
    expr <- [01]*
  • And a directory named "lib"
  • When I run `rtlr --output my_grammar.rb binary.rtlr`
  • Then the output should contain "binary.rtlr -> my_grammar.rb"
  • And the file "my_grammar.rb" should contain:
    ruby
    module BinaryGrammar

Scenario: Use "-" to write to STDOUT

@command-line

  • Given a file named "binary.rtlr" with:
    grammar BinaryGrammar
    expr <- [01]*
  • And a directory named "lib"
  • When I run `rtlr --output - binary.rtlr`
  • Then the output should contain:
    text
    module BinaryGrammar

Source: features/command_line/output_option.feature at commit 8b4efde2, Rattler (MIT license).