Skip to content

Commit

Permalink
Allow export filename to be overriden.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshnesbitt committed May 25, 2016
1 parent 713b14f commit 6833b0b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "trello-board-to-markdown",
"version": "1.0.0",
"version": "1.0.1",
"description": "A simple tool to convert a Trello board to a Markdown document.",
"scripts": {
"postinstall": "./node_modules/.bin/babel src -d dist"
Expand Down
1 change: 1 addition & 0 deletions src/application.js
Expand Up @@ -16,6 +16,7 @@ export function run() {

commander.command('convert <id>').
description('Convert the board <id> to a Markdown document.').
option('-f, --filename [name]', 'The name out the output file.').
action((id, options) => {
options.id = id;
executeCommand(options);
Expand Down
7 changes: 4 additions & 3 deletions src/commands/convert.js
Expand Up @@ -62,11 +62,12 @@ export function call(options) {
markdown.push(`${bullets.join("\n\n")}\n`);
});

const filename = `${process.cwd()}/${board['name']}`;
const filename = options.filename || `${board['name']}.md`;
const path = `${process.cwd()}/${filename}`;
const contents = markdown.join("\n\n");

filesystem.writeFileSync(filename, contents);
filesystem.writeFileSync(path, contents);

logger.success(`Written file to ${filename}`);
logger.success(`Written file to ${path}`);
});
}

0 comments on commit 6833b0b

Please sign in to comment.