summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-04-13 13:28:46 -0600
committermo khan <mo.khan@gmail.com>2020-04-13 13:28:46 -0600
commit98baafef34d054f78fb7e8be50bfcb6bfdd6dcc0 (patch)
tree022ea4e78688d24661445d1e289dcce73655e94c
parent1b517a1c930df07607b2a0ec181bf2c02fb8430b (diff)
add --require option to load custom libraries
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/spandx/cli/commands/scan.rb1
-rw-r--r--lib/spandx/cli/main.rb3
3 files changed, 4 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ad8ea8f..1ad3c9b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add support for parsing `package-lock.json` files.
- Add `--pull` option to fetch latest cache before scan.
- Add support for parsing `composer.lock` files.
+- Add support for loading custom plugins via the `--require` option.
### Changed
- Change the default `--format` to `table` for the scan command.
diff --git a/lib/spandx/cli/commands/scan.rb b/lib/spandx/cli/commands/scan.rb
index 91d4ad9..12882e9 100644
--- a/lib/spandx/cli/commands/scan.rb
+++ b/lib/spandx/cli/commands/scan.rb
@@ -9,6 +9,7 @@ module Spandx
def initialize(scan_path, options)
@scan_path = ::Pathname.new(scan_path)
@options = options
+ require(options[:require]) if options[:require]
end
def execute(output: $stdout)
diff --git a/lib/spandx/cli/main.rb b/lib/spandx/cli/main.rb
index c35c807..14d9838 100644
--- a/lib/spandx/cli/main.rb
+++ b/lib/spandx/cli/main.rb
@@ -5,11 +5,12 @@ module Spandx
class Main < Thor
desc 'scan LOCKFILE', 'Scan a lockfile and list dependencies/licenses'
method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information'
- method_option :recursive, aliases: '-r', type: :boolean, desc: 'Perform recursive scan', default: false
+ method_option :recursive, aliases: '-R', type: :boolean, desc: 'Perform recursive scan', default: false
method_option :airgap, aliases: '-a', type: :boolean, desc: 'Disable network connections', default: false
method_option :logfile, aliases: '-l', type: :string, desc: 'Path to a logfile', default: '/dev/null'
method_option :format, aliases: '-f', type: :string, desc: 'Format of report', default: 'table'
method_option :pull, aliases: '-p', type: :boolean, desc: 'Pull the latest cache before the scan', default: false
+ method_option :require, aliases: '-r', type: :string, desc: 'Causes spandx to load the library using require.', default: nil
def scan(lockfile)
if options[:help]
invoke :help, ['scan']