Added a check to make sure that editor was set.
This commit is contained in:
parent
7fecc60495
commit
bc1a837b68
|
@ -63,6 +63,12 @@ module Qwandry
|
||||||
# check against the environment by default.
|
# check against the environment by default.
|
||||||
def launch(package, editor=nil)
|
def launch(package, editor=nil)
|
||||||
editor ||= @editor || ENV['VISUAL'] || ENV['EDITOR']
|
editor ||= @editor || ENV['VISUAL'] || ENV['EDITOR']
|
||||||
|
|
||||||
|
if (!editor) || (editor =~ /^\s*$/) # if the editor is not set, or is blank, exit with a message:
|
||||||
|
puts "Please either set EDITOR or pass in an editor to use"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
paths = package.is_a?(String) ? [package] : package.paths
|
paths = package.is_a?(String) ? [package] : package.paths
|
||||||
system editor, *paths
|
system editor, *paths
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue