ardunno-cli-gen
Version:
Generates nice-grpc API for the Arduino CLI
25 lines (24 loc) • 1.38 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const generate_1 = __importDefault(require("./generate"));
const description = 'Generates TS/JS API for the Arduino CLI';
const program = new commander_1.Command();
program.name('ardunno-cli').description(description);
program
.command('generate')
.description(description)
.argument('<src>', "The source of the proto files to generate from. The input source can be a path to the folder which contains the proto files. The source can be a valid semver. Then, the proto files will be downloaded from the Arduino CLI's GitHub release. It can be a GitHub commit in the following format `(?<owner>)/(?<repo>)(#(?<commit>))?`. Then, the proto files will be cloned and checked out from GitHub.")
.requiredOption('-o, --out <string>', 'Specify an output folder for all emitted files.')
.option('-f, --force', 'Override previously emitted files in the output location.')
.action(async (arg, options) => {
const src = String(arg);
const force = Boolean(options.force);
const out = String(options.out);
await (0, generate_1.default)({ src, out, force });
});
program.parse();