Implement renderInstructions in themer-cmd
This commit is contained in:
parent
15c9b654c0
commit
e159f3526a
@ -12,8 +12,4 @@ Then pass `themer-cmd` as a `-t` (`--template`) arg to `themer`:
|
||||
|
||||
themer -c my-colors.js -t themer-cmd -o gen
|
||||
|
||||
## Output
|
||||
|
||||
`themer-cmd` will generate a `themer-dark.reg` / `themer-light.reg` (or both) in your output directory.
|
||||
|
||||
Simply double-click this file to add the color keys and values to the registry. The scheme of CMD can then be configured with the `color` command. For example, use `color 07` to set the background and foreground to your color set's default.
|
||||
Installation instructions for the generated theme file(s) will be included in `<output dir>/README.md`.
|
||||
|
@ -49,3 +49,14 @@ exports[`render should render properly formatted CMD.exe theme .reg file 2`] = `
|
||||
\\"PopupColors\\"=dword:0000008b
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`renderInstructions should provide installation instructions 1`] = `
|
||||
"
|
||||
Simply double-click the desired theme file to add the color keys to the registry:
|
||||
|
||||
* \`themer-dark.reg\`
|
||||
* \`themer-light.reg\`
|
||||
|
||||
The scheme of CMD can then be configured with the \`color\` command. For example, use \`color 07\` to set the background and foreground to your color set's default.
|
||||
"
|
||||
`;
|
||||
|
@ -46,4 +46,12 @@ const render = colors =>
|
||||
}))
|
||||
.map(colorSet => renderTheme(colorSet));
|
||||
|
||||
module.exports = {render};
|
||||
const renderInstructions = paths => `
|
||||
Simply double-click the desired theme file to add the color keys to the registry:
|
||||
|
||||
${paths.map(p => `* \`${p}\``).join('\n')}
|
||||
|
||||
The scheme of CMD can then be configured with the \`color\` command. For example, use \`color 07\` to set the background and foreground to your color set's default.
|
||||
`;
|
||||
|
||||
module.exports = {render, renderInstructions};
|
||||
|
@ -1,15 +1,21 @@
|
||||
const {render} = require('./index');
|
||||
const {render, renderInstructions} = require('./index');
|
||||
const {colors} = require('../../themer-colors-default');
|
||||
|
||||
describe('render', () => {
|
||||
it('should render properly formatted CMD.exe theme .reg file', done => {
|
||||
Promise.all(render(colors)).then(files => {
|
||||
expect(files.length).toBe(2);
|
||||
files.forEach(file => {
|
||||
expect(/themer-(dark|light)\.reg/.test(file.name)).toBe(true);
|
||||
expect(file.contents.toString('utf8')).toMatchSnapshot();
|
||||
});
|
||||
done();
|
||||
it('should render properly formatted CMD.exe theme .reg file', async () => {
|
||||
const files = await Promise.all(render(colors))
|
||||
expect(files.length).toBe(2);
|
||||
files.forEach(file => {
|
||||
expect(/themer-(dark|light)\.reg/.test(file.name)).toBe(true);
|
||||
expect(file.contents.toString('utf8')).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('renderInstructions', () => {
|
||||
it('should provide installation instructions', async () => {
|
||||
const files = await Promise.all(render(colors));
|
||||
const instructions = renderInstructions(files.map(({ name }) => name));
|
||||
expect(instructions).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user