aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2017-10-17 22:51:19 +0200
committerGitHub2017-10-17 22:51:19 +0200
commitcf349018d5cc508ddd2bd0797df47688b9f7346b (patch)
tree5df188726fb043fa2416b5e03314d91e41ed68ec /Library
parent69d28f9d8f0c13c1d38dda08470f9dd774eae683 (diff)
parent8c3c72ec00430065d2f653ae1352662a4dd205d0 (diff)
downloadbrew-cf349018d5cc508ddd2bd0797df47688b9f7346b.tar.bz2
Merge pull request #3323 from reitermarkus/edit-invalid-cask
Allow editing invalid Casks.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/edit.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/edit.rb b/Library/Homebrew/cask/lib/hbc/cli/edit.rb
index 8bce81c52..693edcd51 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/edit.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/edit.rb
@@ -8,9 +8,6 @@ module Hbc
end
def run
- 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} "
@@ -18,6 +15,14 @@ module Hbc
raise e.class.new(e.token, reason)
end
+ def cask_path
+ casks.first.sourcefile_path
+ rescue CaskInvalidError
+ path = CaskLoader.path(args.first)
+ return path if path.file?
+ raise
+ end
+
def self.help
"edits the given Cask"
end