Skip to content

Commit

Permalink
Now throws error when setup name is not given
Browse files Browse the repository at this point in the history
  • Loading branch information
farisT committed Feb 25, 2019
1 parent 0e903af commit 267b0a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

export const checkName = (name: string|boolean) => {
if (name === true) {
throw Error('No name given, please provide a name after the command');
}
};
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import minimist from 'minimist';
import chalk from 'chalk';

import { createController, addRoute, createSetup, createRoute, createMiddleware } from './create';
import { checkName } from './helper';

const packageJson = require('../package.json');
const figlet = require('figlet');
Expand All @@ -30,7 +31,10 @@ const ControllerName: string = argv.controller || argv.c;
const MiddlewareName: string = argv.middleware || argv.m;
const SetupName: string = argv.setup || argv.s;

if (SetupName) createSetup(SetupName);
if (SetupName) {
checkName(SetupName);
createSetup(SetupName);
}

if (RouteName) {
createRoute(RouteName);
Expand Down

0 comments on commit 267b0a5

Please sign in to comment.