inquirerer 2.1.0 → 2.1.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/README.md CHANGED
@@ -1,163 +1,740 @@
1
1
  # inquirerer
2
2
 
3
3
  <p align="center" width="100%">
4
- <img height="90" src="https://user-images.githubusercontent.com/545047/190171475-b416f99e-2831-4786-9ba3-a7ff4d95b0d3.svg" />
4
+ <img height="90" src="https://raw.githubusercontent.com/hyperweb-io/dev-utils/refs/heads/main/docs/img/inquirerer.svg" />
5
5
  </p>
6
6
 
7
7
  <p align="center" width="100%">
8
-
9
- <a href="https://github.com/pyramation/inquirerer/actions/workflows/run-tests.yml">
10
- <img height="20" src="https://github.com/pyramation/inquirerer/actions/workflows/run-tests.yml/badge.svg" />
8
+ <a href="https://github.com/hyperweb-io/dev-utils/actions/workflows/ci.yml">
9
+ <img height="20" src="https://github.com/hyperweb-io/dev-utils/actions/workflows/ci.yml/badge.svg" />
11
10
  </a>
12
- <a href="https://github.com/pyramation/inquirerer/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
13
- <a href="https://www.npmjs.com/package/inquirerer"><img height="20" src="https://img.shields.io/npm/dt/inquirerer"></a>
14
- <a href="https://www.npmjs.com/package/inquirerer"><img height="20" src="https://img.shields.io/github/package-json/v/pyramation/inquirerer?filename=packages%2Finquirerer%2Fpackage.json"></a>
11
+ <a href="https://github.com/hyperweb-io/dev-utils/blob/main/LICENSE">
12
+ <img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/>
13
+ </a>
14
+ <a href="https://www.npmjs.com/package/inquirerer"><img height="20" src="https://img.shields.io/npm/dt/inquirerer"></a>
15
+ <a href="https://www.npmjs.com/package/inquirerer"><img height="20" src="https://img.shields.io/github/package-json/v/hyperweb-io/dev-utils?filename=packages%2Finquirerer%2Fpackage.json"></a>
15
16
  </p>
16
17
 
17
- This library is designed to facilitate the creation of command-line utilities by providing a robust framework for capturing user input through interactive prompts. It supports a variety of question types, making it highly flexible and suitable for a wide range of applications.
18
+ A powerful, TypeScript-first library for building beautiful command-line interfaces. Create interactive CLI tools with ease using intuitive prompts, validation, and rich user experiences.
18
19
 
19
- ## Install
20
+ ## Installation
20
21
 
21
- ```sh
22
+ ```bash
22
23
  npm install inquirerer
23
24
  ```
24
25
 
25
26
  ## Features
26
27
 
27
- - 🖊 **Multiple Question Types:** Support for text, autocomplete, checkbox, and confirm questions.
28
- - 🛠 **Customizable Prompts:** Easily configure prompts to include default values, requirement flags, and custom validation rules.
29
- - 🔎 **Interactive Autocomplete:** Dynamically filter options based on user input.
30
- - ✔️ **Flexible Checkbox Selections:** Allow users to select multiple options from a list.
28
+ - 🔌 **CLI Builder** - Build command-line utilties fast
29
+ - 🖊 **Multiple Question Types** - Support for text, autocomplete, checkbox, and confirm questions
30
+ - 🤖 **Non-Interactive Mode** - Fallback to defaults for CI/CD environments, great for testing
31
+ - ✅ **Smart Validation** - Built-in pattern matching, custom validators, and sanitizers
32
+ - 🔀 **Conditional Logic** - Show/hide questions based on previous answers
33
+ - 🎨 **Interactive UX** - Fuzzy search, keyboard navigation, and visual feedback
31
34
 
32
35
  ## Table of Contents
33
36
 
34
- - [Introduction](#inquirerer)
35
- - [Install](#install)
36
- - [Features](#features)
37
- - [Installation](#installation)
38
- - [Usage](#usage)
39
- - [Example Questions](#example-questions)
37
+ - [Quick Start](#quick-start)
38
+ - [Core Concepts](#core-concepts)
39
+ - [TypeScript Support](#typescript-support)
40
+ - [Question Types](#question-types)
41
+ - [Non-Interactive Mode](#non-interactive-mode)
42
+ - [API Reference](#api-reference)
43
+ - [Inquirerer Class](#inquirerer-class)
44
+ - [Question Types](#question-types-1)
40
45
  - [Text Question](#text-question)
46
+ - [Number Question](#number-question)
41
47
  - [Confirm Question](#confirm-question)
48
+ - [List Question](#list-question)
42
49
  - [Autocomplete Question](#autocomplete-question)
43
50
  - [Checkbox Question](#checkbox-question)
44
- - [Executing a Prompt](#executing-a-prompt)
51
+ - [Advanced Question Options](#advanced-question-options)
52
+ - [Real-World Examples](#real-world-examples)
53
+ - [Project Setup Wizard](#project-setup-wizard)
54
+ - [Configuration Builder](#configuration-builder)
55
+ - [CLI with Commander Integration](#cli-with-commander-integration)
56
+ - [Dynamic Dependencies](#dynamic-dependencies)
57
+ - [Custom Validation](#custom-validation)
58
+ - [CLI Helper](#cli-helper)
45
59
  - [Developing](#developing)
46
- - [Credits](#credits)
47
- - [Disclaimer](#disclaimer)
48
60
 
49
- ## Installation
61
+ ## Quick Start
50
62
 
51
- To install the library, use `npm` or `yarn`:
63
+ ```typescript
64
+ import { Inquirerer } from 'inquirerer';
52
65
 
53
- ```bash
54
- npm install inquirerer
66
+ const prompter = new Inquirerer();
67
+
68
+ const answers = await prompter.prompt({}, [
69
+ {
70
+ type: 'text',
71
+ name: 'username',
72
+ message: 'What is your username?',
73
+ required: true
74
+ },
75
+ {
76
+ type: 'confirm',
77
+ name: 'newsletter',
78
+ message: 'Subscribe to our newsletter?',
79
+ default: true
80
+ }
81
+ ]);
82
+
83
+ console.log(answers);
84
+ // { username: 'john_doe', newsletter: true }
55
85
  ```
56
86
 
57
- ## Usage
87
+ ## Core Concepts
88
+
89
+ ### TypeScript Support
90
+
91
+ Import types for full type safety:
92
+
93
+ ```typescript
94
+ import {
95
+ Inquirerer,
96
+ Question,
97
+ TextQuestion,
98
+ NumberQuestion,
99
+ ConfirmQuestion,
100
+ ListQuestion,
101
+ AutocompleteQuestion,
102
+ CheckboxQuestion,
103
+ InquirererOptions
104
+ } from 'inquirerer';
105
+
106
+ interface UserConfig {
107
+ name: string;
108
+ age: number;
109
+ newsletter: boolean;
110
+ }
58
111
 
59
- Import the library and use it to create prompts for your command-line application:
112
+ const answers = await prompter.prompt<UserConfig>({}, questions);
113
+ // answers is typed as UserConfig
114
+ ```
60
115
 
61
- ```js
62
- import { Inquirerer } from 'inquirerer';
116
+ ### Question Types
117
+
118
+ All questions support these base properties:
119
+
120
+ ```typescript
121
+ interface BaseQuestion {
122
+ name: string; // Property name in result object
123
+ type: string; // Question type
124
+ message?: string; // Prompt message to display
125
+ description?: string; // Additional context
126
+ default?: any; // Default value
127
+ useDefault?: boolean; // Skip prompt and use default
128
+ required?: boolean; // Validation requirement
129
+ validate?: (input: any, answers: any) => boolean | Validation;
130
+ sanitize?: (input: any, answers: any) => any;
131
+ pattern?: string; // Regex pattern for validation
132
+ dependsOn?: string[]; // Question dependencies
133
+ when?: (answers: any) => boolean; // Conditional display
134
+ }
63
135
  ```
64
136
 
65
- ### Example Questions
137
+ ### Non-Interactive Mode
138
+
139
+ When running in CI/CD or without a TTY, inquirerer automatically falls back to default values:
66
140
 
67
- Here are several examples of different question types you can use:
141
+ ```typescript
142
+ const prompter = new Inquirerer({
143
+ noTty: true, // Force non-interactive mode
144
+ useDefaults: true // Use defaults without prompting
145
+ });
146
+ ```
147
+
148
+ ## API Reference
149
+
150
+ ### Inquirerer Class
151
+
152
+ #### Constructor Options
153
+
154
+ ```typescript
155
+ interface InquirererOptions {
156
+ noTty?: boolean; // Disable interactive mode
157
+ input?: Readable; // Input stream (default: process.stdin)
158
+ output?: Writable; // Output stream (default: process.stdout)
159
+ useDefaults?: boolean; // Skip prompts and use defaults
160
+ globalMaxLines?: number; // Max lines for list displays (default: 10)
161
+ mutateArgs?: boolean; // Mutate argv object (default: true)
162
+ }
163
+
164
+ const prompter = new Inquirerer(options);
165
+ ```
166
+
167
+ #### Methods
168
+
169
+ ```typescript
170
+ // Main prompt method
171
+ prompt<T>(argv: T, questions: Question[], options?: PromptOptions): Promise<T>
172
+
173
+ // Generate man page documentation
174
+ generateManPage(info: ManPageInfo): string
175
+
176
+ // Clean up resources
177
+ close(): void
178
+ exit(): void
179
+ ```
180
+
181
+ ### Question Types
68
182
 
69
183
  #### Text Question
70
184
 
71
- ```js
185
+ Collect string input from users.
186
+
187
+ ```typescript
72
188
  {
73
189
  type: 'text',
74
- name: 'firstName',
75
- message: 'Enter your first name',
190
+ name: 'projectName',
191
+ message: 'What is your project name?',
192
+ default: 'my-app',
193
+ required: true,
194
+ pattern: '^[a-z0-9-]+$', // Regex validation
195
+ validate: (input) => {
196
+ if (input.length < 3) {
197
+ return { success: false, reason: 'Name must be at least 3 characters' };
198
+ }
199
+ return true;
200
+ }
201
+ }
202
+ ```
203
+
204
+ #### Number Question
205
+
206
+ Collect numeric input.
207
+
208
+ ```typescript
209
+ {
210
+ type: 'number',
211
+ name: 'port',
212
+ message: 'Which port to use?',
213
+ default: 3000,
214
+ validate: (input) => {
215
+ if (input < 1 || input > 65535) {
216
+ return { success: false, reason: 'Port must be between 1 and 65535' };
217
+ }
218
+ return true;
219
+ }
76
220
  }
77
221
  ```
78
222
 
79
223
  #### Confirm Question
80
224
 
81
- ```js
225
+ Yes/no questions.
226
+
227
+ ```typescript
82
228
  {
83
229
  type: 'confirm',
84
- name: 'continue',
85
- message: 'Do you wish to continue?',
86
- default: true,
230
+ name: 'useTypeScript',
231
+ message: 'Use TypeScript?',
232
+ default: true // Default to 'yes'
233
+ }
234
+ ```
235
+
236
+ #### List Question
237
+
238
+ Select one option from a list (no search).
239
+
240
+ ```typescript
241
+ {
242
+ type: 'list',
243
+ name: 'license',
244
+ message: 'Choose a license',
245
+ options: ['MIT', 'Apache-2.0', 'GPL-3.0', 'BSD-3-Clause'],
246
+ default: 'MIT',
247
+ maxDisplayLines: 5
87
248
  }
88
249
  ```
89
250
 
90
251
  #### Autocomplete Question
91
252
 
92
- ```js
253
+ Select with fuzzy search capabilities.
254
+
255
+ ```typescript
93
256
  {
94
257
  type: 'autocomplete',
95
- name: 'fruitChoice',
96
- message: 'Select your favorite fruit',
258
+ name: 'framework',
259
+ message: 'Choose your framework',
97
260
  options: [
98
- 'Apple', 'Banana', 'Cherry'
261
+ { name: 'React', value: 'react' },
262
+ { name: 'Vue.js', value: 'vue' },
263
+ { name: 'Angular', value: 'angular' },
264
+ { name: 'Svelte', value: 'svelte' }
99
265
  ],
100
- maxDisplayLines: 5
266
+ allowCustomOptions: true, // Allow user to enter custom value
267
+ maxDisplayLines: 8
101
268
  }
102
269
  ```
103
270
 
104
271
  #### Checkbox Question
105
272
 
106
- ```js
273
+ Multi-select with search.
274
+
275
+ ```typescript
107
276
  {
108
277
  type: 'checkbox',
109
- name: 'techStack',
110
- message: 'Choose your tech stack',
278
+ name: 'features',
279
+ message: 'Select features to include',
111
280
  options: [
112
- 'Node.js', 'React', 'Angular', 'Vue.js'
281
+ 'Authentication',
282
+ 'Database',
283
+ 'API Routes',
284
+ 'Testing',
285
+ 'Documentation'
113
286
  ],
114
- returnFullResults: false,
287
+ default: ['Authentication', 'API Routes'],
288
+ returnFullResults: false, // Only return selected items
115
289
  required: true
116
290
  }
117
291
  ```
118
292
 
119
- ### Executing a Prompt
293
+ With `returnFullResults: true`, returns all options with selection status:
294
+
295
+ ```typescript
296
+ [
297
+ { name: 'Authentication', value: 'Authentication', selected: true },
298
+ { name: 'Database', value: 'Database', selected: false },
299
+ // ...
300
+ ]
301
+ ```
302
+
303
+ ### Advanced Question Options
304
+
305
+ #### Custom Validation
306
+
307
+ ```typescript
308
+ {
309
+ type: 'text',
310
+ name: 'email',
311
+ message: 'Enter your email',
312
+ pattern: '^[^@]+@[^@]+\\.[^@]+$',
313
+ validate: (email, answers) => {
314
+ // Custom async validation possible
315
+ if (email.endsWith('@example.com')) {
316
+ return {
317
+ success: false,
318
+ reason: 'Please use a real email address'
319
+ };
320
+ }
321
+ return { success: true };
322
+ }
323
+ }
324
+ ```
120
325
 
121
- To run a prompt and handle the response:
326
+ #### Value Sanitization
122
327
 
123
- ```js
328
+ ```typescript
329
+ {
330
+ type: 'text',
331
+ name: 'tags',
332
+ message: 'Enter tags (comma-separated)',
333
+ sanitize: (input) => {
334
+ return input.split(',').map(tag => tag.trim());
335
+ }
336
+ }
337
+ ```
338
+
339
+ #### Conditional Questions
340
+
341
+ ```typescript
342
+ const questions: Question[] = [
343
+ {
344
+ type: 'confirm',
345
+ name: 'useDatabase',
346
+ message: 'Do you need a database?',
347
+ default: false
348
+ },
349
+ {
350
+ type: 'list',
351
+ name: 'database',
352
+ message: 'Which database?',
353
+ options: ['PostgreSQL', 'MySQL', 'MongoDB', 'SQLite'],
354
+ when: (answers) => answers.useDatabase === true // Only show if useDatabase is true
355
+ }
356
+ ];
357
+ ```
358
+
359
+ #### Question Dependencies
360
+
361
+ Ensure questions appear in the correct order:
362
+
363
+ ```typescript
364
+ [
365
+ {
366
+ type: 'checkbox',
367
+ name: 'services',
368
+ message: 'Select services',
369
+ options: ['Auth', 'Storage', 'Functions']
370
+ },
371
+ {
372
+ type: 'text',
373
+ name: 'authProvider',
374
+ message: 'Which auth provider?',
375
+ dependsOn: ['services'], // Wait for services question
376
+ when: (answers) => {
377
+ const selected = answers.services.find(s => s.name === 'Auth');
378
+ return selected?.selected === true;
379
+ }
380
+ }
381
+ ]
382
+ ```
383
+
384
+ ## Real-World Examples
385
+
386
+ ### Project Setup Wizard
387
+
388
+ ```typescript
389
+ import { Inquirerer, Question } from 'inquirerer';
390
+ import minimist from 'minimist';
391
+
392
+ const argv = minimist(process.argv.slice(2));
124
393
  const prompter = new Inquirerer();
125
394
 
126
- async function runPrompt() {
127
- const responses = await prompter.prompt({}, [
395
+ const questions: Question[] = [
396
+ {
397
+ type: 'text',
398
+ name: 'projectName',
399
+ message: 'Project name',
400
+ required: true,
401
+ pattern: '^[a-z0-9-]+$'
402
+ },
403
+ {
404
+ type: 'text',
405
+ name: 'description',
406
+ message: 'Project description',
407
+ default: 'My awesome project'
408
+ },
409
+ {
410
+ type: 'confirm',
411
+ name: 'typescript',
412
+ message: 'Use TypeScript?',
413
+ default: true
414
+ },
415
+ {
416
+ type: 'autocomplete',
417
+ name: 'framework',
418
+ message: 'Choose a framework',
419
+ options: ['React', 'Vue', 'Svelte', 'None'],
420
+ default: 'React'
421
+ },
422
+ {
423
+ type: 'checkbox',
424
+ name: 'tools',
425
+ message: 'Additional tools',
426
+ options: ['ESLint', 'Prettier', 'Jest', 'Husky'],
427
+ default: ['ESLint', 'Prettier']
428
+ }
429
+ ];
430
+
431
+ const config = await prompter.prompt(argv, questions);
432
+ console.log('Creating project with:', config);
433
+ ```
434
+
435
+ Run interactively:
436
+ ```bash
437
+ node setup.js
438
+ ```
439
+
440
+ Or with CLI args:
441
+ ```bash
442
+ node setup.js --projectName=my-app --typescript --framework=React
443
+ ```
444
+
445
+ ### Configuration Builder
446
+
447
+ ```typescript
448
+ interface AppConfig {
449
+ port: number;
450
+ host: string;
451
+ ssl: boolean;
452
+ sslCert?: string;
453
+ sslKey?: string;
454
+ database: string;
455
+ logLevel: string;
456
+ }
457
+
458
+ const questions: Question[] = [
459
+ {
460
+ type: 'number',
461
+ name: 'port',
462
+ message: 'Server port',
463
+ default: 3000,
464
+ validate: (port) => port > 0 && port < 65536
465
+ },
466
+ {
467
+ type: 'text',
468
+ name: 'host',
469
+ message: 'Server host',
470
+ default: '0.0.0.0'
471
+ },
472
+ {
473
+ type: 'confirm',
474
+ name: 'ssl',
475
+ message: 'Enable SSL?',
476
+ default: false
477
+ },
478
+ {
479
+ type: 'text',
480
+ name: 'sslCert',
481
+ message: 'SSL certificate path',
482
+ when: (answers) => answers.ssl === true,
483
+ required: true
484
+ },
485
+ {
486
+ type: 'text',
487
+ name: 'sslKey',
488
+ message: 'SSL key path',
489
+ when: (answers) => answers.ssl === true,
490
+ required: true
491
+ },
492
+ {
493
+ type: 'list',
494
+ name: 'database',
495
+ message: 'Database type',
496
+ options: ['PostgreSQL', 'MySQL', 'SQLite'],
497
+ default: 'PostgreSQL'
498
+ },
499
+ {
500
+ type: 'list',
501
+ name: 'logLevel',
502
+ message: 'Log level',
503
+ options: ['error', 'warn', 'info', 'debug'],
504
+ default: 'info'
505
+ }
506
+ ];
507
+
508
+ const config = await prompter.prompt<AppConfig>(argv, questions);
509
+
510
+ // Write config to file
511
+ fs.writeFileSync('config.json', JSON.stringify(config, null, 2));
512
+ ```
513
+
514
+ ### CLI with Commander Integration
515
+
516
+ ```typescript
517
+ import { CLI, CommandHandler } from 'inquirerer';
518
+ import { Question } from 'inquirerer';
519
+
520
+ const handler: CommandHandler = async (argv, prompter, options) => {
521
+ const questions: Question[] = [
128
522
  {
129
523
  type: 'text',
130
- name: 'lastName',
131
- message: 'Enter your last name',
524
+ name: 'name',
525
+ message: 'What is your name?',
132
526
  required: true
133
527
  },
134
528
  {
135
- type: 'checkbox',
136
- name: 'devTools',
137
- message: 'Select development tools:',
138
- options: ['VS Code', 'Sublime', 'Atom'],
139
- required: true
529
+ type: 'number',
530
+ name: 'age',
531
+ message: 'What is your age?',
532
+ validate: (age) => age >= 0 && age <= 120
533
+ }
534
+ ];
535
+
536
+ const answers = await prompter.prompt(argv, questions);
537
+ console.log('Hello,', answers.name);
538
+ };
539
+
540
+ const cli = new CLI(handler, {
541
+ version: 'myapp@1.0.0',
542
+ minimistOpts: {
543
+ alias: {
544
+ n: 'name',
545
+ a: 'age',
546
+ v: 'version'
140
547
  }
141
- ]);
548
+ }
549
+ });
142
550
 
143
- console.log(responses);
144
- }
551
+ await cli.run();
552
+ ```
553
+
554
+ ### Dynamic Dependencies
555
+
556
+ ```typescript
557
+ const questions: Question[] = [
558
+ {
559
+ type: 'checkbox',
560
+ name: 'cloud',
561
+ message: 'Select cloud services',
562
+ options: ['AWS', 'Azure', 'GCP'],
563
+ returnFullResults: true
564
+ },
565
+ {
566
+ type: 'text',
567
+ name: 'awsRegion',
568
+ message: 'AWS Region',
569
+ dependsOn: ['cloud'],
570
+ when: (answers) => {
571
+ const aws = answers.cloud?.find(c => c.name === 'AWS');
572
+ return aws?.selected === true;
573
+ },
574
+ default: 'us-east-1'
575
+ },
576
+ {
577
+ type: 'text',
578
+ name: 'azureLocation',
579
+ message: 'Azure Location',
580
+ dependsOn: ['cloud'],
581
+ when: (answers) => {
582
+ const azure = answers.cloud?.find(c => c.name === 'Azure');
583
+ return azure?.selected === true;
584
+ },
585
+ default: 'eastus'
586
+ },
587
+ {
588
+ type: 'text',
589
+ name: 'gcpZone',
590
+ message: 'GCP Zone',
591
+ dependsOn: ['cloud'],
592
+ when: (answers) => {
593
+ const gcp = answers.cloud?.find(c => c.name === 'GCP');
594
+ return gcp?.selected === true;
595
+ },
596
+ default: 'us-central1-a'
597
+ }
598
+ ];
599
+
600
+ const config = await prompter.prompt({}, questions);
601
+ ```
602
+
603
+ ### Custom Validation
604
+
605
+ ```typescript
606
+ const questions: Question[] = [
607
+ {
608
+ type: 'text',
609
+ name: 'username',
610
+ message: 'Choose a username',
611
+ required: true,
612
+ pattern: '^[a-zA-Z0-9_]{3,20}$',
613
+ validate: async (username) => {
614
+ // Simulate API call to check availability
615
+ const available = await checkUsernameAvailability(username);
616
+ if (!available) {
617
+ return {
618
+ success: false,
619
+ reason: 'Username is already taken'
620
+ };
621
+ }
622
+ return { success: true };
623
+ }
624
+ },
625
+ {
626
+ type: 'text',
627
+ name: 'password',
628
+ message: 'Choose a password',
629
+ required: true,
630
+ validate: (password) => {
631
+ if (password.length < 8) {
632
+ return {
633
+ success: false,
634
+ reason: 'Password must be at least 8 characters'
635
+ };
636
+ }
637
+ if (!/[A-Z]/.test(password)) {
638
+ return {
639
+ success: false,
640
+ reason: 'Password must contain an uppercase letter'
641
+ };
642
+ }
643
+ if (!/[0-9]/.test(password)) {
644
+ return {
645
+ success: false,
646
+ reason: 'Password must contain a number'
647
+ };
648
+ }
649
+ return { success: true };
650
+ }
651
+ },
652
+ {
653
+ type: 'text',
654
+ name: 'confirmPassword',
655
+ message: 'Confirm password',
656
+ required: true,
657
+ dependsOn: ['password'],
658
+ validate: (confirm, answers) => {
659
+ if (confirm !== answers.password) {
660
+ return {
661
+ success: false,
662
+ reason: 'Passwords do not match'
663
+ };
664
+ }
665
+ return { success: true };
666
+ }
667
+ }
668
+ ];
669
+ ```
670
+
671
+ ## CLI Helper
145
672
 
146
- runPrompt();
673
+ The `CLI` class provides integration with command-line argument parsing:
674
+
675
+ ```typescript
676
+ import { CLI, CommandHandler, CLIOptions } from 'inquirerer';
677
+
678
+ const options: Partial<CLIOptions> = {
679
+ version: 'myapp@1.0.0',
680
+ minimistOpts: {
681
+ alias: {
682
+ v: 'version',
683
+ h: 'help'
684
+ },
685
+ boolean: ['help', 'version'],
686
+ string: ['name', 'output']
687
+ }
688
+ };
689
+
690
+ const handler: CommandHandler = async (argv, prompter) => {
691
+ if (argv.help) {
692
+ console.log('Usage: myapp [options]');
693
+ process.exit(0);
694
+ }
695
+
696
+ const answers = await prompter.prompt(argv, questions);
697
+ // Handle answers
698
+ };
699
+
700
+ const cli = new CLI(handler, options);
701
+ await cli.run();
147
702
  ```
148
703
 
704
+ ---
705
+
706
+ ## Development
149
707
 
150
- ## Developing
708
+ ### Setup
709
+
710
+ 1. Clone the repository:
711
+
712
+ ```bash
713
+ git clone https://github.com/hyperweb-io/dev-utils.git
714
+ ```
151
715
 
716
+ 2. Install dependencies:
152
717
 
153
- When first cloning the repo:
718
+ ```bash
719
+ cd dev-utils
720
+ pnpm install
721
+ pnpm build
154
722
  ```
155
- yarn
156
- yarn build
723
+
724
+ 3. Test the package of interest:
725
+
726
+ ```bash
727
+ cd packages/<packagename>
728
+ pnpm test:watch
157
729
  ```
158
730
 
731
+ ## Credits
732
+
733
+ Built for developers, with developers.
734
+ 👉 https://launchql.com | https://hyperweb.io
735
+
159
736
  ## Disclaimer
160
737
 
161
- AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
738
+ AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
162
739
 
163
740
  No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.