aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli/edit.rb
diff options
context:
space:
mode:
authorGautham Goli2017-10-12 00:29:19 +0530
committerGautham Goli2017-10-13 19:50:46 +0530
commit7fa51f71f1a8a21b905bafc1fb4106f0222d654f (patch)
tree098d2477a8262a5770310fed4693da31c4392e1c /Library/Homebrew/cask/lib/hbc/cli/edit.rb
parentafdd0e2437426ec85ff86e5b7562d3a6a69ba3e5 (diff)
parent56458f03fcc68ef6d8ee3ee4a7c1d16021aa5800 (diff)
downloadbrew-7fa51f71f1a8a21b905bafc1fb4106f0222d654f.tar.bz2
Merge branch 'master' into audit_line_rubocop_part_4_rebase_attempt_1
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli/edit.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/edit.rb19
1 files changed, 8 insertions, 11 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/edit.rb b/Library/Homebrew/cask/lib/hbc/cli/edit.rb
index b9485886c..8bce81c52 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/edit.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/edit.rb
@@ -4,21 +4,18 @@ module Hbc
def initialize(*)
super
raise CaskUnspecifiedError if args.empty?
- raise ArgumentError, "Only one Cask can be created at a time." if args.count > 1
+ raise ArgumentError, "Only one Cask can be edited at a time." if args.count > 1
end
def run
- cask_token = args.first
- cask_path = begin
- CaskLoader.load(cask_token).sourcefile_path
- rescue CaskUnavailableError => e
- reason = e.reason.empty? ? "" : "#{e.reason} "
- reason.concat("Run #{Formatter.identifier("brew cask create #{e.token}")} to create a new Cask.")
- raise e.class.new(e.token, reason)
- end
-
- odebug "Opening editor for Cask #{cask_token}"
+ cask = casks.first
+ cask_path = cask.sourcefile_path
+ odebug "Opening editor for Cask #{cask.token}"
exec_editor cask_path
+ rescue CaskUnavailableError => e
+ reason = e.reason.empty? ? "" : "#{e.reason} "
+ reason.concat("Run #{Formatter.identifier("brew cask create #{e.token}")} to create a new Cask.")
+ raise e.class.new(e.token, reason)
end
def self.help