From 56fb2cb67c728f73a1f018eb0da26644ff2ea3c8 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sat, 24 Mar 2018 19:38:34 +0530 Subject: [PATCH] edit: Use Parser to parse args --- Library/Homebrew/dev-cmd/edit.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/edit.rb b/Library/Homebrew/dev-cmd/edit.rb index 0039b4cce6..53af54811b 100644 --- a/Library/Homebrew/dev-cmd/edit.rb +++ b/Library/Homebrew/dev-cmd/edit.rb @@ -5,11 +5,16 @@ #: Open 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