From 91446259401f7dcb348bb82cc0dc9d835164d705 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:30:18 +0000 Subject: [PATCH] log: use CLI::Parser. --- Library/Homebrew/cmd/log.rb | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cmd/log.rb b/Library/Homebrew/cmd/log.rb index 898e921ba7..e1fd65b09c 100644 --- a/Library/Homebrew/cmd/log.rb +++ b/Library/Homebrew/cmd/log.rb @@ -1,13 +1,30 @@ -#: * `log` [] ...: -#: Show the git log for the given formulae. Options that `git-log`(1) -#: recognizes can be passed before the formula list. - require "formula" +require "cli_parser" module Homebrew module_function + def log_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `log` [] + + Show the `git log` for the given . + EOS + switch "-p", "-u", "--patch", + description: "Also output patch from commit." + switch "--stat", + description: "Also output diffstat from commit." + switch "--oneline", + description: "Output only one line per commit." + switch "-1", "--max-count=1", + description: "Output only one commit." + end + end + def log + log_args.parse + if ARGV.named.empty? git_log HOMEBREW_REPOSITORY else