Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Refactor initial code
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Oct 2, 2018
1 parent 2dd62a3 commit fd9adf0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,18 +292,16 @@ def update(*gems)
def show(gem_name = nil)
if ARGV[0] == "show"
rest = ARGV[1..-1]
alternative = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"

new_argv = [alternative, *rest]
new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"

if alternative == "list" && rest.include?("--paths")
new_argv.delete("--paths")
else
new_argv = new_argv.map {|arg| arg == "--paths" ? "--path" : arg }
new_arguments = rest.map do |arg|
next arg if arg != "--paths"
next "--path" if new_command == "info"
end

old_argv = ARGV.join(" ")
new_argv = new_argv.join(" ")
new_argv = [new_command, *new_arguments.compact].join(" ")

Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
end
Expand Down

0 comments on commit fd9adf0

Please sign in to comment.