-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Mam-sDeveloper-ITMO/lab6
Lab 6 improvements
- Loading branch information
Showing
58 changed files
with
820 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +0,0 @@ | ||
### Roadmap | ||
|
||
- [ ] Add ability to create empty collection if file not specified and ask destination on saving | ||
|
||
- [ ] Better human string representation | ||
|
||
- [ ] Search command | ||
|
||
- [ ] PrintFields command | ||
|
||
- [ ] Handle Ctrl+C to skip command | ||
|
||
- [ ] Check all corner cases and bugs | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
CollectionManager/cliapp/src/main/java/cliapp/TextsManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package cliapp; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import textlocale.TextLocale; | ||
import textlocale.TextPackage; | ||
|
||
/** | ||
* Manager for texts resources. | ||
*/ | ||
public class TextsManager { | ||
/** | ||
* Current locale. | ||
*/ | ||
@Getter | ||
@Setter | ||
private static String locale = "en"; | ||
|
||
/** | ||
* Texts package. | ||
*/ | ||
@Getter | ||
private static TextPackage texts; | ||
|
||
/** | ||
* Static class. | ||
*/ | ||
private TextsManager() { | ||
} | ||
|
||
/** | ||
* Update texts. | ||
* | ||
* @throws Exception if an error occurs on package loading. | ||
*/ | ||
public static void updateTexts() throws Exception { | ||
TextsManager.texts = TextLocale.loadPackage("cliapp", () -> TextsManager.locale); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
CollectionManager/cliapp/src/main/java/cliapp/cliclient/exceptions/CommandNotFoundError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
package cliapp.cliclient.exceptions; | ||
|
||
import static textlocale.TextLocale._; | ||
|
||
import cliapp.TextsManager; | ||
import textlocale.TextSupplier; | ||
/** | ||
* Exception thrown when the CLI client cannot find a command by its trigger. | ||
*/ | ||
public class CommandNotFoundError extends Exception { | ||
static TextSupplier ts = TextsManager.getTexts().getPackage("cliclient.exceptions")::getText; | ||
|
||
/** | ||
* Constructs a new CommandNotFoundError with the specified trigger. | ||
* | ||
* @param trigger the trigger that was not found | ||
*/ | ||
public CommandNotFoundError(String trigger) { | ||
super(_("cliclient.cliclient.CommandNotFoundError").formatted(trigger)); | ||
super(ts.t("CommandNotFoundError", trigger)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.