Permalink
Browse files

trying code layout

  • Loading branch information...
1 parent 134752b commit f6b87f26f8225765884532338d3d69b208544d48 @pgte pgte committed Aug 10, 2012
Showing with 22 additions and 20 deletions.
  1. +22 −20 article.md
View
42 article.md
@@ -61,26 +61,28 @@ Luckily, there's a third party module that makes all of this trivial - it's call
Once you have it, give it a try - it can really be a life-saver.
- var myArgs = require('optimist').argv,
- help = 'This would be a great place for real help information.';
-
- if ((myArgs.h)||(myArgs.help)) {
- console.log(help);
- process.exit(0);
- }
-
- switch (myArgs._[0]) {
- case 'insult':
- console.log(myArgs.n || myArgs.name, 'smells quite badly.');
- break;
- case 'compliment':
- console.log(myArgs.n || myArgs.name, 'is really cool.');
- break;
- default:
- console.log(help);
- }
-
- console.log('myArgs: ', myArgs);
+```javascript
+var myArgs = require('optimist').argv,
+ help = 'This would be a great place for real help information.';
+
+if ((myArgs.h)||(myArgs.help)) {
+ console.log(help);
+ process.exit(0);
+}
+
+switch (myArgs._[0]) {
+ case 'insult':
+ console.log(myArgs.n || myArgs.name, 'smells quite badly.');
+ break;
+ case 'compliment':
+ console.log(myArgs.n || myArgs.name, 'is really cool.');
+ break;
+ default:
+ console.log(help);
+}
+
+console.log('myArgs: ', myArgs);
+```
The last line was included to let you see how Optimist handles your arguments. Here's a quick reference:

0 comments on commit f6b87f2

Please sign in to comment.