-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
815942c
commit d9aa76e
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict' | ||
|
||
const yargs = require('yargs') | ||
const generate = require('./cmds/generate') | ||
|
||
function main () { | ||
yargs | ||
.usage('$0 <cmd> [args]') | ||
// Default command 'generate' | ||
.command({ | ||
command: 'generate [options]', | ||
aliases: ['gen', 'g', '$0'], // $0 is to set this command as default. This commmand runs when no commans are passed | ||
desc: 'Generate the md files', | ||
handler: generate, | ||
builder: (yargs) => { | ||
yargs | ||
.options({ | ||
'source': { | ||
alias: 's', | ||
default: './src', | ||
desc: 'Source folder with .js or .ts files', | ||
type: 'string' | ||
}, | ||
'dist': { | ||
alias: 'd', | ||
default: './documentation', | ||
desc: 'Destination folder', | ||
type: 'string' | ||
}, | ||
'folder': { | ||
alias: 'f', | ||
default: 'code', | ||
desc: 'Folder inside destination folder. Gets overwritten everytime', | ||
type: 'string' | ||
}, | ||
'title': { | ||
alias: 't', | ||
default: 'API', | ||
desc: 'Title of your documentation', | ||
type: 'string' | ||
} | ||
}) | ||
}, | ||
}) | ||
// adding aliases to help and version args | ||
.alias('help', 'h') | ||
.alias('version', 'v') | ||
.argv | ||
} | ||
|
||
module.exports = main |