summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2021-12-24 14:19:09 -0700
committermo khan <mo@mokhan.ca>2021-12-24 14:19:09 -0700
commit823be8312058e8101e4d968201a67e7cb90f2385 (patch)
tree199c43b34b64aaa84f9dd2c652b06a8aefabee62
parent8c3b6b6b1dcc19f4bd1caa86e12059634098eb67 (diff)
feat: add --verbose option
-rw-r--r--lib/dependabot/cli.rb2
-rw-r--r--spec/fixtures/help-scan.expected1
-rw-r--r--spec/fixtures/help.expected5
-rw-r--r--spec/integration/dependabot/cli_spec.rb5
4 files changed, 10 insertions, 3 deletions
diff --git a/lib/dependabot/cli.rb b/lib/dependabot/cli.rb
index 67d6339..1419162 100644
--- a/lib/dependabot/cli.rb
+++ b/lib/dependabot/cli.rb
@@ -11,7 +11,9 @@ module Dependabot
method_option :dependency, aliases: "-d", type: :string, desc: "Update a specific dependency", default: nil
method_option :push, aliases: "-p", type: :boolean, desc: "Push the update as a pull request. Default: --no-push", default: false
method_option :recursive, aliases: "-r", type: :boolean, desc: "Perform a recursive. Default: --no-recursive", default: false
+ method_option :verbose, aliases: "-v", type: :boolean, desc: "Increase verbosity. Default: --no-verbose", default: false
def scan(path = Pathname.pwd)
+ Dependabot.logger.level = :debug if options[:verbose]
::Dependabot::CLI::Scan.new(path, options).run
end
diff --git a/spec/fixtures/help-scan.expected b/spec/fixtures/help-scan.expected
index b719aa7..2d2e4ee 100644
--- a/spec/fixtures/help-scan.expected
+++ b/spec/fixtures/help-scan.expected
@@ -5,5 +5,6 @@ Options:
-d, [--dependency=DEPENDENCY] # Update a specific dependency
-p, [--push], [--no-push] # Push the update as a pull request. Default: --no-push
-r, [--recursive], [--no-recursive] # Perform a recursive. Default: --no-recursive
+ -v, [--verbose], [--no-verbose] # Increase verbosity. Default: --no-verbose
Scan a directory or file for dependencies to update
diff --git a/spec/fixtures/help.expected b/spec/fixtures/help.expected
new file mode 100644
index 0000000..3216ee6
--- /dev/null
+++ b/spec/fixtures/help.expected
@@ -0,0 +1,5 @@
+Commands:
+ dependabot help [COMMAND] # Describe available commands or one specific command
+ dependabot scan [OPTION]... [FILE] # Scan a directory or file for dependencies to update
+ dependabot version # Print the current version
+
diff --git a/spec/integration/dependabot/cli_spec.rb b/spec/integration/dependabot/cli_spec.rb
index 0d6b8a0..b1de7ec 100644
--- a/spec/integration/dependabot/cli_spec.rb
+++ b/spec/integration/dependabot/cli_spec.rb
@@ -1,9 +1,8 @@
# frozen_string_literal: true
RSpec.describe Dependabot::CLI, type: :cli do
- it "executes `dependabot help scan` command successfully" do
- expect(`./exe/dependabot help scan`).to eq(fixture_file_content("help-scan.expected"))
- end
+ it { expect(`./exe/dependabot help scan`).to eq(fixture_file_content("help-scan.expected")) }
+ it { expect(`./exe/dependabot help`).to eq(fixture_file_content("help.expected")) }
describe Dependabot::CLI::Scan do
subject!(:dependabot) { File.join(Dir.pwd, "exe/dependabot") }