Skip to content

Commit b2754e9

Browse files
authored
added test to verify help messages are complete, improve help messages (#318)
1 parent 5c95a79 commit b2754e9

File tree

6 files changed

+226
-153
lines changed

6 files changed

+226
-153
lines changed

cli/src/main/java/com/devonfw/tools/ide/nls/NlsBundle.java

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ public NlsBundle(IdeContext context, String name) {
2929
this(context, name, Locale.getDefault());
3030
}
3131

32+
/**
33+
* The constructor.
34+
*
35+
* @param context the {@link IdeContext}.
36+
* @param locale the explicit {@link Locale} to use.
37+
*/
38+
public NlsBundle(IdeContext context, Locale locale) {
39+
40+
this(context, "Help", locale);
41+
}
42+
3243
/**
3344
* The constructor.
3445
*
@@ -76,7 +87,7 @@ public String getOrNull(String key) {
7687
*/
7788
public String get(Commandlet commandlet) {
7889

79-
return get("cmd-" + commandlet.getName());
90+
return get("cmd." + commandlet.getName());
8091
}
8192

8293
/**
@@ -86,43 +97,30 @@ public String get(Commandlet commandlet) {
8697
*/
8798
public String get(Commandlet commandlet, Property<?> property) {
8899

89-
String prefix = "opt";
90-
String suffix = property.getNameOrAlias();
100+
String prefix = "opt.";
91101
if (property.isValue()) {
92-
prefix = "val";
93-
suffix = "-" + suffix;
102+
prefix = "val.";
94103
}
104+
String key = prefix + property.getNameOrAlias();
95105

96-
String key = prefix + "-" + commandlet.getName() + suffix;
97-
String value = getOrNull(key);
106+
String qualifiedKey = "cmd." + commandlet.getName() + "." + key;
107+
String value = getOrNull(qualifiedKey);
98108
if (value == null) {
99-
value = getOrNull(prefix + suffix); // fallback to share messages across commandlets
109+
value = getOrNull(key); // fallback to share messages across commandlets
100110
if (value == null) {
101111
value = get(key); // will fail to resolve but we want to reuse the code
102112
}
103113
}
104114
return value;
105115
}
106116

107-
/**
108-
* @param commandlet the {@link com.devonfw.tools.ide.commandlet.Commandlet#getName() name} of the
109-
* {@link com.devonfw.tools.ide.commandlet.Commandlet}.
110-
* @param value the {@link com.devonfw.tools.ide.property.Property#getNameOrAlias() name or alias} of the
111-
* {@link com.devonfw.tools.ide.property.Property#isValue() value}.
112-
* @return the localized message (translated to the users language).
113-
*/
114-
public String getValue(String commandlet, String value) {
115-
116-
return get("val-" + value);
117-
}
118-
119117
/**
120118
* @param context the {@link IdeContext}.
121119
* @return the {@link NlsBundle} for "Cli".
122120
*/
123121
public static NlsBundle of(IdeContext context) {
124122

125-
return new NlsBundle(context, "Ide", context.getLocale());
123+
return new NlsBundle(context, context.getLocale());
126124
}
127125

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

cli/src/main/resources/nls/Ide.properties

Lines changed: 0 additions & 65 deletions
This file was deleted.

cli/src/main/resources/nls/Ide_de.properties

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)