Skip to content

judimator/augurken

Repository files navigation

Augurken is a tool to format Gherkin features.

Install

Download the latest binary for your architecture here.

Usage

Usage:
  augurken [command]

Available Commands:
  check       Check formatting of gherkin file(s)
  completion  Generate the autocompletion script for the specified shell
  format      Format gherkin file(s)
  help        Help about any command

Flags:
  -h, --help         help for augurken
  -i, --indent int   set the indentation for Gherkin features (default 2)
  -v, --version      version for augurken
 
Use "augurken [command] --help" for more information about a command.

Format a feature file

$ augurken format /path/to/filename.feature

Format a folder with features

$ augurken format /path/to/features

Format a feature file with indent. Augurken uses space as indent

$ augurken format -i 2 /path/to/filename.feature

⚠️ Augurken works only on UTF-8 encoded files, it will detect and convert automatically files that are not encoded in this charset.

Features

  • Format Gherkin features
  • Format JSON in step doc string
  • Scenario Outline. Recognize and compact JSON inside table

Supported JSON format in step doc string

{
  ...
  "key": <value>,
  ...
}
{
  ...
  "key1": <value1>,
  <placeholder1>,
  <placeholder2>,
  ...
}
[
  ...
  <value1>,
  <value2>,
  "value3",
  ...
]

Compact JSON inside table

Examples like

Feature: The feature

  Scenario Outline: Compact json
    Given I load data:
    """
    <data>
    """
    Examples:
      | data                                       |
      | {"key1":   "value2",   "key2":   "value2"} |
      | [1,   2,   3]                              |

become

Feature: The feature

  Scenario Outline: Compact json
    Given I load data:
    """
    <data>
    """
    Examples:
      | data                              |
      | {"key1":"value2","key2":"value2"} |
      | [1,2,3]                           |

Contribute

If you want to add a new feature, open an issue with proposal

Acknowledgements

Thanks antham for the idea and some functions. Also, some functions got from here and official Go encoding library