@qodalis/cli 2.0.0-beta.18 → 2.0.0-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qodalis/cli",
3
- "version": "2.0.0-beta.18",
3
+ "version": "2.0.0-beta.19",
4
4
  "description": "Framework-agnostic CLI engine for @qodalis terminal applications.",
5
5
  "author": "Nicolae Lupei, Qodalis Solutions",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "./assets/*": "./assets/*"
31
31
  },
32
32
  "dependencies": {
33
- "@qodalis/cli-core": "2.0.0-beta.18",
33
+ "@qodalis/cli-core": "2.0.0-beta.19",
34
34
  "@xterm/xterm": "^5.5.0",
35
35
  "@xterm/addon-fit": "^0.10.0",
36
36
  "@xterm/addon-web-links": "^0.11.0",
package/public-api.d.mts CHANGED
@@ -165,7 +165,7 @@ declare const CliKeyValueStore_TOKEN: any;
165
165
  */
166
166
  declare const SyntaxHighlighterRegistry_TOKEN: any;
167
167
 
168
- declare const LIBRARY_VERSION = "2.0.0-beta.18";
168
+ declare const LIBRARY_VERSION = "2.0.0-beta.19";
169
169
  declare const API_VERSION = 2;
170
170
 
171
171
  declare class CliAliasCommandProcessor implements ICliCommandProcessor {
@@ -823,6 +823,11 @@ declare class CliConfigureCommandProcessor implements ICliCommandProcessor {
823
823
  private editOption;
824
824
  private setConfigValue;
825
825
  private getConfigValue;
826
+ /**
827
+ * The language choices are the locales loaded so far: a language pack
828
+ * installed after boot (`pkg add @qodalis/cli-lang-de`) adds one.
829
+ */
830
+ private refreshLanguageOptions;
826
831
  private getAllOptions;
827
832
  /**
828
833
  * @param onBoot at startup, terminal options still at their default are skipped so the
package/public-api.d.ts CHANGED
@@ -165,7 +165,7 @@ declare const CliKeyValueStore_TOKEN: any;
165
165
  */
166
166
  declare const SyntaxHighlighterRegistry_TOKEN: any;
167
167
 
168
- declare const LIBRARY_VERSION = "2.0.0-beta.18";
168
+ declare const LIBRARY_VERSION = "2.0.0-beta.19";
169
169
  declare const API_VERSION = 2;
170
170
 
171
171
  declare class CliAliasCommandProcessor implements ICliCommandProcessor {
@@ -823,6 +823,11 @@ declare class CliConfigureCommandProcessor implements ICliCommandProcessor {
823
823
  private editOption;
824
824
  private setConfigValue;
825
825
  private getConfigValue;
826
+ /**
827
+ * The language choices are the locales loaded so far: a language pack
828
+ * installed after boot (`pkg add @qodalis/cli-lang-de`) adds one.
829
+ */
830
+ private refreshLanguageOptions;
826
831
  private getAllOptions;
827
832
  /**
828
833
  * @param onBoot at startup, terminal options still at their default are skipped so the
package/public-api.js CHANGED
@@ -512,7 +512,7 @@ var CliKeyValueStore_TOKEN = cliCore.createCliToken("cli-key-value-store");
512
512
  var SyntaxHighlighterRegistry_TOKEN = cliCore.createCliToken("syntax-highlighter-registry");
513
513
 
514
514
  // src/lib/version.ts
515
- var LIBRARY_VERSION = "2.0.0-beta.18";
515
+ var LIBRARY_VERSION = "2.0.0-beta.19";
516
516
  var API_VERSION = 2;
517
517
  var ANONYMOUS = "\0anonymous";
518
518
  function aliasOwner(context2) {
@@ -4500,21 +4500,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
4500
4500
  }
4501
4501
  async showCategoryMenu(context2, label, stateKey, options) {
4502
4502
  if (stateKey === "system") {
4503
- const langOption = options.find((o) => o.key === "language");
4504
- if (langOption) {
4505
- const translator = context2.services.get(
4506
- cliCore.ICliTranslationService_TOKEN
4507
- );
4508
- if (translator) {
4509
- const locales = translator.getAvailableLocales();
4510
- if (locales.length > 0) {
4511
- langOption.options = locales.map((l) => ({
4512
- label: this.getLanguageLabel(l),
4513
- value: l
4514
- }));
4515
- }
4516
- }
4517
- }
4503
+ this.refreshLanguageOptions(context2);
4518
4504
  }
4519
4505
  while (true) {
4520
4506
  const menuOptions = [];
@@ -4653,7 +4639,25 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
4653
4639
  }
4654
4640
  return state?.plugins?.[stateKey]?.[key] ?? defaultValue;
4655
4641
  }
4656
- getAllOptions(registry) {
4642
+ /**
4643
+ * The language choices are the locales loaded so far: a language pack
4644
+ * installed after boot (`pkg add @qodalis/cli-lang-de`) adds one.
4645
+ */
4646
+ refreshLanguageOptions(context2) {
4647
+ const langOption = SYSTEM_OPTIONS.find((o) => o.key === "language");
4648
+ const translator = context2.services.get(
4649
+ cliCore.ICliTranslationService_TOKEN
4650
+ );
4651
+ const locales = translator?.getAvailableLocales() ?? [];
4652
+ if (langOption && locales.length > 0) {
4653
+ langOption.options = locales.map((l) => ({
4654
+ label: this.getLanguageLabel(l),
4655
+ value: l
4656
+ }));
4657
+ }
4658
+ }
4659
+ getAllOptions(registry, context2) {
4660
+ this.refreshLanguageOptions(context2);
4657
4661
  const result = [];
4658
4662
  for (const option of SYSTEM_OPTIONS) {
4659
4663
  result.push({ stateKey: "system", option });
@@ -4722,7 +4726,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
4722
4726
  const registry = context2.services.getRequired(
4723
4727
  CliProcessorsRegistry_TOKEN
4724
4728
  );
4725
- const allOptions = this.getAllOptions(registry);
4729
+ const allOptions = this.getAllOptions(registry, context2);
4726
4730
  let currentCategory = "";
4727
4731
  const output2 = {};
4728
4732
  for (const { stateKey, option } of allOptions) {
@@ -4787,7 +4791,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
4787
4791
  const registry = context2.services.getRequired(
4788
4792
  CliProcessorsRegistry_TOKEN
4789
4793
  );
4790
- const allOptions = this.getAllOptions(registry);
4794
+ const allOptions = this.getAllOptions(registry, context2);
4791
4795
  const match = allOptions.find(
4792
4796
  (o) => o.stateKey === category && o.option.key === key
4793
4797
  );
@@ -4847,7 +4851,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
4847
4851
  const registry = context2.services.getRequired(
4848
4852
  CliProcessorsRegistry_TOKEN
4849
4853
  );
4850
- const allOptions = this.getAllOptions(registry);
4854
+ const allOptions = this.getAllOptions(registry, context2);
4851
4855
  const match = allOptions.find(
4852
4856
  (o) => o.stateKey === category && o.option.key === key
4853
4857
  );
@@ -5597,7 +5601,8 @@ var CliHelpCommandProcessor = class {
5597
5601
  ` ${BOLD}${writer.wrapInColor(t.t("cli.help.global_options", "Global options"), cliCore.CliForegroundColor.Yellow)}${RESET}`
5598
5602
  );
5599
5603
  globalParams.forEach((param) => {
5600
- this.writeParameter(param, context2, isNarrow(context2));
5604
+ const description = t.t(`cli.help.global_${param.name}`, param.description);
5605
+ this.writeParameter({ ...param, description }, context2, isNarrow(context2));
5601
5606
  });
5602
5607
  }
5603
5608
  if (processor.metadata?.requireServer) {