json-parser-yaml-converter
Version:
Enhanced JSON Parser with verbose error messages and JSON to YAML conversion
26 lines (21 loc) • 758 B
JavaScript
/**
* This module contains the executable json2yaml that converts a JSON file to YAML format.
*
* @module json2yaml
*/
;
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);