Skip to content

Commit 401ac91

Browse files
committed
docs: add issues create help
1 parent 6efdbce commit 401ac91

6 files changed

Lines changed: 80 additions & 0 deletions

File tree

help/cli-commands/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ These commands find and report security issues in Infrastructure as Code files;
4444

4545
The `snyk code test` command finds security issues using Static Code Analysis.
4646

47+
### [`snyk issues`](issues.md)
48+
49+
These commands manage Snyk issues for a workspace.
50+
4751
### [`snyk sbom`](sbom.md)
4852

4953
Generate or test an SBOM document in ecosystems supported by Snyk.

help/cli-commands/issues-create.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Issues create
2+
3+
## Usage
4+
5+
`snyk issues create [<OPTIONS>]`
6+
7+
## Description
8+
9+
The `snyk issues create` command creates Snyk issues from a workspace.
10+
11+
Run this command in a workspace context to create issues for findings that are available to the CLI.
12+
13+
## Examples
14+
15+
Create issues from the current workspace:
16+
17+
`$ snyk issues create`
18+
19+
Create issues from the current workspace for a specific Organization:
20+
21+
`$ snyk issues create --org=00000000-0000-0000-0000-000000000000`

help/cli-commands/issues.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Issues
2+
3+
## Usage
4+
5+
`snyk issues <COMMAND> [<OPTIONS>]`
6+
7+
## Description
8+
9+
The `snyk issues` commands manage Snyk issues for a workspace.
10+
11+
Use these commands to create issues from the workspace context available to the CLI.
12+
13+
## `snyk issues` commands and the help docs
14+
15+
The `snyk issues` commands are listed here with the help options:
16+
17+
- [`snyk issues create`](issues-create.md); `snyk issues create --help`: creates Snyk issues from a workspace

src/cli/modes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ const modes: Record<string, ModeData> = {
3838
return args;
3939
},
4040
},
41+
issues: {
42+
allowedCommands: ['create'],
43+
config: (args): [] => args,
44+
},
4145
};
4246

4347
export function parseMode(mode: string, args): string {

test/jest/acceptance/help.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ describe('help', () => {
5757
expect(stderr).toBe('');
5858
});
5959

60+
it('prints specific help info for issues', async () => {
61+
const { stdout, code, stderr } = await runSnykCLI('issues --help');
62+
63+
expect(stdout).toContain('snyk issues create');
64+
expect(code).toBe(0);
65+
expect(stderr).toBe('');
66+
});
67+
68+
it('prints specific help info for issues create', async () => {
69+
const { stdout, code, stderr } = await runSnykCLI('issues create --help');
70+
71+
expect(stdout).toContain('Issues create');
72+
expect(stdout).toContain('snyk issues create [<OPTIONS>]');
73+
expect(code).toBe(0);
74+
expect(stderr).toBe('');
75+
});
76+
6077
it('prints specific help info when called with flag and equals sign', async () => {
6178
const { stdout, code, stderr } = await runSnykCLI('--help=iac');
6279

test/tap/args.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,23 @@ test('test command line "iac test --help" should display help for mode', (t) =>
482482
t.end();
483483
});
484484

485+
test('test command line "issues --help" should display help for mode', (t) => {
486+
const cliArgs = [
487+
'/Users/dror/.nvm/versions/node/v6.9.2/bin/node',
488+
'/Users/dror/work/snyk/snyk-internal/cli',
489+
'issues',
490+
'--help',
491+
];
492+
const result = args(cliArgs);
493+
t.equal(result.command, 'help', 'command should be replaced by help');
494+
t.equal(
495+
result.options.help,
496+
'issues',
497+
'help option should be assigned to issues',
498+
);
499+
t.end();
500+
});
501+
485502
test('test command line "snyk iac --experimental" should be true on options', (t) => {
486503
const cliArgsWithFlag = [
487504
'/Users/dror/.nvm/versions/node/v6.9.2/bin/node',

0 commit comments

Comments
 (0)