diff --git a/README.md b/README.md index bf01a05..6250ff5 100644 --- a/README.md +++ b/README.md @@ -1,71 +1 @@ -## langsync - -![coverage][coverage_badge] -[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link] -[![License: MIT][license_badge]][license_link] - -Generated by the [Very Good CLI][very_good_cli_link] 🤖 - -A Very Good Project created by Very Good CLI.. - ---- - -## Getting Started 🚀 - -If the CLI application is available on [pub](https://pub.dev), activate globally via: - -```sh -dart pub global activate langsync -``` - -Or locally via: - -```sh -dart pub global activate --source=path -``` - -## Usage - -```sh -# Sample command -$ langsync sample - -# Sample command option -$ langsync sample --cyan - -# Show CLI version -$ langsync --version - -# Show usage help -$ langsync --help -``` - -## Running Tests with coverage 🧪 - -To run all unit tests use the following command: - -```sh -$ dart pub global activate coverage 1.2.0 -$ dart test --coverage=coverage -$ dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info -``` - -To view the generated coverage report you can use [lcov](https://github.com/linux-test-project/lcov) -. - -```sh -# Generate Coverage Report -$ genhtml coverage/lcov.info -o coverage/ - -# Open Coverage Report -$ open coverage/index.html -``` - ---- - -[coverage_badge]: coverage_badge.svg -[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg -[license_link]: https://opensource.org/licenses/MIT -[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg -[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis -[very_good_cli_link]: https://github.com/VeryGoodOpenSource/very_good_cli \ No newline at end of file +// TODO: add confirmation to logout command. \ No newline at end of file diff --git a/bin/langsync.exe b/bin/langsync.exe new file mode 100644 index 0000000..b46dd83 Binary files /dev/null and b/bin/langsync.exe differ diff --git a/example/locales/ar.json b/example/locales/ar.json new file mode 100644 index 0000000..b82805c --- /dev/null +++ b/example/locales/ar.json @@ -0,0 +1,3 @@ +{ + "مرحبًا": "مرحبًا يا صديقي" +} \ No newline at end of file diff --git a/example/locales/de.json b/example/locales/de.json new file mode 100644 index 0000000..a781c4f --- /dev/null +++ b/example/locales/de.json @@ -0,0 +1,3 @@ +{ + "hallo": "hallo mein Freund" +} \ No newline at end of file diff --git a/example/locales/fr.json b/example/locales/fr.json new file mode 100644 index 0000000..04a556e --- /dev/null +++ b/example/locales/fr.json @@ -0,0 +1,3 @@ +{ + "hello": "bonjour mon ami" +} \ No newline at end of file diff --git a/langsync.yaml b/langsync.yaml index 52d58d7..36e86a4 100644 --- a/langsync.yaml +++ b/langsync.yaml @@ -4,4 +4,4 @@ langsync: output: './example/locales' - target: [ge, zh, es] + target: [fr, de, ar, de, zh] diff --git a/lib/src/commands/account_command/sub_commands/logout_command.dart b/lib/src/commands/account_command/sub_commands/logout_command.dart index dbffccd..56e75be 100644 --- a/lib/src/commands/account_command/sub_commands/logout_command.dart +++ b/lib/src/commands/account_command/sub_commands/logout_command.dart @@ -27,6 +27,16 @@ class LogoutCommand extends Command { return ExitCode.success.code; } else { + final confirm = await logger.confirm( + 'Are you sure you want to logout from the current account?', + ); + + if (!confirm) { + logger.info('Logout aborted.'); + + return ExitCode.success.code; + } + final logoutProgress = logger.customProgress('Logging out from the account..'); diff --git a/lib/src/commands/config_command/sub_commands/create_command.dart b/lib/src/commands/config_command/sub_commands/create_command.dart index e8b4a55..bbcbde5 100644 --- a/lib/src/commands/config_command/sub_commands/create_command.dart +++ b/lib/src/commands/config_command/sub_commands/create_command.dart @@ -41,18 +41,16 @@ class ConfigCreateCommand extends Command { } Future _requestToOverwrite(File file) async { - final userAnswer = logger.prompt('Do you want to overwrite it? (Y/n)'); + final confirmOverwrite = logger.confirm('Do you want to overwrite it?'); - final toL = userAnswer.toLowerCase(); - - if (utils.isConsideredTrue(toL)) { + if (confirmOverwrite) { final deleteLogger = logger.customProgress('Deleting the existant langsync.yaml file'); await file.delete(); deleteLogger.complete( - 'The already existing langsync.yaml file is deleted succesfully'); + 'The already existing langsync.yaml file is deleted successfully'); return run(); } else { @@ -84,12 +82,11 @@ class ConfigCreateCommand extends Command { final outputDirectory = Directory(outputDir); if (!outputDirectory.existsSync()) { - final createDirAnswer = logger.prompt( + final confirmOverwrite = logger.confirm( '''The output directory at $outputDir does not exist, do you want to create it? (Y/n)''', ); - final toL = createDirAnswer.toLowerCase(); - if (utils.isConsideredTrue(toL)) { + if (confirmOverwrite) { final createDirProgress = logger.customProgress('Creating the output directory'); @@ -143,7 +140,7 @@ class ConfigCreateCommand extends Command { await YamlController.iterateAndWriteToConfigFile(config); creationProgress.complete( - 'langsync.yaml file created & updated with your config succesfully.', + 'langsync.yaml file created & updated with your config successfully.', ); return ExitCode.success.code; diff --git a/lib/src/commands/start_command/start_command.dart b/lib/src/commands/start_command/start_command.dart index 1abcc1a..70e4bfd 100644 --- a/lib/src/commands/start_command/start_command.dart +++ b/lib/src/commands/start_command/start_command.dart @@ -81,7 +81,7 @@ class StartCommand extends Command { ); savingSourceFileProgress - .complete('Your source file has been saved succesfully.'); + .complete('Your source file has been saved successfully.'); logger // ..info("\n") @@ -176,9 +176,9 @@ class StartCommand extends Command { .convert(current.jsonFormattedResponse), ); - progress.complete('file $fileName is created succesfully, ${file.path}'); + progress.complete('file $fileName is created successfully, ${file.path}'); } - logger.success('All files are created succesfully.'); + logger.success('All files are created successfully.'); } } diff --git a/lib/src/etc/utils.dart b/lib/src/etc/utils.dart index 64f59bb..9bac8fb 100644 --- a/lib/src/etc/utils.dart +++ b/lib/src/etc/utils.dart @@ -59,7 +59,7 @@ class Utils { } String endpoint(String path) { - return 'http://192.168.1.103:5559${path.startsWith("/") ? path : "/$path"}'; + return 'http://192.168.0.3:5559${path.startsWith("/") ? path : "/$path"}'; } List randomLoadingFrames() { @@ -91,11 +91,11 @@ class Utils { }); } - bool isConsideredTrue(String answer) { - return answer == 'y' || - answer == 'yes' || - answer == 'yep' || - answer == 'yeah' || - answer == 'true'; - } + // bool isConsideredTrue(String answer) { + // return answer == 'y' || + // answer == 'yes' || + // answer == 'yep' || + // answer == 'yeah' || + // answer == 'true'; + // } }