@h3ravel/musket 2.2.0 → 2.2.2

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/dist/index.cjs CHANGED
@@ -359,7 +359,7 @@ var Command = class {
359
359
  setArgument(name, value) {
360
360
  this.input.arguments[name] = value;
361
361
  const index = this.input.arguments ? Object.keys(this.input.arguments).indexOf(name) : -1;
362
- if (index !== -1) this.program.args[index] = value;
362
+ if (index !== -1 && this.program?.args) this.program.args[index] = value;
363
363
  return this;
364
364
  }
365
365
  /**
@@ -683,6 +683,15 @@ var Command = class {
683
683
  return _h3ravel_shared.Prompts.checkbox(message, choices, required, prefix, pageSize);
684
684
  }
685
685
  /**
686
+ * Creates a table with the given options and logs it to the console.
687
+ *
688
+ * @param options
689
+ * @returns
690
+ */
691
+ table(options) {
692
+ return _h3ravel_shared.Logger.table(options);
693
+ }
694
+ /**
686
695
  * Open the user's default text editor to accept multi-line input.
687
696
  *
688
697
  * @param message Message to display
@@ -694,6 +703,16 @@ var Command = class {
694
703
  editor(message, postfix, defaultValue, validate) {
695
704
  return _h3ravel_shared.Prompts.editor(message, postfix, defaultValue, validate);
696
705
  }
706
+ /**
707
+ * Prompt the user for multi-line input directly in the console.
708
+ *
709
+ * @param prompt Message to display
710
+ * @param placeholder The placeholder text for the input
711
+ * @returns
712
+ */
713
+ multiline(prompt = "Please provide your input below:", placeholder, options) {
714
+ return _h3ravel_shared.Prompts.multiline(prompt, placeholder, options);
715
+ }
697
716
  };
698
717
  //#endregion
699
718
  //#region src/Commands/HelpCommand.ts
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ChoiceOrSeparatorArray, Choices, LoggerChalk, Spinner } from "@h3ravel/shared";
1
+ import { ChoiceOrSeparatorArray, Choices, Logger, LoggerChalk, Prompts, Spinner } from "@h3ravel/shared";
2
2
  import { Argument, Command as Command$1 } from "commander";
3
3
  import { UserConfig } from "tsdown";
4
4
 
@@ -801,6 +801,13 @@ declare class Command<A extends Application = Application> {
801
801
  * @returns
802
802
  */
803
803
  checkbox(message: string, choices: Choices, required?: boolean, prefix?: string, pageSize?: number): Promise<string[]>;
804
+ /**
805
+ * Creates a table with the given options and logs it to the console.
806
+ *
807
+ * @param options
808
+ * @returns
809
+ */
810
+ table(options?: Parameters<typeof Logger['table']>[0]): typeof Logger['table'];
804
811
  /**
805
812
  * Open the user's default text editor to accept multi-line input.
806
813
  *
@@ -811,6 +818,14 @@ declare class Command<A extends Application = Application> {
811
818
  * @returns
812
819
  */
813
820
  editor(message?: string, postfix?: string, defaultValue?: string, validate?: (text: string) => boolean | string): Promise<string>;
821
+ /**
822
+ * Prompt the user for multi-line input directly in the console.
823
+ *
824
+ * @param prompt Message to display
825
+ * @param placeholder The placeholder text for the input
826
+ * @returns
827
+ */
828
+ multiline(prompt?: string, placeholder?: string, options?: Omit<Exclude<Parameters<typeof Prompts['multiline']>[0], string>, 'prompt' | 'placeholder'>): Promise<string>;
814
829
  }
815
830
  //#endregion
816
831
  //#region src/Musket.d.ts
package/dist/index.js CHANGED
@@ -335,7 +335,7 @@ var Command = class {
335
335
  setArgument(name, value) {
336
336
  this.input.arguments[name] = value;
337
337
  const index = this.input.arguments ? Object.keys(this.input.arguments).indexOf(name) : -1;
338
- if (index !== -1) this.program.args[index] = value;
338
+ if (index !== -1 && this.program?.args) this.program.args[index] = value;
339
339
  return this;
340
340
  }
341
341
  /**
@@ -659,6 +659,15 @@ var Command = class {
659
659
  return Prompts.checkbox(message, choices, required, prefix, pageSize);
660
660
  }
661
661
  /**
662
+ * Creates a table with the given options and logs it to the console.
663
+ *
664
+ * @param options
665
+ * @returns
666
+ */
667
+ table(options) {
668
+ return Logger.table(options);
669
+ }
670
+ /**
662
671
  * Open the user's default text editor to accept multi-line input.
663
672
  *
664
673
  * @param message Message to display
@@ -670,6 +679,16 @@ var Command = class {
670
679
  editor(message, postfix, defaultValue, validate) {
671
680
  return Prompts.editor(message, postfix, defaultValue, validate);
672
681
  }
682
+ /**
683
+ * Prompt the user for multi-line input directly in the console.
684
+ *
685
+ * @param prompt Message to display
686
+ * @param placeholder The placeholder text for the input
687
+ * @returns
688
+ */
689
+ multiline(prompt = "Please provide your input below:", placeholder, options) {
690
+ return Prompts.multiline(prompt, placeholder, options);
691
+ }
673
692
  };
674
693
  //#endregion
675
694
  //#region src/Commands/HelpCommand.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/musket",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Musket CLI is a framework-agnostic CLI framework designed to allow you build artisan-like CLI apps and for use in the H3ravel framework.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -66,7 +66,7 @@
66
66
  "vitest": "^4.1.8"
67
67
  },
68
68
  "dependencies": {
69
- "@h3ravel/shared": "^2.0.0",
69
+ "@h3ravel/shared": "^2.2.4",
70
70
  "chalk": "^5.6.2",
71
71
  "commander": "^14.0.1",
72
72
  "dayjs": "^1.11.18",