ergogen/absolem.js

45 lines
1 KiB
JavaScript
Raw Normal View History

2020-06-07 13:40:26 +02:00
const fs = require('fs-extra')
const path = require('path')
const yaml = require('js-yaml')
2020-05-28 22:18:41 +02:00
const yargs = require('yargs')
2020-06-07 13:40:26 +02:00
2020-05-28 22:18:41 +02:00
const args = yargs
2020-06-07 13:40:26 +02:00
.option('config', {
alias: 'c',
demandOption: true,
describe: 'Config yaml file',
type: 'string'
})
.option('output', {
alias: 'o',
default: path.resolve('output'),
describe: 'Output folder',
type: 'string'
})
2020-05-28 22:18:41 +02:00
.option('outline', {
default: false,
describe: 'Generate 2D outlines',
type: 'boolean'
})
.option('pcb', {
default: false,
describe: 'Generate PCB draft',
type: 'boolean'
})
.option('case', {
default: false,
describe: 'Generate case files',
type: 'boolean'
})
2020-06-07 13:40:26 +02:00
.argv
2020-05-28 22:18:41 +02:00
if (!args.outline && !args.pcb && !args.case) {
yargs.showHelp("log")
console.log('Nothing to do...')
process.exit(0)
}
2020-06-07 13:40:26 +02:00
const config = yaml.load(fs.readFileSync(args.c).toString())
2020-05-28 22:18:41 +02:00
const points = require('./helpers/points').parse(config)
2020-06-07 13:40:26 +02:00
2020-05-28 22:18:41 +02:00
console.log(points)