Skip to content

Commit

Permalink
added test to verify help messages are complete, improve help messages (
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille authored May 17, 2024
1 parent 5c95a79 commit b2754e9
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 153 deletions.
40 changes: 19 additions & 21 deletions cli/src/main/java/com/devonfw/tools/ide/nls/NlsBundle.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ public NlsBundle(IdeContext context, String name) {
this(context, name, Locale.getDefault());
}

/**
* The constructor.
*
* @param context the {@link IdeContext}.
* @param locale the explicit {@link Locale} to use.
*/
public NlsBundle(IdeContext context, Locale locale) {

this(context, "Help", locale);
}

/**
* The constructor.
*
Expand Down Expand Up @@ -76,7 +87,7 @@ public String getOrNull(String key) {
*/
public String get(Commandlet commandlet) {

return get("cmd-" + commandlet.getName());
return get("cmd." + commandlet.getName());
}

/**
Expand All @@ -86,43 +97,30 @@ public String get(Commandlet commandlet) {
*/
public String get(Commandlet commandlet, Property<?> property) {

String prefix = "opt";
String suffix = property.getNameOrAlias();
String prefix = "opt.";
if (property.isValue()) {
prefix = "val";
suffix = "-" + suffix;
prefix = "val.";
}
String key = prefix + property.getNameOrAlias();

String key = prefix + "-" + commandlet.getName() + suffix;
String value = getOrNull(key);
String qualifiedKey = "cmd." + commandlet.getName() + "." + key;
String value = getOrNull(qualifiedKey);
if (value == null) {
value = getOrNull(prefix + suffix); // fallback to share messages across commandlets
value = getOrNull(key); // fallback to share messages across commandlets
if (value == null) {
value = get(key); // will fail to resolve but we want to reuse the code
}
}
return value;
}

/**
* @param commandlet the {@link com.devonfw.tools.ide.commandlet.Commandlet#getName() name} of the
* {@link com.devonfw.tools.ide.commandlet.Commandlet}.
* @param value the {@link com.devonfw.tools.ide.property.Property#getNameOrAlias() name or alias} of the
* {@link com.devonfw.tools.ide.property.Property#isValue() value}.
* @return the localized message (translated to the users language).
*/
public String getValue(String commandlet, String value) {

return get("val-" + value);
}

/**
* @param context the {@link IdeContext}.
* @return the {@link NlsBundle} for "Cli".
*/
public static NlsBundle of(IdeContext context) {

return new NlsBundle(context, "Ide", context.getLocale());
return new NlsBundle(context, context.getLocale());
}

}
68 changes: 68 additions & 0 deletions cli/src/main/resources/nls/Help.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
cmd.--version=Print the version of IDEasy.
cmd.aws=Tool commandlet for AWS CLI.
cmd.az=Tool commandlet for Azure CLI.
cmd.cobigen=Tool commandlet for Cobigen (code-generator).
cmd.complete=Internal commandlet for bash auto-completion.
cmd.create=Create a new IDEasy project.
cmd.create.val.project=The name of the new project that will be created.
cmd.docker=Tool commandlet for Docker.
cmd.dotnet=Tool commandlet for dotnet.
cmd.eclipse=Tool commandlet for Eclipse (IDE).
cmd.env=Print the environment variables to set and export.
cmd.env.opt.--bash=Convert Windows path syntax to bash for usage in git-bash.
cmd.gcviewer=Tool commandlet for GC Viewer (View garbarge collector logs of Java).
cmd.get-edition=Get the edition of the selected tool.
cmd.get-version=Get the version of the selected tool.
cmd.gh=Tool commandlet for GitHub CLI.
cmd.graalvm=Tool commandlet for GraalVm (Java with native-image).
cmd.gradle=Tool commandlet for Gradle (Build-Tool).
cmd.helm=Tool commandlet for Helm (Kubernetes Package Manager).
cmd.help=Prints this help.
cmd.install=Install the selected tool.
cmd.intellij=Tool commandlet for IntelliJ (IDE)
cmd.jasypt=Tool commandlet for Jasypt (encryption/decryption).
cmd.jasypt.val.command=Modues (encrypt | decrypt)
cmd.jasypt.val.masterPassword=master password.
cmd.jasypt.val.secret=The secret to be encrypted or decrypted.
cmd.java=Tool commandlet for Java (OpenJDK).
cmd.jmc=Tool commandlet for JDK Mission Control (performance analysis).
cmd.kotlinc=Tool commandlet for Kotlin (compiler for JRE language).
cmd.kotlincnative=Tool commandlet for Kotlin-Native (compiler for JRE language).
cmd.list-editions=List the available editions of the selected tool.
cmd.list-versions=List the available versions of the selected tool.
cmd.mvn=Tool commandlet for Maven (Build-Tool).
cmd.node=Tool commandlet for Node.js (JavaScript runtime).
cmd.npm=Tool commandlet for Npm (JavaScript Node Package Manager).
cmd.oc=Tool commandlet for Openshift CLI (Kubernetes management tool).
cmd.quarkus=Tool commandlet for Quarkus (framework for cloud-native apps).
cmd.repository=Setup pre-configured git repositories (clone, build, import).
cmd.repository.val.repository=The name of the properties file of the pre-configured git repository to setup, omit to setup all active repositories.
cmd.set-edition=Set the edition of the selected tool.
cmd.set-version=Set the version of the selected tool.
cmd.set-version.val.version=The tool version to set.
cmd.shell=Commandlet to start built-in shell with advanced auto-completion.
cmd.sonar=Tool commandlet for SonarQube.
cmd.sonar.val.command=Action to perform (START|STOP|ANALYZE)
cmd.terraform=Tool commandlet for Terraform.
cmd.uninstall=Uninstall the selected tool.
cmd.update=Pull your settings and apply updates (software, configuration and repositories).
cmd.vscode=Tool commandlet for Visual Studio Code (IDE).
commandlets=Available commandlets:
opt.--batch=enable batch mode (non-interactive).
opt.--debug=enable debug logging.
opt.--force=enable force mode.
opt.--locale=the locale (e.g. '--locale=de' for German language).
opt.--offline=enable offline mode (skip updates or git pull, fail downloads or git clone).
opt.--quiet=disable info logging (only log success, warning or error).
opt.--trace=enable trace logging.
opt.--version=Print the IDE version and exit.
options=Options:
usage=Usage:
val.args=The commandline arguments to pass to the tool.
val.commandlet=The selected commandlet (use "ide help" to list all commandlets).
val.edition=The tool edition.
val.settingsRepository=The settings git repository with the IDEasy configuration for the project.
val.tool=The tool commandlet to select.
val.version=The tool version.
values=Values:
version-banner=Current version of IDE is {}
68 changes: 68 additions & 0 deletions cli/src/main/resources/nls/Help_de.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
cmd.--version=Gibt die Version von IDEasy aus.
cmd.aws=Werkzeug Kommando für AWS Kommandoschnittstelle.
cmd.az=Werkzeug Kommando für Azure Kommandoschnittstelle.
cmd.cobigen=Werkzeug Kommando für Cobigen.
cmd.complete=Internes Werkzeug für bash Autovervollständigung.
cmd.create=Erstellt ein neues IDEasy Projekt.
cmd.create.val.project=Der Name des zu erstellenden Projekts.
cmd.docker=Werkzeug Kommando für Docker.
cmd.dotnet=Werkzeug Kommando für dotnet Kommandoschnittstelle.
cmd.eclipse=Werkzeug Kommando für Eclipse (IDE).
cmd.env=Gibt die zu setzenden und exportierenden Umgebungsvariablen aus.
cmd.env.opt.--bash=Konvertiert Windows-Pfad-Syntax nach Bash zur Verwendung in git-bash.
cmd.gcviewer=Werkzeug Kommando für GC Viewer (Anzeige von Garbage-Collector Logs von Java).
cmd.get-edition=Zeigt die Edition des selektierten Werkzeugs an.
cmd.get-version=Zeigt die Version des selektierten Werkzeugs an.
cmd.gh=Werkzeug Kommando für die Github Kommandoschnittstelle.
cmd.graalvm=Werkzeug Kommando für GraalVm.
cmd.gradle=Werkzeug Kommando für Gradle (Build-Tool).
cmd.helm=Werkzeug Kommando für Helm (Kubernetes Package Manager).
cmd.help=Zeigt diese Hilfe an.
cmd.install=Installiert das selektierte Werkzeug.
cmd.intellij=Werkzeug Kommando für Intellij (IDE)
cmd.jasypt=Werkzeug Kommando für Jasypt.
cmd.jasypt.val.command=Mode (encrypt | decrypt)
cmd.jasypt.val.masterPassword=master Passwort.
cmd.jasypt.val.secret=Das zu verschlüsselnde oder zu entschlüsselnde Geheimnis.
cmd.java=Werkzeug Kommando für Java (OpenJDK).
cmd.jmc=Werkzeug Kommando für JDK Mission Control (Performance Analyse).
cmd.kotlinc=Werkzeug Kommando für Kotlin (Compiler für JRE Sprache).
cmd.kotlincnative=Werkzeug Kommando für Kotlin-Native (Compiler für JRE Sprache).
cmd.list-editions=Listet die verfügbaren Editionen des selektierten Werkzeugs auf.
cmd.list-versions=Listet die verfügbaren Versionen des selektierten Werkzeugs auf.
cmd.mvn=Werkzeug Kommando für Maven (Build-Werkzeug).
cmd.node=Werkzeug Kommando für Node.js (JavaScript Laufzeitumgebung).
cmd.npm=Werkzeug Kommando für Npm (JavaScript Node Package Manager).
cmd.oc=Werkzeug Kommando für Openshift CLI (Kubernetes Management Tool).
cmd.quarkus=Werkzeug Kommando für Quarkus (Framework für Cloud-native Anwendungen).
cmd.repository=Richtet das vorkonfigurierte Git Repository ein.
cmd.repository.val.repository=Der Name der Properties-Datei des vorkonfigurierten Git Repositories zum Einrichten. Falls nicht angegeben, werden alle aktiven Projekte eingerichtet.
cmd.set-edition=Setzt die Edition des selektierten Werkzeugs.
cmd.set-version=Setzt die Version des selektierten Werkzeugs.
cmd.set-version.val.version=Die zu setzende Werkzeug Version.
cmd.shell=Kommando zum Starten der integrierten Shell mit erweiterter Autovervollständigung.
cmd.sonar=Werkzeug Kommando für SonarQube.
cmd.sonar.val.command=Auszuführende Aktion (START|STOP|ANALYZE)
cmd.terraform=Werkzeug Kommando für Terraform.
cmd.uninstall=Deinstalliert das ausgewählte Werkzeug.
cmd.update=Updatet die Settings, Software und Repositories.
cmd.vscode=Werkzeug Kommando für Visual Studio Code (IDE).
commandlets=Verfügbare Kommandos:
opt.--batch=Aktiviert den Batch-Modus (nicht-interaktive Stapelverarbeitung).
opt.--debug=Aktiviert Debug-Ausgaben (Fehleranalyse).
opt.--force=Aktiviert den Force-Modus (Erzwingen).
opt.--locale=Die Spracheinstellungen (z.B. 'en' für Englisch).
opt.--offline=Aktiviert den Offline-Modus (Überspringt Aktualisierungen oder git pull, schlägt fehl bei Downloads or git clone).
opt.--quiet=Deaktiviert Info Logging ( nur success, warning und error).
opt.--trace=Aktiviert Trace-Ausgaben (detaillierte Fehleranalyse).
opt.--version=Zeigt die IDE Version an und beendet das Programm.
options=Optionen:
usage=Verwendung:
val.args=Die Kommandozeilen-Argumente zur Übergabe an das Werkzeug.
val.commandlet=Das ausgewählte Commandlet ("ide help" verwenden, um alle Commandlets aufzulisten).
val.edition=Die Werkzeug Edition.
val.settingsRepository=Das settings git Repository mit den IDEasy Einstellungen für das Projekt.
val.tool=Das zu selektierende Werkzeug Kommando.
val.version=Die Werkzeug Version.
values=Werte:
version-banner=Die aktuelle Version der IDE ist {}.
65 changes: 0 additions & 65 deletions cli/src/main/resources/nls/Ide.properties

This file was deleted.

65 changes: 0 additions & 65 deletions cli/src/main/resources/nls/Ide_de.properties

This file was deleted.

Loading

0 comments on commit b2754e9

Please sign in to comment.