clispark 1.5.0 → 1.6.0

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": "clispark",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Interactive scaffolding tool for new CLI projects",
5
5
  "keywords": [
6
6
  "cli",
@@ -17,4 +17,10 @@ describe('task complete', () => {
17
17
  const { error } = await runCommand('task complete');
18
18
  expect(error?.message).toContain('Missing 1 required arg');
19
19
  });
20
+
21
+ it('shows a usage example in --help', async () => {
22
+ const { stdout } = await runCommand('task complete --help');
23
+ expect(stdout).toContain('EXAMPLES');
24
+ expect(stdout).toContain('task complete 1');
25
+ });
20
26
  });
@@ -4,6 +4,12 @@ import { BaseCommand } from '../../base-command';
4
4
 
5
5
  export default class TaskComplete extends BaseCommand {
6
6
  static description = 'Complete a task (demonstrates a subcommand with a required integer argument)';
7
+ static examples = [
8
+ {
9
+ command: '<%= config.bin %> task complete 1',
10
+ description: 'Marks task 1 as complete',
11
+ },
12
+ ];
7
13
  static args = {
8
14
  id: Args.integer({ required: true, description: 'Task ID to complete' }),
9
15
  };
@@ -22,4 +22,12 @@ describe('task list', () => {
22
22
  const { stdout } = await runCommand('task list groceries no');
23
23
  expect(stdout).toContain('(completed only: false)');
24
24
  });
25
+
26
+ it('shows usage examples in --help', async () => {
27
+ const { stdout } = await runCommand('task list --help');
28
+ expect(stdout).toContain('EXAMPLES');
29
+ expect(stdout).toContain('task list');
30
+ expect(stdout).toContain('task list groceries');
31
+ expect(stdout).toContain('task list groceries true');
32
+ });
25
33
  });
@@ -4,6 +4,20 @@ import { BaseCommand } from '../../base-command';
4
4
 
5
5
  export default class TaskList extends BaseCommand {
6
6
  static description = 'List tasks (demonstrates a subcommand with two optional arguments of different types)';
7
+ static examples = [
8
+ {
9
+ command: '<%= config.bin %> task list',
10
+ description: 'Lists all tasks',
11
+ },
12
+ {
13
+ command: '<%= config.bin %> task list groceries',
14
+ description: 'Lists tasks matching a filter term',
15
+ },
16
+ {
17
+ command: '<%= config.bin %> task list groceries true',
18
+ description: 'Lists tasks matching a filter, showing only completed ones',
19
+ },
20
+ ];
7
21
  static args = {
8
22
  filter: Args.string({ required: false, description: 'Optional filter term' }),
9
23
  done: Args.boolean({ required: false, description: 'Only show completed tasks (true/false)' }),
@@ -23,4 +23,11 @@ describe('task', () => {
23
23
  const { error } = await runCommand('task');
24
24
  expect(error?.message).toContain('Missing 1 required arg');
25
25
  });
26
+
27
+ it('shows usage examples in --help', async () => {
28
+ const { stdout } = await runCommand('task --help');
29
+ expect(stdout).toContain('EXAMPLES');
30
+ expect(stdout).toContain('task "Buy milk"');
31
+ expect(stdout).toContain('task "Buy milk" high');
32
+ });
26
33
  });
@@ -4,6 +4,16 @@ import { BaseCommand } from '../base-command';
4
4
 
5
5
  export default class Task extends BaseCommand {
6
6
  static description = 'Create a task (demonstrates a required string arg and an optional enum-constrained arg)';
7
+ static examples = [
8
+ {
9
+ command: '<%= config.bin %> task "Buy milk"',
10
+ description: 'Creates a task with just a title',
11
+ },
12
+ {
13
+ command: '<%= config.bin %> task "Buy milk" high',
14
+ description: 'Creates a task with an optional priority (low, medium, or high)',
15
+ },
16
+ ];
7
17
  static args = {
8
18
  title: Args.string({ required: true, description: 'Task title' }),
9
19
  priority: Args.string({