Skip to content

Commit

Permalink
Save name in configuration and print it instead of code when changing…
Browse files Browse the repository at this point in the history
… default currency
  • Loading branch information
knutkirkhorn committed Jun 19, 2019
1 parent b25807a commit 0df63cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const spinner = new Ora();

const defaultConfiguration = {
default: {
name: "United States Dollar",
code: "USD",
symbol: "$"
},
Expand Down Expand Up @@ -150,6 +151,7 @@ function checkAllFlags() {
const newConfig = JSON.stringify(
{
default: {
name: defaultCurrency.name,
code: defaultCurrency.code,
symbol: defaultCurrency.symbol
},
Expand All @@ -161,7 +163,7 @@ function checkAllFlags() {
if (error) {
exitError('Something wrong happened, could not save new default currency.');
} else {
console.log(chalk.green(`${logSymbols.success} Default currency set to: ${defaultCurrency.code} (${defaultCurrency.symbol})`));
console.log(chalk.green(`${logSymbols.success} Default currency set to: ${defaultCurrency.name} (${defaultCurrency.symbol})`));
}
});
}
Expand All @@ -177,6 +179,7 @@ function checkAllFlags() {
const newConfig = JSON.stringify(
{
default: {
name: defaultCurrency.name,
code: defaultCurrency.code,
symbol: defaultCurrency.symbol
},
Expand Down Expand Up @@ -287,7 +290,7 @@ if (cli.flags.r) {
if (error) {
exitError('Something wrong happened, could not save new default currency.');
} else {
console.log(chalk.green(`${logSymbols.success} Default configuration reset to: ${defaultConfiguration.default.code} (${defaultConfiguration.default.symbol})`));
console.log(chalk.green(`${logSymbols.success} Default configuration reset to: ${defaultConfiguration.default.name} (${defaultConfiguration.default.symbol})`));
}

process.exit(0);
Expand Down
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"default": {
"name": "United States Dollar",
"code": "USD",
"symbol": "$"
},
Expand Down

0 comments on commit 0df63cc

Please sign in to comment.