UNPKG

json-parser-yaml-converter

Version:
26 lines (21 loc) 758 B
#!/usr/bin/env node /** * This module contains the executable json2yaml that converts a JSON file to YAML format. * * @module json2yaml */ 'use strict'; import { program } from 'commander'; import { createRequire } from 'module'; const require = createRequire(import.meta.url); const { version } = require('../package.json'); import { json2Yaml } from '../src/loggers.js'; program .name('json2yaml') .description('Converts a JSON file to YAML format') .version(version, '-v, --version', 'Output the version number') .helpOption('-h, --help', 'Display help') .argument('<jsonFile>', 'JSON file to check') .option('-o, --output [outputFile]', 'Output file', null) .action(json2Yaml); program.parse(process.argv);