Merge pull request #3970 from GauthamGoli/edit-args

edit: Use Parser to parse args
This commit is contained in:
Mike McQuaid 2018-03-24 16:21:10 +00:00 committed by GitHub
commit 121780b417
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,11 +5,16 @@
#: Open <formula> in the editor.
require "formula"
require "cli_parser"
module Homebrew
module_function
def edit
args = Homebrew::CLI::Parser.new do
switch "--force"
end.parse
unless (HOMEBREW_REPOSITORY/".git").directory?
raise <<~EOS
Changes will be lost!
@ -36,7 +41,7 @@ module Homebrew
paths = ARGV.named.map do |name|
path = Formulary.path(name)
raise FormulaUnavailableError, name unless path.file? || ARGV.force?
raise FormulaUnavailableError, name unless path.file? || args.force?
path
end