impress.me
Version:
Create impress.js presentations from markdown documents with style
81 lines (80 loc) • 2.67 kB
JavaScript
"use strict";
const command_1 = require("@oclif/command");
const impress_me_1 = require("./impress.me");
const log = require("loglevel");
const errors_1 = require("@oclif/errors");
const theme_1 = require("./theme");
const strategy_1 = require("./strategy");
const shape_1 = require("./shape");
const open = require("open");
class ImpressMeCommand extends command_1.Command {
async run() {
const parsed = this.parse(ImpressMeCommand);
if (parsed.flags.debug) {
log.setLevel('debug');
}
else {
log.setLevel('info');
}
await new impress_me_1.ImpressMe(parsed.flags)
.convert(parsed.args.input, parsed.args.output)
.then(output => {
if (parsed.flags.open) {
log.debug(`Opening "${output}"`);
open(output);
}
})
.catch(errors_1.handle);
}
}
ImpressMeCommand.description = 'create impress.js presentations from markdown documents in style';
ImpressMeCommand.flags = {
// add --version flag to show CLI version
version: command_1.flags.version({ char: 'v' }),
help: command_1.flags.help({ char: 'h' }),
primary: command_1.flags.string({
char: 'p',
description: 'define the primary color from material colors',
}),
secondary: command_1.flags.string({
char: 's',
description: 'define the secondary color from material colors',
}),
theme: command_1.flags.option({
char: 't',
description: 'choose the theme for the presentation (shape and strategy)',
options: Object.keys(theme_1.themeMap),
parse: x => x,
}),
shape: command_1.flags.option({
description: 'define the shape of the slides',
options: shape_1.shapes,
parse: x => x,
}),
strategy: command_1.flags.option({
description: 'define the slide positioning strategy',
options: strategy_1.strategies,
parse: x => x,
}),
cssFiles: command_1.flags.string({
char: 'c',
description: 'the CSS files to add - add multiple files by adding this option multiple times',
multiple: true,
}),
transitionDuration: command_1.flags.integer({
char: 'd',
description: 'the duration between slides in millis',
}),
debug: command_1.flags.boolean({
description: 'enable debug logging',
}),
open: command_1.flags.boolean({
char: 'o',
description: 'open created document',
}),
};
ImpressMeCommand.args = [
{ name: 'input', required: true },
{ name: 'output' },
];
module.exports = ImpressMeCommand;