dashed-lang
Version:
A Weird Language Full Of Dashes And Other Characters
65 lines (43 loc) • 1.61 kB
JavaScript
const fs = require('fs');
const program = require('commander');
const chalk = require('chalk');
const compiler = require('./compiler/compiler');
// Chalk Themes
const info = chalk.bgBlue.bold(` i `);
const warn = chalk.bgYellow.bold(` warn `);
const err = chalk.bgRed.bold(` err `);
program
.name('dashed-lang')
.version('0.0.1')
.description(`A Weird Language Full Of Dashes And Other Characters`)
program
.command('help')
.alias('h')
.action(() => {
console.log(`
Dashed - A Weird Language Full Of Dashes And Other Characters
_______________________________________________________________
${info} Usage : ${chalk.green(`dash`)}
Options:-
-----------
${chalk.cyan(`-V | --version`)} - Outputs Version Number
${chalk.cyan(`help | help`)} - Outputs Usage Information
Commands:-
------------
${chalk.cyan(`compile <file>`)} - Processes File And Generates A JS File
`);
})
program
.command('compile <file>')
.action((file, outfile) => {
compiler(`${process.cwd()}/${file}.dash`, (comp) => {
fs.writeFile(`${process.cwd()}/${file}.js`, comp, (err) => {
if (err) {
console.log(err)
}
console.log(`\n\n ${info} File Processed \n\n`);
});
})
})
program.parse(process.argv);