summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/open_command.rb
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/commands/open_command.rb18
1 files changed, 9 insertions, 9 deletions
@@ -1,18 +1,18 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../version_option'
class Gem::Commands::OpenCommand < Gem::Command
include Gem::VersionOption
def initialize
- super 'open', 'Open gem sources in editor'
- add_option('-e', '--editor COMMAND', String,
"Prepends COMMAND to gem path. Could be used to specify editor.") do |command, options|
options[:editor] = command || get_env_editor
end
- add_option('-v', '--version VERSION', String,
"Opens specific gem version") do |version|
options[:version] = version
end
@@ -40,10 +40,10 @@ class Gem::Commands::OpenCommand < Gem::Command
end
def get_env_editor
- ENV['GEM_EDITOR'] ||
- ENV['VISUAL'] ||
- ENV['EDITOR'] ||
- 'vi'
end
def execute