-
-
Save selfagency/bb28d2fd028a03e71ec707ff28bc19b0 to your computer and use it in GitHub Desktop.
termost issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
import { termost } from 'termost'; | |
import type { ProgramContext } from './index.d'; | |
import processor from './lib/processor'; | |
import { log } from './lib/util'; | |
const program = termost<ProgramContext>('WP Converter', { | |
name: 'wpconv', | |
description: 'WordPress data converter', | |
version: '0.0.1', | |
onException(error) { | |
log.error(error); | |
}, | |
onShutdown() { | |
log.info('Fin.'); | |
} | |
}); | |
program.option({ | |
key: 'input', | |
name: { long: 'input', short: 'i' }, | |
description: 'Input file(s) or folder', | |
defaultValue: `${process.cwd()}` | |
}); | |
program.option({ | |
key: 'output', | |
name: { long: 'output', short: 'o' }, | |
description: 'Output directory', | |
defaultValue: `${process.cwd()}/output` | |
}); | |
program | |
.command({ | |
name: 'json', | |
description: 'Convert WordPress data to JSON' | |
}) | |
.task({ | |
label: 'Converting to JSON', | |
async handler() { | |
await processor(program.input.arguments, 'json'); | |
} | |
}); | |
program | |
.command({ | |
name: 'md', | |
description: 'Convert WordPress data to Markdown' | |
}) | |
.task({ | |
label: 'Converting to Markdown', | |
async handler() { | |
await processor(program.input.arguments, 'md'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment