Skip to content

Commit ef95c55

Browse files
committed
fix: alias to commands
Added ability to use shorter commands format
1 parent 868224d commit ef95c55

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Build Status](https://travis-ci.org/tomyitav/generate-graphql-app.svg?branch=master)](https://travis-ci.org/tomyitav/generate-graphql-app)
44
[![npm](https://img.shields.io/npm/v/generate-graphql-app.svg)](https://www.npmjs.com/package/generate-graphql-app)
55
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
6+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
67

78
Cli tool for bootstrapping production grade GraphQL server, using:
89

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/abstract-command.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export abstract class AbstractCommand {
2-
public abstract getName(): string;
3-
public abstract getDescription(): string;
4-
public abstract getAction(): (...args: any[]) => void;
2+
public abstract getName(): string
3+
public abstract getDescription(): string
4+
public abstract getAlias(): string
5+
public abstract getAction(): (...args: any[]) => void
56
}

src/commands/init.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export class Init extends AbstractCommand {
2020
return 'Create new project'
2121
}
2222

23+
public getAlias(): string {
24+
return 'i'
25+
}
26+
2327
public getAction(): (...args: any[]) => void {
2428
return async (projectName: string) => {
2529
try {

src/gga.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
import * as program from 'commander'
44
import allCommands from './commands/all-commands'
55

6-
program.version('1.2.2').description('Cli tool for bootstrapping production grade GraphQL server')
6+
program.version('1.2.3').description('Cli tool for bootstrapping production grade GraphQL server')
77

88
for (let command of allCommands) {
99
program
1010
.command(command.getName())
1111
.description(command.getDescription())
12+
.alias(command.getAlias())
1213
.action(command.getAction())
1314
}
1415

0 commit comments

Comments
 (0)