@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/public-api.mjs CHANGED
@@ -511,7 +511,7 @@ var CliKeyValueStore_TOKEN = createCliToken("cli-key-value-store");
511
511
  var SyntaxHighlighterRegistry_TOKEN = createCliToken("syntax-highlighter-registry");
512
512
 
513
513
  // src/lib/version.ts
514
- var LIBRARY_VERSION = "2.0.0-beta.18";
514
+ var LIBRARY_VERSION = "2.0.0-beta.19";
515
515
  var API_VERSION = 2;
516
516
  var ANONYMOUS = "\0anonymous";
517
517
  function aliasOwner(context2) {
@@ -4499,21 +4499,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
4499
4499
  }
4500
4500
  async showCategoryMenu(context2, label, stateKey, options) {
4501
4501
  if (stateKey === "system") {
4502
- const langOption = options.find((o) => o.key === "language");
4503
- if (langOption) {
4504
- const translator = context2.services.get(
4505
- ICliTranslationService_TOKEN
4506
- );
4507
- if (translator) {
4508
- const locales = translator.getAvailableLocales();
4509
- if (locales.length > 0) {
4510
- langOption.options = locales.map((l) => ({
4511
- label: this.getLanguageLabel(l),
4512
- value: l
4513
- }));
4514
- }
4515
- }
4516
- }
4502
+ this.refreshLanguageOptions(context2);
4517
4503
  }
4518
4504
  while (true) {
4519
4505
  const menuOptions = [];
@@ -4652,7 +4638,25 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
4652
4638
  }
4653
4639
  return state?.plugins?.[stateKey]?.[key] ?? defaultValue;
4654
4640
  }
4655
- getAllOptions(registry) {
4641
+ /**
4642
+ * The language choices are the locales loaded so far: a language pack
4643
+ * installed after boot (`pkg add @qodalis/cli-lang-de`) adds one.
4644
+ */
4645
+ refreshLanguageOptions(context2) {
4646
+ const langOption = SYSTEM_OPTIONS.find((o) => o.key === "language");
4647
+ const translator = context2.services.get(
4648
+ ICliTranslationService_TOKEN
4649
+ );
4650
+ const locales = translator?.getAvailableLocales() ?? [];
4651
+ if (langOption && locales.length > 0) {
4652
+ langOption.options = locales.map((l) => ({
4653
+ label: this.getLanguageLabel(l),
4654
+ value: l
4655
+ }));
4656
+ }
4657
+ }
4658
+ getAllOptions(registry, context2) {
4659
+ this.refreshLanguageOptions(context2);
4656
4660
  const result = [];
4657
4661
  for (const option of SYSTEM_OPTIONS) {
4658
4662
  result.push({ stateKey: "system", option });
@@ -4721,7 +4725,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
4721
4725
  const registry = context2.services.getRequired(
4722
4726
  CliProcessorsRegistry_TOKEN
4723
4727
  );
4724
- const allOptions = this.getAllOptions(registry);
4728
+ const allOptions = this.getAllOptions(registry, context2);
4725
4729
  let currentCategory = "";
4726
4730
  const output2 = {};
4727
4731
  for (const { stateKey, option } of allOptions) {
@@ -4786,7 +4790,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
4786
4790
  const registry = context2.services.getRequired(
4787
4791
  CliProcessorsRegistry_TOKEN
4788
4792
  );
4789
- const allOptions = this.getAllOptions(registry);
4793
+ const allOptions = this.getAllOptions(registry, context2);
4790
4794
  const match = allOptions.find(
4791
4795
  (o) => o.stateKey === category && o.option.key === key
4792
4796
  );
@@ -4846,7 +4850,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
4846
4850
  const registry = context2.services.getRequired(
4847
4851
  CliProcessorsRegistry_TOKEN
4848
4852
  );
4849
- const allOptions = this.getAllOptions(registry);
4853
+ const allOptions = this.getAllOptions(registry, context2);
4850
4854
  const match = allOptions.find(
4851
4855
  (o) => o.stateKey === category && o.option.key === key
4852
4856
  );
@@ -5596,7 +5600,8 @@ var CliHelpCommandProcessor = class {
5596
5600
  ` ${BOLD}${writer.wrapInColor(t.t("cli.help.global_options", "Global options"), CliForegroundColor.Yellow)}${RESET}`
5597
5601
  );
5598
5602
  globalParams.forEach((param) => {
5599
- this.writeParameter(param, context2, isNarrow(context2));
5603
+ const description = t.t(`cli.help.global_${param.name}`, param.description);
5604
+ this.writeParameter({ ...param, description }, context2, isNarrow(context2));
5600
5605
  });
5601
5606
  }
5602
5607
  if (processor.metadata?.requireServer) {