log: use CLI::Parser.
This commit is contained in:
parent
dbd8de7148
commit
9144625940
@ -1,13 +1,30 @@
|
|||||||
#: * `log` [<git-log-options>] <formula> ...:
|
|
||||||
#: Show the git log for the given formulae. Options that `git-log`(1)
|
|
||||||
#: recognizes can be passed before the formula list.
|
|
||||||
|
|
||||||
require "formula"
|
require "formula"
|
||||||
|
require "cli_parser"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
def log_args
|
||||||
|
Homebrew::CLI::Parser.new do
|
||||||
|
usage_banner <<~EOS
|
||||||
|
`log` [<options>] <formula>
|
||||||
|
|
||||||
|
Show the `git log` for the given <formula>.
|
||||||
|
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
|
def log
|
||||||
|
log_args.parse
|
||||||
|
|
||||||
if ARGV.named.empty?
|
if ARGV.named.empty?
|
||||||
git_log HOMEBREW_REPOSITORY
|
git_log HOMEBREW_REPOSITORY
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user