-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Showing
2 changed files
with
86 additions
and
59 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 |
---|---|---|
@@ -1,40 +1,62 @@ | ||
const chalk = require('chalk'); | ||
const pkg = require('../package.json'); | ||
|
||
const helpers = argv => { | ||
// Version | ||
if (argv.indexOf('--version') !== -1 || argv.indexOf('-v') !== -1) { | ||
version(); | ||
} | ||
|
||
// Help | ||
if (argv.indexOf('--help') !== -1 || argv.indexOf('-h') !== -1 || !argv.length) { | ||
help(); | ||
} | ||
}; | ||
|
||
const version = () => { | ||
console.log(pkg.version); | ||
process.exit(1); | ||
}; | ||
|
||
const help = () => { | ||
console.log(chalk.yellow(` | ||
Usage: | ||
Usage: | ||
$ cash <amount> <currency> | ||
$ cash <command> | ||
$ cash <amount> <currency> | ||
Commands: | ||
--help Display help message | ||
--version Display version number | ||
Some currencies: usd, pln, rub, aud, chf, eur | ||
Currencies: | ||
• usd | ||
• pln | ||
• rub | ||
• aud | ||
• chf | ||
• eur | ||
• bgn | ||
• jpy | ||
• cad | ||
• try | ||
• mxn | ||
Examples: | ||
Full list of currencies: http://akep.us/currencies | ||
$ cash 1 usd | ||
Examples: | ||
or | ||
$ cash 1 usd | ||
$ cash 1 usd eur pln aud | ||
$ cash 1 usd eur pln aud | ||
$ cash --help | ||
Cash CLI comes with no warranty. | ||
The rates are updated daily around 4PM CET every working day. | ||
`)); | ||
process.exit(1); | ||
}; | ||
|
||
const helpers = argv => { | ||
// Version | ||
if (argv.indexOf('--version') !== -1 || argv.indexOf('-v') !== -1) { | ||
version(); | ||
} | ||
|
||
// Help | ||
if (argv.indexOf('--help') !== -1 || argv.indexOf('-h') !== -1 || !argv.length) { | ||
help(); | ||
} | ||
}; | ||
|
||
module.exports = helpers; |
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 |
---|---|---|
@@ -1,41 +1,46 @@ | ||
{ | ||
"name": "cash-cli", | ||
"version": "1.2.8", | ||
"description": "Exchange Rates Online using your terminal!", | ||
"author": { | ||
"name": "Anthony Kepinski", | ||
"email": "[email protected]", | ||
"url": "https://akepinski.me" | ||
}, | ||
"license": "MIT", | ||
"repository": "https://github.com/xxczaki/cash-cli", | ||
"bugs": { | ||
"url": "https://github.com/xxczaki/cash-cli/issues" | ||
}, | ||
"homepage": "https://github.com/xxczaki/cash-cli", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"bin": { | ||
"cash": "./bin/index.js" | ||
}, | ||
"keywords": [ | ||
"cli", | ||
"currency", | ||
"exchange", | ||
"rates", | ||
"convert", | ||
"cash" | ||
], | ||
"dependencies": { | ||
"chalk": "^2.3.0", | ||
"got": "^6.5.0", | ||
"money": "^0.2.0", | ||
"ora": "^1.3.0" | ||
}, | ||
"devDependencies": { | ||
"xo": "^0.18.2", | ||
"ava": "^0.20.0" | ||
} | ||
} | ||
"name": "cash-cli", | ||
"version": "1.3.6", | ||
"description": "Exchange Rates Online using your terminal!", | ||
"author": { | ||
"name": "Anthony Kepinski", | ||
"email": "[email protected]", | ||
"url": "https://akepinski.me" | ||
}, | ||
"license": "MIT", | ||
"repository": "https://github.com/xxczaki/cash-cli", | ||
"bugs": { | ||
"url": "https://github.com/xxczaki/cash-cli/issues" | ||
}, | ||
"homepage": "https://github.com/xxczaki/cash-cli", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"xo": { | ||
"rules": { | ||
"unicorn/no-process-exit": 0 | ||
} | ||
}, | ||
"bin": { | ||
"cash": "./bin/index.js" | ||
}, | ||
"keywords": [ | ||
"cli", | ||
"currency", | ||
"exchange", | ||
"rates", | ||
"convert", | ||
"cash" | ||
], | ||
"dependencies": { | ||
"chalk": "^2.3.0", | ||
"got": "^6.5.0", | ||
"money": "^0.2.0", | ||
"ora": "^1.3.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.20.0", | ||
"xo": "^0.18.2" | ||
} | ||
} |