Skip to content

Commit

Permalink
feat(stories2csv): expose cli interface for csv generation
Browse files Browse the repository at this point in the history
  • Loading branch information
EggDice committed Nov 27, 2020
1 parent bec7ad5 commit c140eb2
Show file tree
Hide file tree
Showing 11 changed files with 7,841 additions and 29 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,26 @@ A checker and code generation tool for our markdown formatted materials.

### If you have NodeJS and NPM

`npm install -g https://github.com/green-fox-academy/markdown-tools`
```shell
npm install -g https://github.com/green-fox-academy/markdown-tools
```

or

```shell
git clone https://github.com/green-fox-academy/markdown-tools
cd markdown-tools
npm link
```


## Usage

### Generate Jira compatible `csv` from markdown

```
markdown-tools stories2csv -i stories.md -o stories.csv
```

For further details see the `--help` flag on the cli tool or read the `features`.

2 changes: 1 addition & 1 deletion features/cli.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Show the features if no command is specified
Given the package installed
Given a bash prompt in "test/" as working directory
When the "markdown-tools" command is executed
Then it should print to the standard out:
Then it should print to the standard error:
"""
markdown-tools <command>
Expand Down
5 changes: 5 additions & 0 deletions features/steps/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ Then('it should print to the standard out:', async function (content: string) {
assert.equal(stdOut, content);
});

Then('it should print to the standard error:', async function (content: string) {
const stdErr: string = await this.cli.getStdErr();
assert.equal(stdErr, content);
});

Then('the last exit code should be {int}', async function (exitCode: number) {
const lastExitCode: number = await this.cli.getLastExitCode();
assert.equal(lastExitCode, exitCode);
Expand Down
55 changes: 55 additions & 0 deletions features/stories2csv.feature
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,58 @@ Feature: Generate Jira importable CSV file from markdown story list
- Something"
Task one,2,1,Sub-task,Do something unexpected
"""
Then the last exit code should be 0

Scenario:
Given the package installed
Given a bash prompt in "test/" as working directory
When the "markdown-tools stories2csv" command is executed
Then it should print to the standard error:
"""
markdown-tools stories2csv
Creates csv file for Jira from markdown story definitions
Options:
--help Show help [boolean]
--version Show version number [boolean]
-i, --input_file [string] [required]
-o, --output_file [string] [required]
Missing required arguments: i, o
"""
Then the last exit code should be 1

Scenario:
Given the package installed
Given a bash prompt in "test/" as working directory
When the "markdown-tools stories2csv -i stories.md" command is executed
Then it should print to the standard error:
"""
markdown-tools stories2csv
Creates csv file for Jira from markdown story definitions
Options:
--help Show help [boolean]
--version Show version number [boolean]
-i, --input_file [string] [required]
-o, --output_file [string] [required]
Missing required argument: o
"""
Then the last exit code should be 1

Scenario:
Given the package installed
Given a bash prompt in "test/" as working directory
When the "markdown-tools stories2csv -i stories.md -o stories.csv" command is executed
Then it should print to the standard error:
"""
Unable to open file: "stories.md"
"""
Then the last exit code should be 1

2 changes: 1 addition & 1 deletion features/world/realCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const runCliLine = (line: string): Promise<CommandResult> =>
});

spawned.stderr.on('data', data => {
stdout += data;
stderr += data;
});

spawned.on('close', exitCode => {
Expand Down
Loading

0 comments on commit c140eb2

Please sign in to comment.