Skip to content

Commit 8e1192a

Browse files
committed
fix: target bug on cli options
1 parent 1e7c661 commit 8e1192a

File tree

6 files changed

+24
-13
lines changed

6 files changed

+24
-13
lines changed

bin/jsontt

100644100755
File mode changed.

makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,29 @@ run-win:
22
yarn
33
npm link
44

5-
cli-d:
5+
cli-d-win:
66
del /f "C:\Program Files\nodejs\jsontt"
77
del /f "C:\Program Files\nodejs\jsontt.cmd"
88

9+
cli-d-mac:
10+
sudo rm -rf /usr/local/bin/jsontt
11+
912
run-only-cli:
1013
yarn
1114
tsdx build
1215
npm link
1316
jsontt
1417

15-
run-cli:
16-
make cli-d
18+
run-cli-win:
19+
make cli-d-win
1720
yarn
1821
tsdx build
1922
npm link
23+
jsontt
24+
25+
run-cli-mac:
26+
make cli-d-mac
27+
sudo yarn
28+
sudo tsdx build
29+
sudo npm link
2030
jsontt

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.7.0",
2+
"version": "1.8.0",
33
"license": "MIT",
44
"main": "dist/index.js",
55
"description": "Translate your JSON file or object into another languages with Google Translate API",
@@ -88,4 +88,4 @@
8888
"inquirer": "^7.0.0",
8989
"loading-cli": "^1.1.0"
9090
}
91-
}
91+
}

src/cli/cli.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { listIOS, Sources, TRANSLATE_POSTFIX, translatorsNames } from '..';
1+
import { getLanguages, Sources, TRANSLATE_POSTFIX, translatorsNames } from '..';
22
import { fileTranslator, getFileFromPath } from '../core/json_file';
33
import {
44
error,
@@ -25,6 +25,7 @@ export async function initializeCli() {
2525
global.totalTranslated = 0;
2626
global.proxyIndex = 0;
2727
global.proxyList = [];
28+
2829
program
2930
.version(current_version)
3031
.addHelpText('beforeAll', messages.cli.welcome)
@@ -103,8 +104,8 @@ async function translate() {
103104
);
104105
// Restore source name after splitting it for "translatorsNames" variable
105106
global.source = [
106-
capitalize(translator as string),
107-
TRANSLATE_POSTFIX
107+
capitalize(translator as string),
108+
TRANSLATE_POSTFIX,
108109
].join('') as Sources;
109110
} else {
110111
error(`${messages.cli.translator_not_available}`);
@@ -124,6 +125,8 @@ async function translate() {
124125
let sourceLanguageISO: string;
125126
let targetLanguageISOs: string[];
126127

128+
const listIOS = Object.values(getLanguages() as any); // get list after assigning global.source
129+
127130
if (!sourceLanguageInput) {
128131
const { from } = await promptFrom();
129132
sourceLanguageISO = getCodeFromLanguage(from);

src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export enum Sources {
4444
global.source = Sources.GoogleTranslate;
4545

4646
// Use postfix just for compatability, when Sources enum values used somewhere else.
47-
export const TRANSLATE_POSTFIX = 'Translate'
47+
export const TRANSLATE_POSTFIX = 'Translate';
4848
export const translatorsNames = Object.values(Sources).map(s =>
4949
s.split(TRANSLATE_POSTFIX)[0].toLowerCase()
5050
);
@@ -344,5 +344,3 @@ enum BingTranslateLanguages {
344344
}
345345

346346
export const languages = GoogleTranslateLanguages;
347-
348-
export const listIOS = Object.values(getLanguages() as any);

src/utils/console.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export const messages = {
4242
cli: {
4343
welcome: `\nWelcome to the\n${success_color +
4444
figlet.textSync(
45-
'json-translator'
46-
)}\x1b[0m\n\t\t\t\t\t\t\t\tcli ${current_version}\n`,
45+
'jsontt'
46+
)}\x1b[0m\n\t\t\t\tcli ${current_version}\n`,
4747
description:
4848
'This package will provide you the ability to translate your JSON files or objects into different languages for free.',
4949
usage: ` <your/path/to/file.json>`,

0 commit comments

Comments
 (0)