Skip to content

Commit e62338d

Browse files
committed
fix: fixtures and add 3 test cases
1 parent 1c82087 commit e62338d

3 files changed

Lines changed: 54 additions & 39 deletions

File tree

cmd/kosli/testdata/output/docs/mintlify/artifact.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ registry without needing a local Docker daemon.
3333
## Flags
3434
| Flag | Description |
3535
| :--- | :--- |
36-
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [oci, docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
37-
| -b, --build-url string | The url of CI pipeline that built the artifact. (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
38-
| -u, --commit-url string | The url for the git commit that created the artifact. (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
39-
| -D, --dry-run | [optional] Run in dry-run mode. When enabled, no data is sent to Kosli and the CLI exits with 0 exit code regardless of any errors. |
40-
| -x, --exclude strings | [optional] The comma separated list of directories and files to exclude from fingerprinting. Can take glob patterns. Only applicable for --artifact-type dir. |
41-
| -F, --fingerprint string | [conditional] The SHA256 fingerprint of the artifact. Only required if you don't specify '--artifact-type'. |
42-
| -f, --flow string | The Kosli flow name. |
43-
| -g, --git-commit string | [defaulted] The git commit from which the artifact was created. (defaulted in some CIs: [docs](/integrations/ci_cd), otherwise defaults to HEAD ). |
44-
| -h, --help | help for artifact |
45-
| -n, --name string | [optional] Artifact display name, if different from file, image or directory name. |
46-
| --registry-password string | [conditional] The container registry password or access token. Only required if you want to read container image SHA256 digest from a remote container registry. |
47-
| --registry-username string | [conditional] The container registry username. Only required if you want to read container image SHA256 digest from a remote container registry. |
48-
| --repo-root string | [defaulted] The directory where the source git repository is available. (default ".") |
36+
| `-t`, `--artifact-type` string | The type of the artifact to calculate its SHA256 fingerprint. One of: [oci, docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '`--fingerprint`' on commands that allow it). |
37+
| `-b`, `--build-url` string | The url of CI pipeline that built the artifact. (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
38+
| `-u`, `--commit-url` string | The url for the git commit that created the artifact. (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
39+
| `-D`, `--dry-run` | [optional] Run in dry-run mode. When enabled, no data is sent to Kosli and the CLI exits with 0 exit code regardless of any errors. |
40+
| `-x`, `--exclude` strings | [optional] The comma separated list of directories and files to exclude from fingerprinting. Can take glob patterns. Only applicable for `--artifact-type` dir. |
41+
| `-F`, `--fingerprint` string | [conditional] The SHA256 fingerprint of the artifact. Only required if you don't specify '`--artifact-type`'. |
42+
| `-f`, `--flow` string | The Kosli flow name. |
43+
| `-g`, `--git-commit` string | [defaulted] The git commit from which the artifact was created. (defaulted in some CIs: [docs](/integrations/ci_cd), otherwise defaults to HEAD ). |
44+
| `-h`, `--help` | help for artifact |
45+
| `-n`, `--name` string | [optional] Artifact display name, if different from file, image or directory name. |
46+
| `--registry-password` string | [conditional] The container registry password or access token. Only required if you want to read container image SHA256 digest from a remote container registry. |
47+
| `--registry-username` string | [conditional] The container registry username. Only required if you want to read container image SHA256 digest from a remote container registry. |
48+
| `--repo-root` string | [defaulted] The directory where the source git repository is available. (default ".") |
4949

5050

5151
## Examples Use Cases

cmd/kosli/testdata/output/docs/mintlify/snyk.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,32 @@ In other CI systems, set them explicitly to capture repository metadata.
3737
## Flags
3838
| Flag | Description |
3939
| :--- | :--- |
40-
| --annotate stringToString | [optional] Annotate the attestation with data using key=value. |
41-
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [oci, docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
42-
| --attachments strings | [optional] The comma-separated list of paths of attachments for the reported attestation. Attachments can be files or directories. All attachments are compressed and uploaded to Kosli's evidence vault. |
43-
| -g, --commit string | [conditional] The git commit for which the attestation is associated to. Becomes required when reporting an attestation for an artifact before reporting it to Kosli. (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
44-
| --description string | [optional] attestation description |
45-
| -D, --dry-run | [optional] Run in dry-run mode. When enabled, no data is sent to Kosli and the CLI exits with 0 exit code regardless of any errors. |
46-
| -x, --exclude strings | [optional] The comma separated list of directories and files to exclude from fingerprinting. Can take glob patterns. Only applicable for --artifact-type dir. |
47-
| --external-fingerprint stringToString | [optional] A SHA256 fingerprint of an external attachment represented by --external-url. The format is label=fingerprint (labels cannot contain '.' or '='). This flag can be set multiple times. There must be an external url with a matching label for each external fingerprint. |
48-
| --external-url stringToString | [optional] Add labeled reference URL for an external resource. The format is label=url (labels cannot contain '.' or '='). This flag can be set multiple times. If the resource is a file or dir, you can optionally add its fingerprint via --external-fingerprint |
49-
| -F, --fingerprint string | [conditional] The SHA256 fingerprint of the artifact to attach the attestation to. Only required if the attestation is for an artifact and --artifact-type and artifact name/path are not used. |
50-
| -f, --flow string | The Kosli flow name. |
51-
| -h, --help | help for snyk |
52-
| -n, --name string | The name of the attestation as declared in the flow or trail yaml template. |
53-
| -o, --origin-url string | [optional] The url pointing to where the attestation came from or is related. (defaulted to the CI url in some CIs: [docs](/integrations/ci_cd/#defaulted-kosli-command-flags-from-ci-variables) ). |
54-
| --redact-commit-info strings | [optional] The list of commit info to be redacted before sending to Kosli. Allowed values are one or more of [author, message, branch]. |
55-
| --registry-password string | [conditional] The container registry password or access token. Only required if you want to read container image SHA256 digest from a remote container registry. |
56-
| --registry-username string | [conditional] The container registry username. Only required if you want to read container image SHA256 digest from a remote container registry. |
57-
| --repo-id string | [conditional] The stable, unique identifier for the repository in your VCS provider (e.g. a numeric ID). Do not use the repository name as it can change if the repo is renamed. All three of --repo-id, --repo-url and --repository must be set to record repository information (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
58-
| --repo-provider string | [optional] The source code hosting provider. One of: github, gitlab, bitbucket, azure-devops (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
59-
| --repo-root string | [defaulted] The directory where the source git repository is available. Only used if --commit is used or defaulted in CI, see [docs](/integrations/ci_cd/#defaulted-kosli-command-flags-from-ci-variables) . (default ".") |
60-
| --repo-url string | [conditional] The URL of the repository. Must be a valid URL. All three of --repo-id, --repo-url and --repository must be set to record repository information (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
61-
| --repository string | [conditional] The name of the repository (e.g. owner/repo-name). All three of --repo-id, --repo-url and --repository must be set to record repository information (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
62-
| -R, --scan-results string | The path to Snyk scan SARIF results file from 'snyk test' and 'snyk container test'. By default, the Snyk results will be uploaded to Kosli's evidence vault. |
63-
| -T, --trail string | The Kosli trail name. |
64-
| --upload-results | [defaulted] Whether to upload the provided Snyk results file as an attachment to Kosli or not. (default true) |
65-
| -u, --user-data string | [optional] The path to a JSON file containing additional data you would like to attach to the attestation. |
40+
| `--annotate` stringToString | [optional] Annotate the attestation with data using key=value. |
41+
| `-t`, `--artifact-type` string | The type of the artifact to calculate its SHA256 fingerprint. One of: [oci, docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '`--fingerprint`' on commands that allow it). |
42+
| `--attachments` strings | [optional] The comma-separated list of paths of attachments for the reported attestation. Attachments can be files or directories. All attachments are compressed and uploaded to Kosli's evidence vault. |
43+
| `-g`, `--commit` string | [conditional] The git commit for which the attestation is associated to. Becomes required when reporting an attestation for an artifact before reporting it to Kosli. (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
44+
| `--description` string | [optional] attestation description |
45+
| `-D`, `--dry-run` | [optional] Run in dry-run mode. When enabled, no data is sent to Kosli and the CLI exits with 0 exit code regardless of any errors. |
46+
| `-x`, `--exclude` strings | [optional] The comma separated list of directories and files to exclude from fingerprinting. Can take glob patterns. Only applicable for `--artifact-type` dir. |
47+
| `--external-fingerprint` stringToString | [optional] A SHA256 fingerprint of an external attachment represented by `--external-url`. The format is label=fingerprint (labels cannot contain '.' or '='). This flag can be set multiple times. There must be an external url with a matching label for each external fingerprint. |
48+
| `--external-url` stringToString | [optional] Add labeled reference URL for an external resource. The format is label=url (labels cannot contain '.' or '='). This flag can be set multiple times. If the resource is a file or dir, you can optionally add its fingerprint via `--external-fingerprint` |
49+
| `-F`, `--fingerprint` string | [conditional] The SHA256 fingerprint of the artifact to attach the attestation to. Only required if the attestation is for an artifact and `--artifact-type` and artifact name/path are not used. |
50+
| `-f`, `--flow` string | The Kosli flow name. |
51+
| `-h`, `--help` | help for snyk |
52+
| `-n`, `--name` string | The name of the attestation as declared in the flow or trail yaml template. |
53+
| `-o`, `--origin-url` string | [optional] The url pointing to where the attestation came from or is related. (defaulted to the CI url in some CIs: [docs](/integrations/ci_cd/#defaulted-kosli-command-flags-from-ci-variables) ). |
54+
| `--redact-commit-info` strings | [optional] The list of commit info to be redacted before sending to Kosli. Allowed values are one or more of [author, message, branch]. |
55+
| `--registry-password` string | [conditional] The container registry password or access token. Only required if you want to read container image SHA256 digest from a remote container registry. |
56+
| `--registry-username` string | [conditional] The container registry username. Only required if you want to read container image SHA256 digest from a remote container registry. |
57+
| `--repo-id` string | [conditional] The stable, unique identifier for the repository in your VCS provider (e.g. a numeric ID). Do not use the repository name as it can change if the repo is renamed. All three of `--repo-id`, `--repo-url` and `--repository` must be set to record repository information (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
58+
| `--repo-provider` string | [optional] The source code hosting provider. One of: github, gitlab, bitbucket, azure-devops (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
59+
| `--repo-root` string | [defaulted] The directory where the source git repository is available. Only used if `--commit` is used or defaulted in CI, see [docs](/integrations/ci_cd/#defaulted-kosli-command-flags-from-ci-variables) . (default ".") |
60+
| `--repo-url` string | [conditional] The URL of the repository. Must be a valid URL. All three of `--repo-id`, `--repo-url` and `--repository` must be set to record repository information (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
61+
| `--repository` string | [conditional] The name of the repository (e.g. owner/repo-name). All three of `--repo-id`, `--repo-url` and `--repository` must be set to record repository information (defaulted in some CIs: [docs](/integrations/ci_cd) ). |
62+
| `-R`, `--scan-results` string | The path to Snyk scan SARIF results file from 'snyk test' and 'snyk container test'. By default, the Snyk results will be uploaded to Kosli's evidence vault. |
63+
| `-T`, `--trail` string | The Kosli trail name. |
64+
| `--upload-results` | [defaulted] Whether to upload the provided Snyk results file as an attachment to Kosli or not. (default true) |
65+
| `-u`, `--user-data` string | [optional] The path to a JSON file containing additional data you would like to attach to the attestation. |
6666

6767

6868
## Examples Use Cases

internal/docgen/mintlify_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,21 @@ func TestBacktickFlags(t *testing.T) {
278278
input: "use -h for help",
279279
want: "use `-h` for help",
280280
},
281+
{
282+
name: "bare double-dash is not a flag",
283+
input: "use -- to separate flags from args",
284+
want: "use -- to separate flags from args",
285+
},
286+
{
287+
name: "flag with equals value",
288+
input: "use --output=json here",
289+
want: "use `--output`=json here",
290+
},
291+
{
292+
name: "numeric arg is not a flag",
293+
input: "use -1 for default",
294+
want: "use -1 for default",
295+
},
281296
}
282297
for _, tt := range tests {
283298
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)