Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Commit 4ab2258

Browse files
committed
Print available languages if key not found
1 parent 31fa17c commit 4ab2258

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

cli.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function ShowHelp() {
3434
chalk.white.bold("\nGitCheats CLI - A Companion For GitCheats\n")
3535
);
3636
console.log(chalk.white.bold("Commands:"));
37-
console.log("gitcheats".padEnd(39) + "Launch gitcheats.com directly");
37+
console.log("gitcheats".padEnd(39) + "Open gitcheats.com in browser");
3838
console.log(
3939
"gitcheats " +
4040
chalk.yellow("[command]").padEnd(39) +
@@ -44,13 +44,13 @@ function ShowHelp() {
4444
"gitcheats " +
4545
chalk.green("-o --open") +
4646
chalk.yellow(" [command]").padEnd(30) +
47-
"Launch gitcheats.com in browser with your command filtered"
47+
"Open gitcheats.com in browser with your command filtered"
4848
);
4949
console.log(
5050
"gitcheats " +
5151
chalk.green("-l --language") +
5252
chalk.yellow(" [key]").padEnd(26) +
53-
"Set your preffered language (Options: en, tr, tel, hin, kli)"
53+
"Set your preffered language (Default: en)"
5454
);
5555
console.log(
5656
"gitcheats " + chalk.green("-h --help").padEnd(39) + "Display this help"
@@ -83,7 +83,8 @@ function FetchCommand(cmd) {
8383
spinner.fail("Command " + chalk.red(cmd) + " not found in gitcheats.com");
8484
spinner.info(
8585
chalk.gray(
86-
"If gitcheats is missing a command, please consider contributing https://github.com/excalith/Git-Cheats"
86+
"If gitcheats is missing a command, please consider contributing " +
87+
chalk.blue("https://github.com/excalith/Git-Cheats")
8788
)
8889
);
8990
} else {
@@ -116,12 +117,12 @@ function SetLanguage(key) {
116117
console.log("\n");
117118

118119
if (data == null) {
119-
spinner.fail("Language not found!");
120-
spinner.info(
121-
chalk.gray(
122-
"Please add your language by contributing to https://github.com/excalith/Git-Cheats"
123-
)
124-
);
120+
spinner.fail("Language not found. Available languages:");
121+
Object.keys(json.settings.languages).forEach(function(key) {
122+
console.log(
123+
key.padStart(4) + ": ".padStart(5) + json.settings.languages[key]
124+
);
125+
});
125126
} else {
126127
conf.set("lang", key);
127128
spinner.succeed("Language set to " + data + "\n");
@@ -154,7 +155,7 @@ function LaunchBrowser(hasCommand) {
154155
console.log(
155156
chalk.white.bold(
156157
"Launching " +
157-
chalk.yellow(command) +
158+
chalk.green(command) +
158159
" on " +
159160
chalk.blue("http://gitcheats.com")
160161
)

0 commit comments

Comments
 (0)