Skip to content

Commit bfc7586

Browse files
committed
revisit CLI options
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 08ab232 commit bfc7586

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ $ yarn CycloneDX make-sbom
5757
5858
━━━ Options ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5959
60-
--spec-version #0 Which version of CycloneDX spec to use.
60+
--spec-version #0 Which version of CycloneDX to use.
6161
(choices: "1.2", "1.3", "1.4", "1.5", default: "1.5")
6262
--output-format #0 Which output format to use.
6363
(choices: "JSON", "XML", default: "JSON")
6464
--output-file #0 Path to the output file. Set to "-" to write to STDOUT.
6565
(default: write to STDOUT)
6666
--production,--prod Exclude development dependencies.
67+
(defaults to 'true' if the environment variable "NODE_ENV" is set to "production"')
6768
--component-type #0 Type of component described by the generated SBOM. (choices: "application", "framework", "library", "container", "platform", "device-driver")
6869
Default: application
6970
--licenses Include license information for components in generated SBOM. License information will always be absent for components that don't specify licenses unambigously.

sources/index.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
import { PortablePath, ppath } from "@yarnpkg/fslib";
3030
import { Command, Option, Usage } from "clipanion";
3131
import { OutputOptions, generateSBOM, stdOutOutput } from "./sbom";
32+
import * as process from "process";
3233

3334
class SBOMCommand extends BaseCommand {
3435
static readonly paths = [
@@ -43,7 +44,7 @@ class SBOMCommand extends BaseCommand {
4344
});
4445

4546
specVersion = Option.String("--spec-version", {
46-
description: `Which version of CycloneDX spec to use.
47+
description: `Which version of CycloneDX to use.
4748
4849
(choices: "1.2", "1.3", "1.4", "1.5", default: "1.5")`,
4950
});
@@ -60,8 +61,14 @@ class SBOMCommand extends BaseCommand {
6061
(default: write to STDOUT)`,
6162
});
6263

63-
production = Option.Boolean(`--production,--prod`, false, {
64-
description: `Exclude development dependencies.`,
64+
/* mimic option from yarn.
65+
- see https://classic.yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-production-true-false
66+
- see https://yarnpkg.com/cli/workspaces/focus
67+
*/
68+
production = Option.Boolean(`--production,--prod`, process.env.NODE_ENV=='production', {
69+
description: `Exclude development dependencies.
70+
71+
(defaults to 'true' if the environment variable "NODE_ENV" is set to "production"')`,
6572
});
6673

6774
componentType = Option.String("--component-type", {

0 commit comments

Comments
 (0)