class Bundler::CLI

def self.handle_no_command_error(command, has_namespace = $thor_runner)

def self.handle_no_command_error(command, has_namespace = $thor_runner)
  return super unless command_path = Bundler.which("bundler-#{command}")
  Kernel.exec(command_path, *ARGV[1..-1])
end

def self.source_root

def self.source_root
  File.expand_path(File.join(File.dirname(__FILE__), "templates"))
end

def self.start(*)

def self.start(*)
  super
rescue Exception => e
  Bundler.ui = UI::Shell.new
  raise e
end

def auto_install

`Installer` that'll keep a reference to the old one instead.
should be called first, before you instantiate anything like an
Note that this method `nil`s out the global Definition object, so it

`bundle config auto_install 1`.
Bundler.settings[:auto_install] exists. This is set through config cmd
Automatically invoke `bundle install` and resume if
def auto_install
  return unless Bundler.settings[:auto_install]
  begin
    Bundler.definition.specs
  rescue GemNotFound
    Bundler.ui.info "Automatically installing missing gems."
    Bundler.reset!
    invoke :install, []
    Bundler.reset!
  end
end

def binstubs(*gems)

def binstubs(*gems)
  require "bundler/cli/binstubs"
  Binstubs.new(options, gems).run
end

def cache

def cache
  require "bundler/cli/cache"
  Cache.new(options).run
end

def check

def check
  require "bundler/cli/check"
  Check.new(options).run
end

def clean

def clean
  require "bundler/cli/clean"
  Clean.new(options.dup).run
end

def config(*args)

def config(*args)
  require "bundler/cli/config"
  Config.new(options, args, self).run
end

def console(group = nil)

def console(group = nil)
  require "bundler/cli/console"
  Console.new(options, group).run
end

def env

def env
  Env.new.write($stdout)
end

def exec(*args)

def exec(*args)
  require "bundler/cli/exec"
  Exec.new(options, args).run
end

def gem(name)

def gem(name)
  require "bundler/cli/gem"
  Gem.new(options, name, self).run
end

def help(cli = nil)

def help(cli = nil)
  case cli
  when "gemfile" then command = "gemfile.5"
  when nil       then command = "bundle"
  else command = "bundle-#{cli}"
  end
  manpages = %w(
    bundle
    bundle-config
    bundle-exec
    bundle-gem
    bundle-install
    bundle-package
    bundle-update
    bundle-platform
    gemfile.5)
  if manpages.include?(command)
    root = File.expand_path("../man", __FILE__)
    if Bundler.which("man") && root !~ %r{^file:/.+!/META-INF/jruby.home/.+}
      Kernel.exec "man #{root}/#{command}"
    else
      puts File.read("#{root}/#{command}.txt")
    end
  elsif command_path = Bundler.which("bundler-#{cli}")
    Kernel.exec(command_path, "--help")
  else
    super
  end
end

def init

def init
  require "bundler/cli/init"
  Init.new(options.dup).run
end

def initialize(*args)

def initialize(*args)
  super
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
  ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile) if custom_gemfile && !custom_gemfile.empty?
  Bundler.settings[:retry] = options[:retry] if options[:retry]
  current_cmd = args.last[:current_command].name
  auto_install if AUTO_INSTALL_CMDS.include?(current_cmd)
rescue UnknownArgumentError => e
  raise InvalidOption, e.message
ensure
  self.options ||= {}
  Bundler.ui = UI::Shell.new(options)
  Bundler.ui.level = "debug" if options["verbose"]
  if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty?
    Bundler.ui.warn(
      "The RUBYGEMS_GEMDEPS environment variable is set. This enables RubyGems' " \
      "experimental Gemfile mode, which may conflict with Bundler and cause unexpected errors. " \
      "To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true)
  end
end

def inject(name, version, *gems)

def inject(name, version, *gems)
  require "bundler/cli/inject"
  Inject.new(options, name, version, gems).run
end

def install

def install
  require "bundler/cli/install"
  Install.new(options.dup).run
end

def licenses

def licenses
  Bundler.load.specs.sort_by {|s| s.license.to_s }.reverse_each do |s|
    gem_name = s.name
    license  = s.license || s.licenses
    if license.empty?
      Bundler.ui.warn "#{gem_name}: Unknown"
    else
      Bundler.ui.info "#{gem_name}: #{license}"
    end
  end
end

def lock

def lock
  require "bundler/cli/lock"
  Lock.new(options).run
end

def open(name)

def open(name)
  require "bundler/cli/open"
  Open.new(options, name).run
end

def outdated(*gems)

def outdated(*gems)
  require "bundler/cli/outdated"
  Outdated.new(options, gems).run
end

def package

def package
  require "bundler/cli/package"
  Package.new(options).run
end

def platform

def platform
  require "bundler/cli/platform"
  Platform.new(options).run
end

def show(gem_name = nil)

def show(gem_name = nil)
  require "bundler/cli/show"
  Show.new(options, gem_name).run
end

def update(*gems)

def update(*gems)
  require "bundler/cli/update"
  Update.new(options, gems).run
end

def version

def version
  Bundler.ui.info "Bundler version #{Bundler::VERSION}"
end

def viz

def viz
  require "bundler/cli/viz"
  Viz.new(options).run
end