Skip to content

Commit ff6336d

Browse files
author
Juhyung Park
committed
Make output format easy to pipe
1 parent fcd8d19 commit ff6336d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/index.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ async function main(action: string, option: Option) {
5959
getAddressFromPublic(accountType, publicKey)
6060
);
6161
if (keys.length === 0) {
62-
console.log("There is no keys saved.");
62+
console.log("");
6363
} else {
64-
console.log(`Current saved keys are ${_.join(keys, ",")}`);
64+
console.log(_.join(keys, "\n"));
6565
}
6666
break;
6767
case "create":
@@ -70,12 +70,11 @@ async function main(action: string, option: Option) {
7070
const publicKey = await cckey[accountType].createKey({
7171
passphrase
7272
});
73-
console.log("Account created!");
7473
console.log(
75-
`Address is ${getAddressFromPublic(
74+
getAddressFromPublic(
7675
accountType,
7776
publicKey
78-
)}`
77+
)
7978
);
8079
}
8180
break;
@@ -91,11 +90,10 @@ async function main(action: string, option: Option) {
9190
const result = await cckey[accountType].deleteKey({
9291
publicKey
9392
});
94-
95-
if (result) {
96-
console.log("Account removed");
97-
} else {
98-
console.log("Account not removed");
93+
if (!result) {
94+
throw new CLIError(CLIErrorType.Unknown, {
95+
message: "Delete failed"
96+
});
9997
}
10098
}
10199
break;

0 commit comments

Comments
 (0)