Skip to content
Snippets Groups Projects
Commit c1304a76 authored by Andrej Rasevic's avatar Andrej Rasevic
Browse files

adding to code_along example

parent 4ba92bcf
No related branches found
No related tags found
No related merge requests found
...@@ -13,9 +13,9 @@ const menus = { ...@@ -13,9 +13,9 @@ const menus = {
} }
module.exports = (args) => { module.exports = (args) => {
const subCmd = args._[0] === 'help' console.log("***********")
? args._[1] console.log(args._[0])
: args._[0] const subCmd = args._[0] === 'help' ? args._[1] : args._[0]
console.log(subCmd)
console.log(menus[subCmd] || menus.main) console.log(menus[subCmd] || menus.main)
} }
\ No newline at end of file
...@@ -2,8 +2,18 @@ const minimist = require('minimist') ...@@ -2,8 +2,18 @@ const minimist = require('minimist')
module.exports = () => { module.exports = () => {
const args = minimist(process.argv.slice(2)) const args = minimist(process.argv.slice(2))
//console.log(args); console.log("args is: ");
const cmd = args._[0] console.log(args);
let cmd = args._[0] || 'help'
if (args.version || args.v) {
cmd = 'version'
}
if (args.help || args.h) {
cmd = 'help'
}
console.log("------------")
console.log(cmd); console.log(cmd);
switch (cmd) { switch (cmd) {
case 'today': case 'today':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment