Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Commit

Permalink
Add cli options validators
Browse files Browse the repository at this point in the history
  • Loading branch information
fabien0102 committed Apr 30, 2019
1 parent a6321de commit df86e64
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/bin/restful-react-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ program.parse(process.argv);
(async () => {
const transformer = program.transformer ? require(join(process.cwd(), program.transformer)) : undefined;

if (!program.output) {
throw new Error("You need to provide an output file with `--output`");
}
if (!program.file && !program.github) {
throw new Error("You need to provide an input specification with `--file` or `--github`");
}

if (program.file) {
const data = readFileSync(join(process.cwd(), program.file), "utf-8");
const { ext } = parse(program.file);
Expand Down

0 comments on commit df86e64

Please sign in to comment.