From 32e5a5686bf73cb165e750f0ee8715ca9d9b8fac Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Thu, 28 Jun 2018 09:28:19 +0530 Subject: [PATCH 01/18] audit: Use OptionParser to generate help text --- Library/Homebrew/brew.rb | 2 +- Library/Homebrew/cli_parser.rb | 34 +++++++++++++++++++++++-------- Library/Homebrew/dev-cmd/audit.rb | 28 ++++++++++++++++--------- 3 files changed, 44 insertions(+), 20 deletions(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index e1058ef5f6..6ff6e763dd 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -73,7 +73,7 @@ begin # - a help flag is passed AND there is no command specified # - no arguments are passed # - if cmd is Cask, let Cask handle the help command instead - if (empty_argv || help_flag) && cmd != "cask" + if (empty_argv || help_flag) && cmd != "cask" && !internal_dev_cmd require "help" Homebrew::Help.help cmd, empty_argv: empty_argv # `Homebrew.help` never returns, except for external/unknown commands. diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index fb260d35d8..f9bb03133e 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -17,13 +17,21 @@ module Homebrew @constraints = [] @conflicts = [] instance_eval(&block) + post_initialize + end + + def post_initialize + @parser.on_tail("-h", "--help", "Show this message") do + puts @parser + exit + end end def switch(*names, description: nil, env: nil, required_for: nil, depends_on: nil) - description = option_to_description(*names) if description.nil? global_switch = names.first.is_a?(Symbol) - names, env = common_switch(*names) if global_switch - @parser.on(*names, description) do + names, env, description = common_switch(*names) if global_switch + description = option_to_description(*names) if description.nil? + @parser.on(*names, *description.split("\n")) do enable_switch(*names) end @@ -34,9 +42,13 @@ module Homebrew enable_switch(*names) if !env.nil? && !ENV["HOMEBREW_#{env.to_s.upcase}"].nil? end + def banner(text) + @parser.banner = text + end + def comma_array(name, description: nil) description = option_to_description(name) if description.nil? - @parser.on(name, OptionParser::REQUIRED_ARGUMENT, Array, description) do |list| + @parser.on(name, OptionParser::REQUIRED_ARGUMENT, Array, *description.split("\n")) do |list| Homebrew.args[option_to_name(name)] = list end end @@ -49,7 +61,7 @@ module Homebrew required = OptionParser::OPTIONAL_ARGUMENT end description = option_to_description(name) if description.nil? - @parser.on(name, description, required) do |option_value| + @parser.on(name, *description.split("\n"), required) do |option_value| Homebrew.args[option_to_name(name)] = option_value end @@ -78,6 +90,10 @@ module Homebrew names.map { |name| name.to_s.sub(/\A--?/, "").tr("-", " ") }.max end + def summary + @parser.to_s + end + def parse(cmdline_args) remaining_args = @parser.parse(cmdline_args) check_constraint_violations @@ -95,10 +111,10 @@ module Homebrew # These are common/global switches accessible throughout Homebrew def common_switch(name) case name - when :quiet then [["-q", "--quiet"], :quiet] - when :verbose then [["-v", "--verbose"], :verbose] - when :debug then [["-d", "--debug"], :debug] - when :force then [["-f", "--force"], :force] + when :quiet then [["-q", "--quiet"], :quiet, "Suppress warnings."] + when :verbose then [["-v", "--verbose"], :verbose, "Verbose mode."] + when :debug then [["-d", "--debug"], :debug, "Display debug info."] + when :force then [["-f", "--force"], :force, "Override any warnings/validations."] else name end end diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 18efdd7ee2..39da5d80e5 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -54,19 +54,27 @@ module Homebrew def audit Homebrew::CLI::Parser.parse do - switch "--strict" - switch "--online" - switch "--new-formula" - switch "--fix" - switch "--display-cop-names" - switch "--display-filename" + banner <<~EOS + Usage: brew audit [options] [] + + Check for Homebrew coding style violations. This should be + run before submitting a new formula. + + If no are provided, all of them are checked. + EOS + switch "--strict", description: "Run additional style checks, including Rubocop style checks." + switch "--online", description: "Run additional slower style checks that require a\nnetwork connection." + switch "--new-formula", description: "Run various additional style checks to determine if a new formula \nis eligible for Homebrew. This should be used when creating \nnew formula and implies --strict and --online." + switch "--fix", description: "Fix style violations automatically using\nRuboCop's auto-correct feature." + switch "--display-cop-names", description: "Include the RuboCop cop name for each violation\nin the output." + switch "--display-filename", description: "Prefix everyline of output with name of the file or\nformula being audited, to make output easy to grep." switch "-D", "--audit-debug", description: "Activates debugging and profiling" + comma_array "--only", description: "Passing --only=method will run only the methods named audit_method,\n`method` should be a comma-separated list." + comma_array "--except", description: "Passing --except=method will run only the methods named audit_method,\n`method` should be a comma-separated list." + comma_array "--only-cops", description: "Passing --only-cops=cops will check for violations of only the listed\nRuboCop cops. `cops` should be a comma-separated list of cop names." + comma_array "--except-cops", description: "Passing --except-cops=cops will skip checking the listed\nRuboCop cops violations. `cops` should be a comma-separated list of cop names." switch :verbose switch :debug - comma_array "--only" - comma_array "--except" - comma_array "--only-cops" - comma_array "--except-cops" end Homebrew.auditing = true From b6c456b6817cf0c858e377ebccd6594f2358bdde Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Mon, 30 Jul 2018 18:25:38 +0530 Subject: [PATCH 02/18] Extract out arg parsing method to _args method --- Library/Homebrew/cli_parser.rb | 3 ++- Library/Homebrew/dev-cmd/audit.rb | 9 +++++++-- Library/Homebrew/dev-cmd/bottle.rb | 8 ++++++-- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 8 ++++++-- Library/Homebrew/dev-cmd/create.rb | 11 ++++++++--- Library/Homebrew/dev-cmd/edit.rb | 8 ++++++-- Library/Homebrew/dev-cmd/formula.rb | 8 ++++++-- Library/Homebrew/dev-cmd/irb.rb | 8 ++++++-- Library/Homebrew/dev-cmd/linkage.rb | 8 ++++++-- Library/Homebrew/dev-cmd/man.rb | 11 ++++++++--- Library/Homebrew/dev-cmd/mirror.rb | 8 ++++++-- Library/Homebrew/dev-cmd/pull.rb | 12 ++++++++---- Library/Homebrew/dev-cmd/release-notes.rb | 7 +++++-- Library/Homebrew/dev-cmd/tap-new.rb | 8 ++++++-- Library/Homebrew/dev-cmd/tests.rb | 7 +++++-- Library/Homebrew/dev-cmd/update-test.rb | 8 ++++++-- 16 files changed, 97 insertions(+), 35 deletions(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index f9bb03133e..c904e879df 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -94,10 +94,11 @@ module Homebrew @parser.to_s end - def parse(cmdline_args) + def parse(cmdline_args = ARGV) remaining_args = @parser.parse(cmdline_args) check_constraint_violations Homebrew.args[:remaining] = remaining_args + @parser end private diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 39da5d80e5..b8dc3c8742 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -52,8 +52,8 @@ require "cli_parser" module Homebrew module_function - def audit - Homebrew::CLI::Parser.parse do + def audit_args + Homebrew::CLI::Parser.new do banner <<~EOS Usage: brew audit [options] [] @@ -61,6 +61,7 @@ module Homebrew run before submitting a new formula. If no are provided, all of them are checked. + EOS switch "--strict", description: "Run additional style checks, including Rubocop style checks." switch "--online", description: "Run additional slower style checks that require a\nnetwork connection." @@ -76,6 +77,10 @@ module Homebrew switch :verbose switch :debug end + end + + def audit + audit_args.parse Homebrew.auditing = true inject_dump_stats!(FormulaAuditor, /^audit_/) if args.audit_debug? diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 26ba126fdd..8c651c93f0 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -69,8 +69,8 @@ MAXIMUM_STRING_MATCHES = 100 module Homebrew module_function - def bottle - Homebrew::CLI::Parser.parse do + def bottle_args + Homebrew::CLI::Parser.new do switch "--merge" switch "--skip-relocation" switch "--force-core-tap" @@ -84,6 +84,10 @@ module Homebrew switch :debug flag "--root-url" end + end + + def bottle + bottle_args.parse return merge if args.merge? diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 5dc47299ca..107c4aabe4 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -47,8 +47,8 @@ require "cli_parser" module Homebrew module_function - def bump_formula_pr - Homebrew::CLI::Parser.parse do + def bump_formula_pr_args + Homebrew::CLI::Parser.new do switch "--devel" switch "-n", "--dry-run" switch "--write" @@ -70,6 +70,10 @@ module Homebrew conflicts "--url", "--tag" end + end + + def bump_formula_pr + bump_formula_pr_args.parse # As this command is simplifying user run commands then let's just use a # user path, too. diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 0323722bcf..08bb09168e 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -27,9 +27,8 @@ require "cli_parser" module Homebrew module_function - # Create a formula from a tarball URL - def create - Homebrew::CLI::Parser.parse do + def create_args + Homebrew::CLI::Parser.new do switch "--autotools" switch "--cmake" switch "--meson" @@ -42,6 +41,12 @@ module Homebrew flag "--set-version=" flag "--tap=" end + end + + # Create a formula from a tarball URL + def create + create_args.parse + raise UsageError if ARGV.named.empty? # Ensure that the cache exists so we can fetch the tarball diff --git a/Library/Homebrew/dev-cmd/edit.rb b/Library/Homebrew/dev-cmd/edit.rb index 62def730db..c694f054b8 100644 --- a/Library/Homebrew/dev-cmd/edit.rb +++ b/Library/Homebrew/dev-cmd/edit.rb @@ -10,12 +10,16 @@ require "cli_parser" module Homebrew module_function - def edit - Homebrew::CLI::Parser.parse do + def edit_args + Homebrew::CLI::Parser.new do switch :force switch :verbose switch :debug end + end + + def edit + edit_args.parse unless (HOMEBREW_REPOSITORY/".git").directory? raise <<~EOS diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb index 71cecdeb5d..15229271bd 100644 --- a/Library/Homebrew/dev-cmd/formula.rb +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -7,11 +7,15 @@ require "cli_parser" module Homebrew module_function - def formula - Homebrew::CLI::Parser.parse do + def formula_args + Homebrew::CLI::Parser.new do switch :debug switch :verbose end + end + + def formula + formula_args.parse raise FormulaUnspecifiedError if ARGV.named.empty? diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index 7f5cd77f15..ca0c9056b2 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -22,11 +22,15 @@ end module Homebrew module_function - def irb - Homebrew::CLI::Parser.parse do + def irb_args + Homebrew::CLI::Parser.new do switch "--examples" switch "--pry", env: :pry end + end + + def irb + irb_args.parse if args.examples? puts "'v8'.f # => instance of the v8 formula" diff --git a/Library/Homebrew/dev-cmd/linkage.rb b/Library/Homebrew/dev-cmd/linkage.rb index 2fa90a6a68..a837d9ec47 100644 --- a/Library/Homebrew/dev-cmd/linkage.rb +++ b/Library/Homebrew/dev-cmd/linkage.rb @@ -19,13 +19,17 @@ require "cli_parser" module Homebrew module_function - def linkage - Homebrew::CLI::Parser.parse do + def linkage_args + Homebrew::CLI::Parser.new do switch "--test" switch "--reverse" switch :verbose switch :debug end + end + + def linkage + linkage_args.parse CacheStoreDatabase.use(:linkage) do |db| kegs = if ARGV.kegs.empty? diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index a6ee8058ca..bc091f4283 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -11,6 +11,7 @@ require "formula" require "erb" require "ostruct" require "cli_parser" +require "dev-cmd/audit" module Homebrew module_function @@ -19,11 +20,15 @@ module Homebrew TARGET_MAN_PATH = HOMEBREW_REPOSITORY/"manpages" TARGET_DOC_PATH = HOMEBREW_REPOSITORY/"docs" - def man - Homebrew::CLI::Parser.parse do + def man_args + Homebrew::CLI::Parser.new do switch "--fail-if-changed" switch "--link" end + end + + def man + man_args.parse raise UsageError unless ARGV.named.empty? @@ -64,7 +69,7 @@ module Homebrew variables = OpenStruct.new variables[:commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}") - variables[:developer_commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") + variables[:developer_commands] = [Homebrew.send(:audit_args).summary] + path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") readme = HOMEBREW_REPOSITORY/"README.md" variables[:lead_maintainer] = readme.read[/(Homebrew's lead maintainer .*\.)/, 1] diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index 763d55092d..d9546a47b6 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -7,11 +7,15 @@ require "cli_parser" module Homebrew module_function - def mirror - Homebrew::CLI::Parser.parse do + def mirror_args + Homebrew::CLI::Parser.new do switch :debug switch :verbose end + end + + def mirror + mirror_args.parse odie "This command requires at least formula argument!" if ARGV.named.empty? diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 5001da9181..b531971b7b 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -72,10 +72,8 @@ end module Homebrew module_function - def pull - odie "You meant `git pull --rebase`." if ARGV[0] == "--rebase" - - Homebrew::CLI::Parser.parse do + def pull_args + Homebrew::CLI::Parser.new do switch "--bottle" switch "--bump" switch "--clean" @@ -90,6 +88,12 @@ module Homebrew flag "--bintray-org=" flag "--test-bot-user=" end + end + + def pull + odie "You meant `git pull --rebase`." if ARGV[0] == "--rebase" + + pull_args.parse if ARGV.named.empty? odie "This command requires at least one argument containing a URL or pull request number" diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index 1a6616e9a5..b2a3140464 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -10,10 +10,13 @@ require "cli_parser" module Homebrew module_function - def release_notes - Homebrew::CLI::Parser.parse do + def release_notes_args + Homebrew::CLI::Parser.new do switch "--markdown" end + end + def release_notes + release_notes_args.parse previous_tag = ARGV.named.first previous_tag ||= Utils.popen_read( diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index 1be9f17640..7dad2c5da0 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -15,11 +15,15 @@ module Homebrew path.write content end - def tap_new - Homebrew::CLI::Parser.parse do + def tap_new_args + Homebrew::CLI::Parser.new do switch :debug switch :verbose end + end + + def tap_new + tap_new_args.parse raise "A tap argument is required" if ARGV.named.empty? diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 8b13301e95..1490eeabff 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -21,8 +21,8 @@ require "fileutils" module Homebrew module_function - def tests - Homebrew::CLI::Parser.parse do + def tests_args + Homebrew::CLI::Parser.new do switch "--no-compat" switch "--generic" switch "--coverage" @@ -32,6 +32,9 @@ module Homebrew flag "--only=" flag "--seed=" end + end + def tests + tests_args.parse HOMEBREW_LIBRARY_PATH.cd do ENV.delete("HOMEBREW_COLOR") diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index 072abdcca3..0b8e803133 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -19,8 +19,8 @@ require "cli_parser" module Homebrew module_function - def update_test - Homebrew::CLI::Parser.parse do + def update_test_args + Homebrew::CLI::Parser.new do switch "--to-tag" switch "--keep-tmp" switch :verbose @@ -28,6 +28,10 @@ module Homebrew flag "--commit=" flag "--before=" end + end + + def update_test + update_test_args.parse ENV["HOMEBREW_UPDATE_TEST"] = "1" From acd9a335a539d7040dbe1dc9abbbfd8404183d97 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Mon, 30 Jul 2018 18:26:09 +0530 Subject: [PATCH 03/18] `brew man` output --- docs/Manpage.md | 32 ++++++++++++++++++++++++++++++++ manpages/brew.1 | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/docs/Manpage.md b/docs/Manpage.md index a1e5a0af6a..d18b448895 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -663,6 +663,38 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note ## DEVELOPER COMMANDS +Usage: brew audit [options] [`formulae`] + +Check `formulae` for Homebrew coding style violations. This should be +run before submitting a new formula. + +If no `formulae` are provided, all of them are checked. + + --strict Run additional style checks, including Rubocop style checks. + --online Run additional slower style checks that require a + network connection. + --new-formula Run various additional style checks to determine if a new formula + is eligible for Homebrew. This should be used when creating + new formula and implies --strict and --online. + --fix Fix style violations automatically using + RuboCop's auto-correct feature. + --display-cop-names Include the RuboCop cop name for each violation + in the output. + --display-filename Prefix everyline of output with name of the file or + formula being audited, to make output easy to grep. + -D, --audit-debug Activates debugging and profiling + --only Passing --only=method will run only the methods named audit_method, + `method` should be a comma-separated list. + --except Passing --except=method will run only the methods named audit_method, + `method` should be a comma-separated list. + --only-cops Passing --only-cops=cops will check for violations of only the listed + RuboCop cops. `cops` should be a comma-separated list of cop names. + --except-cops Passing --except-cops=cops will skip checking the listed + RuboCop cops violations. `cops` should be a comma-separated list of cop names. + -v, --verbose Verbose mode. + -d, --debug Display debug info. + -h, --help Show this message + * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`--only=``method`|`--except=``method`] [`--only-cops=``cops`|`--except-cops=``cops`] [`formulae`]: Check `formulae` for Homebrew coding style violations. This should be run before submitting a new formula. diff --git a/manpages/brew.1 b/manpages/brew.1 index 62a643b192..959c9285c6 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -601,6 +601,46 @@ If the command\'s output is sent through a pipe and no shell is specified, the l .IP "" 0 . .SH "DEVELOPER COMMANDS" +Usage: brew audit [options] [\fIformulae\fR] +. +.P +Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\. +. +.P +If no \fIformulae\fR are provided, all of them are checked\. +. +.IP "" 4 +. +.nf + + \-\-strict Run additional style checks, including Rubocop style checks\. + \-\-online Run additional slower style checks that require a + network connection\. + \-\-new\-formula Run various additional style checks to determine if a new formula + is eligible for Homebrew\. This should be used when creating + new formula and implies \-\-strict and \-\-online\. + \-\-fix Fix style violations automatically using + RuboCop\'s auto\-correct feature\. + \-\-display\-cop\-names Include the RuboCop cop name for each violation + in the output\. + \-\-display\-filename Prefix everyline of output with name of the file or + formula being audited, to make output easy to grep\. +\-D, \-\-audit\-debug Activates debugging and profiling + \-\-only Passing \-\-only=method will run only the methods named audit_method, + `method` should be a comma\-separated list\. + \-\-except Passing \-\-except=method will run only the methods named audit_method, + `method` should be a comma\-separated list\. + \-\-only\-cops Passing \-\-only\-cops=cops will check for violations of only the listed + RuboCop cops\. `cops` should be a comma\-separated list of cop names\. + \-\-except\-cops Passing \-\-except\-cops=cops will skip checking the listed + RuboCop cops violations\. `cops` should be a comma\-separated list of cop names\. +\-v, \-\-verbose Verbose mode\. +\-d, \-\-debug Display debug info\. +\-h, \-\-help Show this message +. +.fi +. +.IP "" 0 . .TP \fBaudit\fR [\fB\-\-strict\fR] [\fB\-\-fix\fR] [\fB\-\-online\fR] [\fB\-\-new\-formula\fR] [\fB\-\-display\-cop\-names\fR] [\fB\-\-display\-filename\fR] [\fB\-\-only=\fR\fImethod\fR|\fB\-\-except=\fR\fImethod\fR] [\fB\-\-only\-cops=\fR\fIcops\fR|\fB\-\-except\-cops=\fR\fIcops\fR] [\fIformulae\fR] From df101dde8490659d283539e641b0c700a5eeab7e Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Fri, 3 Aug 2018 01:48:01 +0530 Subject: [PATCH 04/18] Move --help handling of dev commands to help.rb --- Library/Homebrew/brew.rb | 2 +- Library/Homebrew/help.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 6ff6e763dd..e1058ef5f6 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -73,7 +73,7 @@ begin # - a help flag is passed AND there is no command specified # - no arguments are passed # - if cmd is Cask, let Cask handle the help command instead - if (empty_argv || help_flag) && cmd != "cask" && !internal_dev_cmd + if (empty_argv || help_flag) && cmd != "cask" require "help" Homebrew::Help.help cmd, empty_argv: empty_argv # `Homebrew.help` never returns, except for external/unknown commands. diff --git a/Library/Homebrew/help.rb b/Library/Homebrew/help.rb index 76ddbb79e9..b1bc461e4e 100644 --- a/Library/Homebrew/help.rb +++ b/Library/Homebrew/help.rb @@ -38,6 +38,9 @@ module Homebrew module_function def help(cmd = nil, flags = {}) + # Let OptionParser generate help text for developer commands + return if require? HOMEBREW_LIBRARY_PATH/"dev-cmd"/cmd + # Resolve command aliases and find file containing the implementation. if cmd cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd) From 83e7cbe5c5b470de272656d3fb1079300d9fe297 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Fri, 3 Aug 2018 01:48:45 +0530 Subject: [PATCH 05/18] Man page help text similar to git --- Library/Homebrew/cli_parser.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index c904e879df..b28c27a6bd 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -23,6 +23,16 @@ module Homebrew def post_initialize @parser.on_tail("-h", "--help", "Show this message") do puts @parser + xyz = @parser.summarize([], 8, 44, " "*8).map do |r| + if r.match?(/^\s{12}\S/) + "\n" + r.gsub(" "*12, " "*8) + elsif r.start_with?(" "*17) + r.gsub(" "*17, " "*11) + else + "\n" + r + end + end + puts xyz exit end end From c7bf79407acd09c4a4abdc6cc8d3361c990b07d6 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sat, 8 Sep 2018 22:21:04 +0530 Subject: [PATCH 06/18] Better man page formatting --- Library/Homebrew/cli_parser.rb | 52 +++++++++------ Library/Homebrew/dev-cmd/audit.rb | 44 +++++++++---- Library/Homebrew/dev-cmd/man.rb | 22 ++++++- Library/Homebrew/dev-cmd/release-notes.rb | 1 + Library/Homebrew/dev-cmd/tests.rb | 1 + Library/Homebrew/utils/formatter.rb | 4 ++ docs/Manpage.md | 65 +++++++++++------- manpages/brew.1 | 80 ++++++++++++++--------- 8 files changed, 181 insertions(+), 88 deletions(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index b28c27a6bd..8d10b3e718 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -5,6 +5,8 @@ require "set" module Homebrew module CLI class Parser + attr_reader :processed_options + def self.parse(args = ARGV, &block) new(&block).parse(args) end @@ -16,32 +18,31 @@ module Homebrew Homebrew.args.instance_eval { undef tap } @constraints = [] @conflicts = [] + @processed_options = [] + @desc_line_length = 48 instance_eval(&block) post_initialize end def post_initialize @parser.on_tail("-h", "--help", "Show this message") do - puts @parser - xyz = @parser.summarize([], 8, 44, " "*8).map do |r| - if r.match?(/^\s{12}\S/) - "\n" + r.gsub(" "*12, " "*8) - elsif r.start_with?(" "*17) - r.gsub(" "*17, " "*11) - else - "\n" + r - end - end - puts xyz - exit + puts @parser.to_s.sub(/^/, "#{Tty.bold}Usage: brew#{Tty.reset} ") + .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}") + .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } + .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}") end end + def wrap_option_desc(desc) + Formatter.wrap(desc, @desc_line_length).split("\n") + end + def switch(*names, description: nil, env: nil, required_for: nil, depends_on: nil) global_switch = names.first.is_a?(Symbol) names, env, description = common_switch(*names) if global_switch description = option_to_description(*names) if description.nil? - @parser.on(*names, *description.split("\n")) do + process_option(*names, description) + @parser.on(*names, *wrap_option_desc(description)) do enable_switch(*names) end @@ -52,13 +53,18 @@ module Homebrew enable_switch(*names) if !env.nil? && !ENV["HOMEBREW_#{env.to_s.upcase}"].nil? end - def banner(text) + def usage_banner(text) @parser.banner = text end + def usage_banner_text + @parser.banner + end + def comma_array(name, description: nil) description = option_to_description(name) if description.nil? - @parser.on(name, OptionParser::REQUIRED_ARGUMENT, Array, *description.split("\n")) do |list| + process_option(name, description) + @parser.on(name, OptionParser::REQUIRED_ARGUMENT, Array, *wrap_option_desc(description)) do |list| Homebrew.args[option_to_name(name)] = list end end @@ -71,7 +77,8 @@ module Homebrew required = OptionParser::OPTIONAL_ARGUMENT end description = option_to_description(name) if description.nil? - @parser.on(name, *description.split("\n"), required) do |option_value| + process_option(name, description) + @parser.on(name, *wrap_option_desc(description), required) do |option_value| Homebrew.args[option_to_name(name)] = option_value end @@ -122,10 +129,10 @@ module Homebrew # These are common/global switches accessible throughout Homebrew def common_switch(name) case name - when :quiet then [["-q", "--quiet"], :quiet, "Suppress warnings."] - when :verbose then [["-v", "--verbose"], :verbose, "Verbose mode."] - when :debug then [["-d", "--debug"], :debug, "Display debug info."] - when :force then [["-f", "--force"], :force, "Override any warnings/validations."] + when :quiet then [["-q", "--quiet"], :quiet, "Suppress any warnings."] + when :verbose then [["-v", "--verbose"], :verbose, "Make some output more verbose."] + when :debug then [["-d", "--debug"], :debug, "Display any debugging information."] + when :force then [["-f", "--force"], :force, "Override warnings and enable potentially unsafe operations."] else name end end @@ -187,6 +194,11 @@ module Homebrew check_conflicts check_constraints end + + def process_option(*args) + option, = @parser.make_switch(args) + @processed_options << [option.short.first, option.long.first, option.arg, option.desc.first] + end end class OptionConstraintError < RuntimeError diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index b8dc3c8742..c8ba04907e 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -54,8 +54,8 @@ module Homebrew def audit_args Homebrew::CLI::Parser.new do - banner <<~EOS - Usage: brew audit [options] [] + usage_banner <<~EOS + `audit` [] []: Check for Homebrew coding style violations. This should be run before submitting a new formula. @@ -63,17 +63,37 @@ module Homebrew If no are provided, all of them are checked. EOS - switch "--strict", description: "Run additional style checks, including Rubocop style checks." - switch "--online", description: "Run additional slower style checks that require a\nnetwork connection." - switch "--new-formula", description: "Run various additional style checks to determine if a new formula \nis eligible for Homebrew. This should be used when creating \nnew formula and implies --strict and --online." - switch "--fix", description: "Fix style violations automatically using\nRuboCop's auto-correct feature." - switch "--display-cop-names", description: "Include the RuboCop cop name for each violation\nin the output." - switch "--display-filename", description: "Prefix everyline of output with name of the file or\nformula being audited, to make output easy to grep." + switch "--strict", description: "Run additional style checks, "\ + "including Rubocop style checks." + switch "--online", description: "Run additional slower style checks "\ + "that require a network connection." + switch "--new-formula", description: "Run various additional style checks "\ + "to determine if a new formula is eligible "\ + "for Homebrew. This should be used when "\ + "creating new formula and implies "\ + "`--strict` and `--online`." + switch "--fix", description: "Fix style violations automatically using "\ + "RuboCop's auto-correct feature." + switch "--display-cop-names", description: "Include the RuboCop cop name for each "\ + "violation in the output." + switch "--display-filename", description: "Prefix everyline of output with name of "\ + "the file or formula being audited, to "\ + "make output easy to grep." switch "-D", "--audit-debug", description: "Activates debugging and profiling" - comma_array "--only", description: "Passing --only=method will run only the methods named audit_method,\n`method` should be a comma-separated list." - comma_array "--except", description: "Passing --except=method will run only the methods named audit_method,\n`method` should be a comma-separated list." - comma_array "--only-cops", description: "Passing --only-cops=cops will check for violations of only the listed\nRuboCop cops. `cops` should be a comma-separated list of cop names." - comma_array "--except-cops", description: "Passing --except-cops=cops will skip checking the listed\nRuboCop cops violations. `cops` should be a comma-separated list of cop names." + comma_array "--only", description: "Passing `--only`= will run only the"\ + "methods named audit_method, `method` should "\ + "be a comma-separated list." + comma_array "--except", description: "Passing `--except`= will run only the "\ + "methods named audit_method, `method` should "\ + "be a comma-separated list." + comma_array "--only-cops", description: "Passing `--only-cops`= will check for "\ + "violations of only the listed RuboCop cops."\ + "`cops` should be a comma-separated list of "\ + "cop names." + comma_array "--except-cops", description: "Passing `--except-cops`= will "\ + "skip checking the listed RuboCop cops "\ + "violations. `cops` should be a "\ + "comma-separated list of cop names." switch :verbose switch :debug end diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index bc091f4283..fb8eaf001d 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -69,7 +69,7 @@ module Homebrew variables = OpenStruct.new variables[:commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}") - variables[:developer_commands] = [Homebrew.send(:audit_args).summary] + path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") + variables[:developer_commands] = generate_cmd_manpage(Homebrew.send(:audit_args)) + path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") readme = HOMEBREW_REPOSITORY/"README.md" variables[:lead_maintainer] = readme.read[/(Homebrew's lead maintainer .*\.)/, 1] @@ -150,4 +150,24 @@ module Homebrew odie "Failed to infer output format from '#{target.basename}'." end end + + def generate_cmd_manpage(cmd_parser) + lines = [cmd_parser.usage_banner_text] + lines += cmd_parser.processed_options.map do |short, long, _, desc| + generate_option_doc(short, long, desc) + end + lines + end + + def generate_option_doc(short, long, desc) + "* #{format_short_opt(short)} #{format_long_opt(long)}:" + "\n" + desc + "\n" + end + + def format_short_opt(opt) + "`#{opt}`, " unless opt.nil? + end + + def format_long_opt(opt) + "`#{opt}`".ljust(30) + end end diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index b2a3140464..6d8d08f228 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -15,6 +15,7 @@ module Homebrew switch "--markdown" end end + def release_notes release_notes_args.parse diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 1490eeabff..df7552c9aa 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -33,6 +33,7 @@ module Homebrew flag "--seed=" end end + def tests tests_args.parse diff --git a/Library/Homebrew/utils/formatter.rb b/Library/Homebrew/utils/formatter.rb index 36542d7389..d8530414a0 100644 --- a/Library/Homebrew/utils/formatter.rb +++ b/Library/Homebrew/utils/formatter.rb @@ -31,6 +31,10 @@ module Formatter label(label, string, :red) end + def wrap(s, width = 172) + s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n") + end + def url(string) "#{Tty.underline}#{string}#{Tty.no_underline}" end diff --git a/docs/Manpage.md b/docs/Manpage.md index d18b448895..ce80c2031a 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -663,37 +663,52 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note ## DEVELOPER COMMANDS -Usage: brew audit [options] [`formulae`] +`audit` [`options`] [`formulae`]: Check `formulae` for Homebrew coding style violations. This should be run before submitting a new formula. If no `formulae` are provided, all of them are checked. - --strict Run additional style checks, including Rubocop style checks. - --online Run additional slower style checks that require a - network connection. - --new-formula Run various additional style checks to determine if a new formula - is eligible for Homebrew. This should be used when creating - new formula and implies --strict and --online. - --fix Fix style violations automatically using - RuboCop's auto-correct feature. - --display-cop-names Include the RuboCop cop name for each violation - in the output. - --display-filename Prefix everyline of output with name of the file or - formula being audited, to make output easy to grep. - -D, --audit-debug Activates debugging and profiling - --only Passing --only=method will run only the methods named audit_method, - `method` should be a comma-separated list. - --except Passing --except=method will run only the methods named audit_method, - `method` should be a comma-separated list. - --only-cops Passing --only-cops=cops will check for violations of only the listed - RuboCop cops. `cops` should be a comma-separated list of cop names. - --except-cops Passing --except-cops=cops will skip checking the listed - RuboCop cops violations. `cops` should be a comma-separated list of cop names. - -v, --verbose Verbose mode. - -d, --debug Display debug info. - -h, --help Show this message + +* `--strict` : +Run additional style checks, including Rubocop style checks. + +* `--online` : +Run additional slower style checks that require a network connection. + +* `--new-formula` : +Run various additional style checks to determine if a new formula is eligible for Homebrew. This should be used when creating new formula and implies `--strict` and `--online`. + +* `--fix` : +Fix style violations automatically using RuboCop's auto-correct feature. + +* `--display-cop-names` : +Include the RuboCop cop name for each violation in the output. + +* `--display-filename` : +Prefix everyline of output with name of the file or formula being audited, to make output easy to grep. + +* `-D`, `--audit-debug` : +Activates debugging and profiling + +* `--only` : +Passing `--only`=`method` will run only themethods named audit_method, `method` should be a comma-separated list. + +* `--except` : +Passing `--except`=`method` will run only the methods named audit_method, `method` should be a comma-separated list. + +* `--only-cops` : +Passing `--only-cops`=`cops` will check for violations of only the listed RuboCop cops.`cops` should be a comma-separated list of cop names. + +* `--except-cops` : +Passing `--except-cops`=`cops` will skip checking the listed RuboCop cops violations. `cops` should be a comma-separated list of cop names. + +* `-v`, `--verbose` : +Make some output more verbose. + +* `-d`, `--debug` : +Display any debugging information. * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`--only=``method`|`--except=``method`] [`--only-cops=``cops`|`--except-cops=``cops`] [`formulae`]: Check `formulae` for Homebrew coding style violations. This should be diff --git a/manpages/brew.1 b/manpages/brew.1 index 959c9285c6..aaf6407fea 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -601,7 +601,7 @@ If the command\'s output is sent through a pipe and no shell is specified, the l .IP "" 0 . .SH "DEVELOPER COMMANDS" -Usage: brew audit [options] [\fIformulae\fR] +\fBaudit\fR [\fIoptions\fR] [\fIformulae\fR]: . .P Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\. @@ -609,38 +609,57 @@ Check \fIformulae\fR for Homebrew coding style violations\. This should be run b .P If no \fIformulae\fR are provided, all of them are checked\. . -.IP "" 4 +.TP +\fB\-\-strict\fR +Run additional style checks, including Rubocop style checks\. . -.nf - - \-\-strict Run additional style checks, including Rubocop style checks\. - \-\-online Run additional slower style checks that require a - network connection\. - \-\-new\-formula Run various additional style checks to determine if a new formula - is eligible for Homebrew\. This should be used when creating - new formula and implies \-\-strict and \-\-online\. - \-\-fix Fix style violations automatically using - RuboCop\'s auto\-correct feature\. - \-\-display\-cop\-names Include the RuboCop cop name for each violation - in the output\. - \-\-display\-filename Prefix everyline of output with name of the file or - formula being audited, to make output easy to grep\. -\-D, \-\-audit\-debug Activates debugging and profiling - \-\-only Passing \-\-only=method will run only the methods named audit_method, - `method` should be a comma\-separated list\. - \-\-except Passing \-\-except=method will run only the methods named audit_method, - `method` should be a comma\-separated list\. - \-\-only\-cops Passing \-\-only\-cops=cops will check for violations of only the listed - RuboCop cops\. `cops` should be a comma\-separated list of cop names\. - \-\-except\-cops Passing \-\-except\-cops=cops will skip checking the listed - RuboCop cops violations\. `cops` should be a comma\-separated list of cop names\. -\-v, \-\-verbose Verbose mode\. -\-d, \-\-debug Display debug info\. -\-h, \-\-help Show this message +.TP +\fB\-\-online\fR +Run additional slower style checks that require a network connection\. . -.fi +.TP +\fB\-\-new\-formula\fR +Run various additional style checks to determine if a new formula is eligible for Homebrew\. This should be used when creating new formula and implies \fB\-\-strict\fR and \fB\-\-online\fR\. . -.IP "" 0 +.TP +\fB\-\-fix\fR +Fix style violations automatically using RuboCop\'s auto\-correct feature\. +. +.TP +\fB\-\-display\-cop\-names\fR +Include the RuboCop cop name for each violation in the output\. +. +.TP +\fB\-\-display\-filename\fR +Prefix everyline of output with name of the file or formula being audited, to make output easy to grep\. +. +.TP +\fB\-D\fR, \fB\-\-audit\-debug\fR +Activates debugging and profiling +. +.TP +\fB\-\-only\fR +Passing \fB\-\-only\fR=\fImethod\fR will run only themethods named audit_method, \fBmethod\fR should be a comma\-separated list\. +. +.TP +\fB\-\-except\fR +Passing \fB\-\-except\fR=\fImethod\fR will run only the methods named audit_method, \fBmethod\fR should be a comma\-separated list\. +. +.TP +\fB\-\-only\-cops\fR +Passing \fB\-\-only\-cops\fR=\fIcops\fR will check for violations of only the listed RuboCop cops\.\fBcops\fR should be a comma\-separated list of cop names\. +. +.TP +\fB\-\-except\-cops\fR +Passing \fB\-\-except\-cops\fR=\fIcops\fR will skip checking the listed RuboCop cops violations\. \fBcops\fR should be a comma\-separated list of cop names\. +. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. +. +.TP +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. . .TP \fBaudit\fR [\fB\-\-strict\fR] [\fB\-\-fix\fR] [\fB\-\-online\fR] [\fB\-\-new\-formula\fR] [\fB\-\-display\-cop\-names\fR] [\fB\-\-display\-filename\fR] [\fB\-\-only=\fR\fImethod\fR|\fB\-\-except=\fR\fImethod\fR] [\fB\-\-only\-cops=\fR\fIcops\fR|\fB\-\-except\-cops=\fR\fIcops\fR] [\fIformulae\fR] @@ -945,6 +964,7 @@ If \fB\-\-to\-tag\fR is passed, set \fBHOMEBREW_UPDATE_TO_TAG\fR to test updatin . .IP If \fB\-\-keep\-tmp\fR is passed, retain the temporary directory containing the new repository clone\. + . .SH "OFFICIAL EXTERNAL COMMANDS" . From cfaaa0eb71acc9ffea245594a0a82ecde5b3c09b Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sat, 22 Sep 2018 09:31:30 +0530 Subject: [PATCH 07/18] Move option descriptions to new line --- Library/Homebrew/cli_parser.rb | 3 +- Library/Homebrew/dev-cmd/audit.rb | 65 +++++++++++++++---------------- Library/Homebrew/dev-cmd/man.rb | 2 +- docs/Manpage.md | 32 +++++++-------- manpages/brew.1 | 6 +-- 5 files changed, 53 insertions(+), 55 deletions(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index 8d10b3e718..511472ea76 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -30,6 +30,7 @@ module Homebrew .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}") .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}") + exit end end @@ -54,7 +55,7 @@ module Homebrew end def usage_banner(text) - @parser.banner = text + @parser.banner = "#{text}\n" end def usage_banner_text diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index c8ba04907e..fbafa459e7 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -61,41 +61,38 @@ module Homebrew run before submitting a new formula. If no are provided, all of them are checked. - EOS - switch "--strict", description: "Run additional style checks, "\ - "including Rubocop style checks." - switch "--online", description: "Run additional slower style checks "\ - "that require a network connection." - switch "--new-formula", description: "Run various additional style checks "\ - "to determine if a new formula is eligible "\ - "for Homebrew. This should be used when "\ - "creating new formula and implies "\ - "`--strict` and `--online`." - switch "--fix", description: "Fix style violations automatically using "\ - "RuboCop's auto-correct feature." - switch "--display-cop-names", description: "Include the RuboCop cop name for each "\ - "violation in the output." - switch "--display-filename", description: "Prefix everyline of output with name of "\ - "the file or formula being audited, to "\ - "make output easy to grep." - switch "-D", "--audit-debug", description: "Activates debugging and profiling" - comma_array "--only", description: "Passing `--only`= will run only the"\ - "methods named audit_method, `method` should "\ - "be a comma-separated list." - comma_array "--except", description: "Passing `--except`= will run only the "\ - "methods named audit_method, `method` should "\ - "be a comma-separated list." - comma_array "--only-cops", description: "Passing `--only-cops`= will check for "\ - "violations of only the listed RuboCop cops."\ - "`cops` should be a comma-separated list of "\ - "cop names." - comma_array "--except-cops", description: "Passing `--except-cops`= will "\ - "skip checking the listed RuboCop cops "\ - "violations. `cops` should be a "\ - "comma-separated list of cop names." - switch :verbose - switch :debug + switch "--strict", + description: "Run additional style checks, including Rubocop style checks." + switch "--online", + description: "Run additional slower style checks that require a network connection." + switch "--new-formula", + description: "Run various additional style checks to determine if a new formula is eligible "\ + "for Homebrew. This should be used when creating new formula and implies "\ + "`--strict` and `--online`." + switch "--fix", + description: "Fix style violations automatically using RuboCop's auto-correct feature." + switch "--display-cop-names", + description: "Include the RuboCop cop name for each violation in the output." + switch "--display-filename", + description: "Prefix everyline of output with name of the file or formula being audited, to "\ + "make output easy to grep." + switch "-D", "--audit-debug", + description: "Activates debugging and profiling" + comma_array "--only", + description: "Passing `--only`= will run only the methods named audit_, `method` "\ + "should be a comma-separated list." + comma_array "--except", + description: "Passing `--except`= will run only the methods named audit_, "\ + "`method` should be a comma-separated list." + comma_array "--only-cops", + description: "Passing `--only-cops`= will check for violations of only the listed "\ + "RuboCop cops. `cops` should be a comma-separated list of cop names." + comma_array "--except-cops", + description: "Passing `--except-cops`= will skip checking the listed RuboCop cops "\ + "violations. `cops` should be a comma-separated list of cop names." + switch :verbose + switch :debug end end diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index fb8eaf001d..9d64fa6668 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -168,6 +168,6 @@ module Homebrew end def format_long_opt(opt) - "`#{opt}`".ljust(30) + "`#{opt}`" end end diff --git a/docs/Manpage.md b/docs/Manpage.md index ce80c2031a..b5d01c5445 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -671,43 +671,43 @@ run before submitting a new formula. If no `formulae` are provided, all of them are checked. -* `--strict` : +* `--strict`: Run additional style checks, including Rubocop style checks. -* `--online` : +* `--online`: Run additional slower style checks that require a network connection. -* `--new-formula` : +* `--new-formula`: Run various additional style checks to determine if a new formula is eligible for Homebrew. This should be used when creating new formula and implies `--strict` and `--online`. -* `--fix` : +* `--fix`: Fix style violations automatically using RuboCop's auto-correct feature. -* `--display-cop-names` : +* `--display-cop-names`: Include the RuboCop cop name for each violation in the output. -* `--display-filename` : +* `--display-filename`: Prefix everyline of output with name of the file or formula being audited, to make output easy to grep. -* `-D`, `--audit-debug` : +* `-D`, `--audit-debug`: Activates debugging and profiling -* `--only` : -Passing `--only`=`method` will run only themethods named audit_method, `method` should be a comma-separated list. +* `--only`: +Passing `--only`=`method` will run only the methods named audit_`method`, `method` should be a comma-separated list. -* `--except` : -Passing `--except`=`method` will run only the methods named audit_method, `method` should be a comma-separated list. +* `--except`: +Passing `--except`=`method` will run only the methods named audit_`method`, `method` should be a comma-separated list. -* `--only-cops` : -Passing `--only-cops`=`cops` will check for violations of only the listed RuboCop cops.`cops` should be a comma-separated list of cop names. +* `--only-cops`: +Passing `--only-cops`=`cops` will check for violations of only the listed RuboCop cops. `cops` should be a comma-separated list of cop names. -* `--except-cops` : +* `--except-cops`: Passing `--except-cops`=`cops` will skip checking the listed RuboCop cops violations. `cops` should be a comma-separated list of cop names. -* `-v`, `--verbose` : +* `-v`, `--verbose`: Make some output more verbose. -* `-d`, `--debug` : +* `-d`, `--debug`: Display any debugging information. * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`--only=``method`|`--except=``method`] [`--only-cops=``cops`|`--except-cops=``cops`] [`formulae`]: diff --git a/manpages/brew.1 b/manpages/brew.1 index aaf6407fea..87e07f7de3 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -639,15 +639,15 @@ Activates debugging and profiling . .TP \fB\-\-only\fR -Passing \fB\-\-only\fR=\fImethod\fR will run only themethods named audit_method, \fBmethod\fR should be a comma\-separated list\. +Passing \fB\-\-only\fR=\fImethod\fR will run only the methods named audit_\fImethod\fR, \fBmethod\fR should be a comma\-separated list\. . .TP \fB\-\-except\fR -Passing \fB\-\-except\fR=\fImethod\fR will run only the methods named audit_method, \fBmethod\fR should be a comma\-separated list\. +Passing \fB\-\-except\fR=\fImethod\fR will run only the methods named audit_\fImethod\fR, \fBmethod\fR should be a comma\-separated list\. . .TP \fB\-\-only\-cops\fR -Passing \fB\-\-only\-cops\fR=\fIcops\fR will check for violations of only the listed RuboCop cops\.\fBcops\fR should be a comma\-separated list of cop names\. +Passing \fB\-\-only\-cops\fR=\fIcops\fR will check for violations of only the listed RuboCop cops\. \fBcops\fR should be a comma\-separated list of cop names\. . .TP \fB\-\-except\-cops\fR From 4f58f2db999cd15ac35a9871228ae985ded75c0f Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Fri, 28 Sep 2018 21:39:52 +0530 Subject: [PATCH 08/18] man: Generate dev cmd manpages --- Library/Homebrew/dev-cmd/bottle.rb | 47 +- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 63 +- Library/Homebrew/dev-cmd/create.rb | 33 +- Library/Homebrew/dev-cmd/edit.rb | 7 + Library/Homebrew/dev-cmd/formula.rb | 5 + Library/Homebrew/dev-cmd/irb.rb | 11 +- Library/Homebrew/dev-cmd/linkage.rb | 19 +- Library/Homebrew/dev-cmd/man.rb | 51 +- Library/Homebrew/dev-cmd/mirror.rb | 5 + Library/Homebrew/dev-cmd/pull.rb | 53 +- Library/Homebrew/dev-cmd/release-notes.rb | 10 +- Library/Homebrew/dev-cmd/tap-new.rb | 5 + Library/Homebrew/dev-cmd/tests.rb | 28 +- Library/Homebrew/dev-cmd/update-test.rb | 19 +- docs/Manpage.md | 625 ++++++++-------- manpages/brew.1 | 756 +++++++++++++------- 16 files changed, 1085 insertions(+), 652 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 8c651c93f0..f4ae7546cd 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -71,18 +71,45 @@ module Homebrew def bottle_args Homebrew::CLI::Parser.new do - switch "--merge" - switch "--skip-relocation" - switch "--force-core-tap" - switch "--no-rebuild" - switch "--keep-old" - switch "--write" - switch "--no-commit" - switch "--json" - switch "--or-later" + usage_banner <<~EOS + `bottle` [] []: + + Generate a bottle (binary package) from a formula installed with + `--build-bottle`. + + If the formula specifies a rebuild version, it will be incremented in the + generated DSL. Passing `--keep-old` will attempt to keep it at its + original value, while `--no-rebuild` will remove it. + EOS + switch "--skip-relocation", + description: "Do not check if the bottle can be marked as relocatable." + switch "--or-later", + description: "Append `_or_later` to the bottle tag." + switch "--force-core-tap", + description: "Build a bottle even if is not in homebrew/core or any installed taps." + switch "--no-rebuild", + description: "If the formula specifies a rebuild version, it will be removed in the generated DSL." + switch "--keep-old", + description: "If the formula specifies a rebuild version, it will attempted to be kept in the "\ + " generated DSL." + switch "--merge", + description: "Generate a bottle from a formula and print the new DSL merged into the "\ + "existing formula." + switch "--write", + description: "Changes will be written to the formula file. A new commit will be generated unless "\ + "`--no-commit` is passed." + switch "--no-commit", + description: "When passed with `--write`, a new commit will not generated while writing changes "\ + "to the formula file.", + depends_on: "--write" + switch "--json", + description: "Write bottle information to a JSON file, which can be used as the argument for "\ + "`--merge`." + flag "--root-url", + description: "Use the specified as the root of the bottle's URL instead of Homebrew's "\ + "default." switch :verbose switch :debug - flag "--root-url" end end diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 107c4aabe4..89b616d037 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -49,25 +49,58 @@ module Homebrew def bump_formula_pr_args Homebrew::CLI::Parser.new do - switch "--devel" - switch "-n", "--dry-run" - switch "--write" - switch "--audit" - switch "--strict" - switch "--no-browse" + usage_banner <<~EOS + `bump-formula-pr` [] : + + Creates a pull request to update the formula with a new URL or a new tag. + + If a is specified, the checksum of the new download must + also be specified. A best effort to determine the and + name will be made if either or both values are not supplied by the user. + + If a is specified, the git commit corresponding to that + tag must also be specified. + + Note that this command cannot be used to transition a formula from a + URL-and-sha256 style specification into a tag-and-revision style + specification, nor vice versa. It must use whichever style specification + the preexisting formula already uses. + EOS + switch "--devel", + description: "Bump the development rather than stable version. The development spec must already exist." + switch "-n", "--dry-run", + description: "Print what would be done rather than doing it." + switch "--write", + description: "When passed along with `--dry-run`, perform a not-so-dry run making the expected "\ + "file modifications but not taking any git actions." + switch "--audit", + description: "Run `brew audit` before opening the PR." + switch "--strict", + description: "Run `brew audit --strict` before opening the PR." + switch "--no-browse", + description: "Output the pull request URL instead of opening in a browser" + flag "--url=", + description: "Provide new for the formula. If a is specified, the "\ + "checksum of the new download must also be specified." + flag "--revision=", + description: "Specify the new git commit corresponding to a specified ." + flag "--tag=", required_for: "--revision=", + description: "Specify the new git commit for the formula." + flag "--sha256=", depends_on: "--url=", + description: "Specify the checksum of new download." + flag "--mirror=", + description: "Use the provided as a mirror URL." + flag "--version=", + description: "Use the provided to override the value parsed from the URL or tag. Note "\ + "that `--version=0` can be used to delete an existing `version` override from a "\ + "formula if it has become redundant." + flag "--message=", + description: "Append provided to the default PR message." + switch :quiet switch :force switch :verbose switch :debug - - flag "--url=" - flag "--revision=" - flag "--tag=", required_for: "--revision=" - flag "--sha256=", depends_on: "--url=" - flag "--mirror=" - flag "--version=" - flag "--message=" - conflicts "--url", "--tag" end end diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 08bb09168e..f5f174f12f 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -29,17 +29,36 @@ module Homebrew def create_args Homebrew::CLI::Parser.new do - switch "--autotools" - switch "--cmake" - switch "--meson" - switch "--no-fetch" + usage_banner <<~EOS + `create` []: + + Generate a formula for the downloadable file at and open it in the editor. + Homebrew will attempt to automatically derive the formula name + and version, but if it fails, you'll have to make your own template. The `wget` + formula serves as a simple example. For the complete API have a look at + . + EOS + switch "--autotools", + description: "Create a basic template for an Autotools-style build." + switch "--cmake", + description: "Create a basic template for a CMake-style build." + switch "--meson", + description: "Create a basic template for a Meson-style build." + switch "--no-fetch", + description: "Homebrew will not download to the cache and will thus not add the SHA256 to "\ + "the formula for you. It will also not check the GitHub API for GitHub projects "\ + "(to fill out the description and homepage)." switch "--HEAD" + flag "--set-name=", + description: "Set the provided name of the package you are creating." + flag "--set-version=", + description: "Set the provided version of the package you are creating." + flag "--tap=", + description: "Takes a tap [`/`] as argument and generates the formula in the "\ + "specified tap." switch :force switch :verbose switch :debug - flag "--set-name=" - flag "--set-version=" - flag "--tap=" end end diff --git a/Library/Homebrew/dev-cmd/edit.rb b/Library/Homebrew/dev-cmd/edit.rb index c694f054b8..8c033cf107 100644 --- a/Library/Homebrew/dev-cmd/edit.rb +++ b/Library/Homebrew/dev-cmd/edit.rb @@ -12,6 +12,13 @@ module Homebrew def edit_args Homebrew::CLI::Parser.new do + usage_banner <<~EOS + * `edit`: + Open all of Homebrew for editing. + + * `edit` : + Open in the editor. + EOS switch :force switch :verbose switch :debug diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb index 15229271bd..904f8e2aa6 100644 --- a/Library/Homebrew/dev-cmd/formula.rb +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -9,6 +9,11 @@ module Homebrew def formula_args Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `formula` : + + Display the path where is located. + EOS switch :debug switch :verbose end diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index ca0c9056b2..486970c774 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -24,8 +24,15 @@ module Homebrew def irb_args Homebrew::CLI::Parser.new do - switch "--examples" - switch "--pry", env: :pry + usage_banner <<~EOS + `irb` []: + + Enter the interactive Homebrew Ruby shell. + EOS + switch "--examples", + description: "Show several examples." + switch "--pry", env: :pry, + description: "Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set." end end diff --git a/Library/Homebrew/dev-cmd/linkage.rb b/Library/Homebrew/dev-cmd/linkage.rb index a837d9ec47..2feb98f899 100644 --- a/Library/Homebrew/dev-cmd/linkage.rb +++ b/Library/Homebrew/dev-cmd/linkage.rb @@ -21,8 +21,23 @@ module Homebrew def linkage_args Homebrew::CLI::Parser.new do - switch "--test" - switch "--reverse" + usage_banner <<~EOS + `linkage` [] : + + Checks the library links of an installed formula. + + Only works on installed formulae. An error is raised if it is run on + uninstalled formulae. + EOS + switch "--test", + description: "Display only missing libraries and exit with a non-zero exit code if any missing "\ + "libraries were found." + switch "--reverse", + description: "Print the dylib followed by the binaries which link to it for each library the keg "\ + "references." + switch "--cached", + description: "Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous "\ + "`brew linkage` run." switch :verbose switch :debug end diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 9d64fa6668..618c2b5487 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -12,6 +12,19 @@ require "erb" require "ostruct" require "cli_parser" require "dev-cmd/audit" +require "dev-cmd/bottle" +require "dev-cmd/bump-formula-pr" +require "dev-cmd/create" +require "dev-cmd/edit" +require "dev-cmd/formula" +require "dev-cmd/irb" +require "dev-cmd/linkage" +require "dev-cmd/mirror" +require "dev-cmd/pull" +require "dev-cmd/release-notes" +require "dev-cmd/tap-new" +require "dev-cmd/tests" +require "dev-cmd/update-test" module Homebrew module_function @@ -22,8 +35,18 @@ module Homebrew def man_args Homebrew::CLI::Parser.new do - switch "--fail-if-changed" - switch "--link" + usage_banner <<~EOS + `man` []: + + Generate Homebrew's manpages. + EOS + switch "--fail-if-changed", + description: "Return a failing status code if changes are detected in the manpage outputs. This "\ + "can be used for CI to be notified when the manpages are out of date. Additionally, "\ + "the date used in new manpages will match those in the existing manpages (to allow "\ + "comparison without factoring in the date)." + switch "--link", + description: "It is now done automatically by `brew update`." end end @@ -58,7 +81,6 @@ module Homebrew def path_glob_commands(glob) Pathname.glob(glob) - .sort_by { |source_file| sort_key_for_path(source_file) } .map(&:read).map(&:lines) .map { |lines| lines.grep(/^#:/).map { |line| line.slice(2..-1) }.join } .reject { |s| s.strip.empty? || s.include?("@hide_from_man_page") } @@ -69,7 +91,8 @@ module Homebrew variables = OpenStruct.new variables[:commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}") - variables[:developer_commands] = generate_cmd_manpage(Homebrew.send(:audit_args)) + path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") + + variables[:developer_commands] = generate_cmd_manpages("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") readme = HOMEBREW_REPOSITORY/"README.md" variables[:lead_maintainer] = readme.read[/(Homebrew's lead maintainer .*\.)/, 1] @@ -151,7 +174,25 @@ module Homebrew end end - def generate_cmd_manpage(cmd_parser) + def generate_cmd_manpages(glob) + cmd_paths = Pathname.glob(glob) + man_page_lines = [] + cmd_paths.each do |cmd_path| + begin + cmd_parser = Homebrew.send(cmd_arg_parser(cmd_path)) + man_page_lines << generate_cmd_manpage_lines(cmd_parser).join + rescue NoMethodError + man_page_lines << path_glob_commands(cmd_path.to_s)[0] + end + end + man_page_lines + end + + def cmd_arg_parser(cmd_path) + "#{cmd_path.basename.to_s.gsub('.rb', '').gsub('-', '_')}_args".to_sym + end + + def generate_cmd_manpage_lines(cmd_parser) lines = [cmd_parser.usage_banner_text] lines += cmd_parser.processed_options.map do |short, long, _, desc| generate_option_doc(short, long, desc) diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index d9546a47b6..139a63bb75 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -9,6 +9,11 @@ module Homebrew def mirror_args Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `mirror` []: + + Reuploads the stable URL for a formula to Bintray to use it as a mirror. + EOS switch :debug switch :verbose end diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index b531971b7b..c83a8ccf4b 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -74,19 +74,50 @@ module Homebrew def pull_args Homebrew::CLI::Parser.new do - switch "--bottle" - switch "--bump" - switch "--clean" - switch "--ignore-whitespace" - switch "--resolve" - switch "--branch-okay" - switch "--no-pbcopy" - switch "--no-publish" - switch "--warn-on-publish-failure" + usage_banner <<~EOS + `bump-formula-pr` [] : + + Gets a patch from a GitHub commit or pull request and applies it to Homebrew. + Optionally, installs the formulae changed by the patch. + + Each may be one of: + + ~ The ID number of a PR (pull request) in the homebrew/core GitHub + repository + + ~ The URL of a PR on GitHub, using either the web page or API URL + formats. In this form, the PR may be on Homebrew/brew, + Homebrew/homebrew-core or any tap. + + ~ The URL of a commit on GitHub + + ~ A "https://jenkins.brew.sh/job/..." string specifying a testing job ID + EOS + switch "--bottle", + description: "Handle bottles, pulling the bottle-update commit and publishing files on Bintray." + switch "--bump", + description: "For one-formula PRs, automatically reword commit message to our preferred format." + switch "--clean", + description: "Do not rewrite or otherwise modify the commits found in the pulled PR." + switch "--ignore-whitespace", + description: "Silently ignore whitespace discrepancies when applying diffs." + switch "--resolve", + description: "When a patch fails to apply, leave in progress and allow user to resolve, instead "\ + "of aborting." + switch "--branch-okay", + description: "Do not warn if pulling to a branch besides master (useful for testing)." + switch "--no-pbcopy", + description: "Do not copy anything to the system clipboard." + switch "--no-publish", + description: "Do not publish bottles to Bintray." + switch "--warn-on-publish-failure", + description: "Do not exit if there's a failure publishing bottles on Bintray." + flag "--bintray-org=", + description: "Publish at the given Bintray organisation." + flag "--test-bot-user=", + description: "Pull the bottle block commit from the specified user on GitHub." switch :verbose switch :debug - flag "--bintray-org=" - flag "--test-bot-user=" end end diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index 6d8d08f228..6eb8d19bec 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -12,7 +12,15 @@ module Homebrew def release_notes_args Homebrew::CLI::Parser.new do - switch "--markdown" + usage_banner <<~EOS + `release-notes` [] []: + + Output the merged pull requests on Homebrew/brew between two Git refs. + If no is provided it defaults to the latest tag. + If no is provided it defaults to `origin/master`. + EOS + switch "--markdown", + description: "Output as a Markdown list." end end diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index 7dad2c5da0..b2751bfa71 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -17,6 +17,11 @@ module Homebrew def tap_new_args Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `tap-new` `/`: + + Generate the template files for a new tap. + EOS switch :debug switch :verbose end diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index df7552c9aa..5730c7cab7 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -23,14 +23,28 @@ module Homebrew def tests_args Homebrew::CLI::Parser.new do - switch "--no-compat" - switch "--generic" - switch "--coverage" - switch "--online" - switch :debug + usage_banner <<~EOS + `tests` [] : + + Run Homebrew's unit and integration tests. If provided, + `--only=` runs only _spec.rb, and `--seed` + randomizes tests with the provided value instead of a random seed. + EOS + switch "--coverage", + description: "Generate code coverage reports." + switch "--generic", + description: "Run only OS-agnostic tests." + switch "--no-compat", + description: "Do not load the compatibility layer when running tests." + switch "--online", + description: "Include tests that use the GitHub API and tests that use any of the taps for "\ + "official external commands." + flag "--only=", + description: "Run only _spec.rb" + flag "--seed=", + description: "Randomizes tests with the provided value instead of a random seed." switch :verbose - flag "--only=" - flag "--seed=" + switch :debug end end diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index 0b8e803133..41668a4bf7 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -21,12 +21,23 @@ module Homebrew def update_test_args Homebrew::CLI::Parser.new do - switch "--to-tag" - switch "--keep-tmp" + usage_banner <<~EOS + `update-test` []: + + Runs a test of `brew update` with a new repository clone. + + If no arguments are passed, use `origin/master` as the start commit. + EOS + switch "--to-tag", + description: "Set `HOMEBREW_UPDATE_TO_TAG` to test updating between tags." + switch "--keep-tmp", + description: "Retain the temporary directory containing the new repository clone." + flag "--commit=", + description: "Use provided as the start commit." + flag "--before=", + description: "Use the commit at provided as the start commit." switch :verbose switch :debug - flag "--commit=" - flag "--before=" end end diff --git a/docs/Manpage.md b/docs/Manpage.md index b5d01c5445..9f7f9b1730 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -37,6 +37,44 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note ## COMMANDS + * `--cache`: + Display Homebrew's download cache. See also `HOMEBREW_CACHE`. + + * `--cache` [`--build-from-source`|`-s`] [`--force-bottle`] `formula`: + Display the file or directory used to cache `formula`. + + * `--cellar`: + Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if + that directory doesn't exist, `$(brew --repository)/Cellar`. + + * `--cellar` `formula`: + Display the location in the cellar where `formula` would be installed, + without any sort of versioned directory as the last path. + + * `--env` [`--shell=`(`shell`|`auto`)|`--plain`]: + Show a summary of the Homebrew build environment as a plain list. + + Pass `--shell=``shell` to generate a list of environment variables for the + specified shell, or `--shell=auto` to detect the current shell. + + If the command's output is sent through a pipe and no shell is specified, + the list is formatted for export to `bash`(1) unless `--plain` is passed. + + * `--prefix`: + Display Homebrew's install path. *Default:* `/usr/local` + + * `--prefix` `formula`: + Display the location in the cellar where `formula` is or would be installed. + + * `--repository`: + Display where Homebrew's `.git` directory is located. + + * `--repository` `user``/``repo`: + Display where tap `user``/``repo`'s directory is located. + + * `--version`: + Print the version number of Homebrew to standard output and exit. + * `analytics` [`state`]: Display anonymous user behaviour analytics state. Read more at . @@ -473,6 +511,30 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note * `switch` `formula` `version`: Symlink all of the specific `version` of `formula`'s install to Homebrew prefix. + * `tap-info`: + Display a brief summary of all installed taps. + + * `tap-info` (`--installed`|`taps`): + Display detailed information about one or more `taps`. + + Pass `--installed` to display information on all installed taps. + + * `tap-info` `--json=``version` (`--installed`|`taps`): + Print a JSON representation of `taps`. Currently the only accepted value + for `version` is `v1`. + + Pass `--installed` to get information on installed taps. + + See the docs for examples of using the JSON output: + + + * `tap-pin` `tap`: + Pin `tap`, prioritizing its formulae over core when formula names are supplied + by the user. See also `tap-unpin`. + + * `tap-unpin` `tap`: + Unpin `tap` so its formulae are no longer prioritized. See also `tap-pin`. + * `tap`: List all installed taps. @@ -507,30 +569,6 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note * `tap` `--list-pinned`: List all pinned taps. - * `tap-info`: - Display a brief summary of all installed taps. - - * `tap-info` (`--installed`|`taps`): - Display detailed information about one or more `taps`. - - Pass `--installed` to display information on all installed taps. - - * `tap-info` `--json=``version` (`--installed`|`taps`): - Print a JSON representation of `taps`. Currently the only accepted value - for `version` is `v1`. - - Pass `--installed` to get information on installed taps. - - See the docs for examples of using the JSON output: - - - * `tap-pin` `tap`: - Pin `tap`, prioritizing its formulae over core when formula names are supplied - by the user. See also `tap-unpin`. - - * `tap-unpin` `tap`: - Unpin `tap` so its formulae are no longer prioritized. See also `tap-pin`. - * `uninstall`, `rm`, `remove` [`--force`] [`--ignore-dependencies`] `formula`: Uninstall `formula`. @@ -566,22 +604,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note * `untap` `tap`: Remove a tapped repository. - * `update` [`--merge`] [`--force`]: - Fetch the newest version of Homebrew and all formulae from GitHub using - `git`(1) and perform any necessary migrations. - - If `--merge` is specified then `git merge` is used to include updates - (rather than `git rebase`). - - If `--force` (or `-f`) is specified then always do a slower, full update check even - if unnecessary. - - * `update-reset` [`repositories`]: - Fetches and resets Homebrew and all tap repositories (or the specified - `repositories`) using `git`(1) to their latest `origin/master`. Note this - will destroy all your uncommitted or committed changes. - - * `upgrade` [`install-options`] [`--cleanup`] [`--fetch-HEAD`] [`--ignore-pinned`] [`--display-times`] [`formulae`]: + * `upgrade` [`install-options`] [`--cleanup`] [`--fetch-HEAD`] [`--ignore-pinned`] [`formulae`]: Upgrade outdated, unpinned brews (with existing install options). Options for the `install` command are also valid here. @@ -623,43 +646,20 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note cases where `formulae` is used by development or HEAD build, pass `--devel` or `--HEAD`. - * `--cache`: - Display Homebrew's download cache. See also `HOMEBREW_CACHE`. + * `update-reset`: + Fetches and resets Homebrew and all tap repositories using `git`(1) to + their latest `origin/master`. Note this will destroy all your uncommitted + or committed changes. - * `--cache` [`--build-from-source`|`-s`] [`--force-bottle`] `formula`: - Display the file or directory used to cache `formula`. + * `update` [`--merge`] [`--force`]: + Fetch the newest version of Homebrew and all formulae from GitHub using + `git`(1) and perform any necessary migrations. - * `--cellar`: - Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if - that directory doesn't exist, `$(brew --repository)/Cellar`. + If `--merge` is specified then `git merge` is used to include updates + (rather than `git rebase`). - * `--cellar` `formula`: - Display the location in the cellar where `formula` would be installed, - without any sort of versioned directory as the last path. - - * `--env` [`--shell=`(`shell`|`auto`)|`--plain`]: - Show a summary of the Homebrew build environment as a plain list. - - Pass `--shell=``shell` to generate a list of environment variables for the - specified shell, or `--shell=auto` to detect the current shell. - - If the command's output is sent through a pipe and no shell is specified, - the list is formatted for export to `bash`(1) unless `--plain` is passed. - - * `--prefix`: - Display Homebrew's install path. *Default:* `/usr/local` on macOS and `/home/linuxbrew/.linuxbrew` on Linux - - * `--prefix` `formula`: - Display the location in the cellar where `formula` is or would be installed. - - * `--repository`: - Display where Homebrew's `.git` directory is located. - - * `--repository` `user``/``repo`: - Display where tap `user``/``repo`'s directory is located. - - * `--version`: - Print the version number of Homebrew to standard output and exit. + If `--force` (or `-f`) is specified then always do a slower, full update check even + if unnecessary. ## DEVELOPER COMMANDS @@ -670,296 +670,286 @@ run before submitting a new formula. If no `formulae` are provided, all of them are checked. - * `--strict`: Run additional style checks, including Rubocop style checks. - * `--online`: Run additional slower style checks that require a network connection. - * `--new-formula`: Run various additional style checks to determine if a new formula is eligible for Homebrew. This should be used when creating new formula and implies `--strict` and `--online`. - * `--fix`: Fix style violations automatically using RuboCop's auto-correct feature. - * `--display-cop-names`: Include the RuboCop cop name for each violation in the output. - * `--display-filename`: Prefix everyline of output with name of the file or formula being audited, to make output easy to grep. - * `-D`, `--audit-debug`: Activates debugging and profiling - * `--only`: Passing `--only`=`method` will run only the methods named audit_`method`, `method` should be a comma-separated list. - * `--except`: Passing `--except`=`method` will run only the methods named audit_`method`, `method` should be a comma-separated list. - * `--only-cops`: Passing `--only-cops`=`cops` will check for violations of only the listed RuboCop cops. `cops` should be a comma-separated list of cop names. - * `--except-cops`: Passing `--except-cops`=`cops` will skip checking the listed RuboCop cops violations. `cops` should be a comma-separated list of cop names. - * `-v`, `--verbose`: Make some output more verbose. - * `-d`, `--debug`: Display any debugging information. - * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`--only=``method`|`--except=``method`] [`--only-cops=``cops`|`--except-cops=``cops`] [`formulae`]: - Check `formulae` for Homebrew coding style violations. This should be - run before submitting a new formula. +`bottle` [`options`] [`formulae`]: - If no `formulae` are provided, all of them are checked. +Generate a bottle (binary package) from a formula installed with +`--build-bottle`. - If `--strict` is passed, additional checks are run, including RuboCop - style checks. +If the formula specifies a rebuild version, it will be incremented in the +generated DSL. Passing `--keep-old` will attempt to keep it at its +original value, while `--no-rebuild` will remove it. - If `--fix` is passed, style violations will be - automatically fixed using RuboCop's auto-correct feature. +* `--skip-relocation`: +Do not check if the bottle can be marked as relocatable. +* `--or-later`: +Append `_or_later` to the bottle tag. +* `--force-core-tap`: +Build a bottle even if `formula` is not in homebrew/core or any installed taps. +* `--no-rebuild`: +If the formula specifies a rebuild version, it will be removed in the generated DSL. +* `--keep-old`: +If the formula specifies a rebuild version, it will attempted to be kept in the generated DSL. +* `--merge`: +Generate a bottle from a formula and print the new DSL merged into the existing formula. +* `--write`: +Changes will be written to the formula file. A new commit will be generated unless `--no-commit` is passed. +* `--no-commit`: +When passed with `--write`, a new commit will not generated while writing changes to the formula file. +* `--json`: +Write bottle information to a JSON file, which can be used as the argument for `--merge`. +* `--root-url`: +Use the specified `URL` as the root of the bottle's URL instead of Homebrew's default. +* `-v`, `--verbose`: +Make some output more verbose. +* `-d`, `--debug`: +Display any debugging information. - If `--online` is passed, additional slower checks that require a network - connection are run. +`bump-formula-pr` [`options`] `formula`: - If `--new-formula` is passed, various additional checks are run that check - if a new formula is eligible for Homebrew. This should be used when creating - new formulae and implies `--strict` and `--online`. +Creates a pull request to update the formula with a new URL or a new tag. - If `--display-cop-names` is passed, the RuboCop cop name for each violation - is included in the output. +If a `URL` is specified, the `sha-256` checksum of the new download must +also be specified. A best effort to determine the `sha-256` and `formula` +name will be made if either or both values are not supplied by the user. - If `--display-filename` is passed, every line of output is prefixed with the - name of the file or formula being audited, to make the output easy to grep. +If a `tag` is specified, the git commit `revision` corresponding to that +tag must also be specified. - Passing `--only=``method` will run only the methods named `audit_`method, - while `--except=``method` will skip the methods named `audit_`method. - For either option `method` should be a comma-separated list. +Note that this command cannot be used to transition a formula from a +URL-and-sha256 style specification into a tag-and-revision style +specification, nor vice versa. It must use whichever style specification +the preexisting formula already uses. - Passing `--only-cops=``cops` will check for violations of only the listed - RuboCop `cops`, while `--except-cops=``cops` will skip checking the listed - `cops`. For either option `cops` should be a comma-separated list of cop names. +* `--devel`: +Bump the development rather than stable version. The development spec must already exist. +* `-n`, `--dry-run`: +Print what would be done rather than doing it. +* `--write`: +When passed along with `--dry-run`, perform a not-so-dry run making the expected file modifications but not taking any git actions. +* `--audit`: +Run `brew audit` before opening the PR. +* `--strict`: +Run `brew audit --strict` before opening the PR. +* `--no-browse`: +Output the pull request URL instead of opening in a browser +* `--url`: +Provide new `URL` for the formula. If a `URL` is specified, the `sha-256` checksum of the new download must also be specified. +* `--revision`: +Specify the new git commit `revision` corresponding to a specified `tag`. +* `--tag`: +Specify the new git commit `tag` for the formula. +* `--sha256`: +Specify the `sha-256` checksum of new download. +* `--mirror`: +Use the provided `URL` as a mirror URL. +* `--version`: +Use the provided `version` to override the value parsed from the URL or tag. Note that `--version=0` can be used to delete an existing `version` override from a formula if it has become redundant. +* `--message`: +Append provided `message` to the default PR message. +* `-q`, `--quiet`: +Suppress any warnings. +* `-f`, `--force`: +Override warnings and enable potentially unsafe operations. +* `-v`, `--verbose`: +Make some output more verbose. +* `-d`, `--debug`: +Display any debugging information. - `audit` exits with a non-zero status if any errors are found. This is useful, - for instance, for implementing pre-commit hooks. +`create` `URL` [`options`]: - * `bottle` [`--verbose`] [`--no-rebuild`|`--keep-old`] [`--skip-relocation`] [`--or-later`] [`--root-url=``URL`] [`--force-core-tap`] [`--json`] `formulae`: - Generate a bottle (binary package) from a formula installed with - `--build-bottle`. +Generate a formula for the downloadable file at `URL` and open it in the editor. +Homebrew will attempt to automatically derive the formula name +and version, but if it fails, you'll have to make your own template. The `wget` +formula serves as a simple example. For the complete API have a look at +. - If the formula specifies a rebuild version, it will be incremented in the - generated DSL. Passing `--keep-old` will attempt to keep it at its - original value, while `--no-rebuild` will remove it. +* `--autotools`: +Create a basic template for an Autotools-style build. +* `--cmake`: +Create a basic template for a CMake-style build. +* `--meson`: +Create a basic template for a Meson-style build. +* `--no-fetch`: +Homebrew will not download `URL` to the cache and will thus not add the SHA256 to the formula for you. It will also not check the GitHub API for GitHub projects (to fill out the description and homepage). +* `--HEAD`: +HEAD +* `--set-name`: +Set the provided name of the package you are creating. +* `--set-version`: +Set the provided version of the package you are creating. +* `--tap`: +Takes a tap [`user``/``repo`] as argument and generates the formula in the specified tap. +* `-f`, `--force`: +Override warnings and enable potentially unsafe operations. +* `-v`, `--verbose`: +Make some output more verbose. +* `-d`, `--debug`: +Display any debugging information. - If `--verbose` (or `-v`) is passed, print the bottling commands and any warnings - encountered. +* `edit`: + Open all of Homebrew for editing. - If `--skip-relocation` is passed, do not check if the bottle can be marked - as relocatable. +* `edit` `formula`: + Open `formula` in the editor. - If `--root-url` is passed, use the specified `URL` as the root of the - bottle's URL instead of Homebrew's default. +* `-f`, `--force`: +Override warnings and enable potentially unsafe operations. +* `-v`, `--verbose`: +Make some output more verbose. +* `-d`, `--debug`: +Display any debugging information. - If `--or-later` is passed, append _or_later to the bottle tag. +`formula` `formula`: - If `--force-core-tap` is passed, build a bottle even if `formula` is not - in homebrew/core or any installed taps. +Display the path where `formula` is located. - If `--json` is passed, write bottle information to a JSON file, which can - be used as the argument for `--merge`. +* `-d`, `--debug`: +Display any debugging information. +* `-v`, `--verbose`: +Make some output more verbose. - * `bottle` `--merge` [`--keep-old`] [`--write` [`--no-commit`]] `bottle_json_files`: - Generate a bottle from a `--json` output file and print the new DSL merged - into the existing formula. +`irb` [`options`]: - If `--write` is passed, write the changes to the formula file. A new - commit will then be generated unless `--no-commit` is passed. +Enter the interactive Homebrew Ruby shell. - * `bump-formula-pr` [`--devel`] [`--dry-run` [`--write`]] [`--audit`|`--strict`] [`--mirror=``URL`] [`--version=``version`] [`--message=``message`] (`--url=``URL` `--sha256=``sha-256`|`--tag=``tag` `--revision=``revision`) `formula`: - Creates a pull request to update the formula with a new URL or a new tag. +* `--examples`: +Show several examples. +* `--pry`: +Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set. - If a `URL` is specified, the `sha-256` checksum of the new download must - also be specified. A best effort to determine the `sha-256` and `formula` - name will be made if either or both values are not supplied by the user. +`linkage` [`options`] `formula`: - If a `tag` is specified, the git commit `revision` corresponding to that - tag must also be specified. +Checks the library links of an installed formula. - If `--devel` is passed, bump the development rather than stable version. - The development spec must already exist. +Only works on installed formulae. An error is raised if it is run on +uninstalled formulae. - If `--dry-run` is passed, print what would be done rather than doing it. +* `--test`: +Display only missing libraries and exit with a non-zero exit code if any missing libraries were found. +* `--reverse`: +Print the dylib followed by the binaries which link to it for each library the keg references. +* `--cached`: +Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous `brew linkage` run. +* `-v`, `--verbose`: +Make some output more verbose. +* `-d`, `--debug`: +Display any debugging information. - If `--write` is passed along with `--dry-run`, perform a not-so-dry run - making the expected file modifications but not taking any git actions. +`man` [`options`]: - If `--audit` is passed, run `brew audit` before opening the PR. +Generate Homebrew's manpages. - If `--strict` is passed, run `brew audit --strict` before opening the PR. +* `--fail-if-changed`: +Return a failing status code if changes are detected in the manpage outputs. This can be used for CI to be notified when the manpages are out of date. Additionally, the date used in new manpages will match those in the existing manpages (to allow comparison without factoring in the date). +* `--link`: +It is now done automatically by `brew update`. - If `--mirror=``URL` is passed, use the value as a mirror URL. +`mirror` [`formulae`]: + + Reuploads the stable URL for a formula to Bintray to use it as a mirror. - If `--version=``version` is passed, use the value to override the value - parsed from the URL or tag. Note that `--version=0` can be used to delete - an existing `version` override from a formula if it has become redundant. - - If `--message=``message` is passed, append `message` to the default PR - message. - - If `--no-browse` is passed, don't pass the `--browse` argument to `hub` - which opens the pull request URL in a browser. Instead, output it to the - command line. - - If `--quiet` is passed, don't output replacement messages or warn about - duplicate pull requests. - - Note that this command cannot be used to transition a formula from a - URL-and-sha256 style specification into a tag-and-revision style - specification, nor vice versa. It must use whichever style specification - the preexisting formula already uses. - - * `create` `URL` [`--autotools`|`--cmake`|`--meson`] [`--no-fetch`] [`--set-name` `name`] [`--set-version` `version`] [`--tap` `user``/``repo`]: - Generate a formula for the downloadable file at `URL` and open it in the editor. - Homebrew will attempt to automatically derive the formula name - and version, but if it fails, you'll have to make your own template. The `wget` - formula serves as a simple example. For the complete API have a look at - . - - If `--autotools` is passed, create a basic template for an Autotools-style build. - If `--cmake` is passed, create a basic template for a CMake-style build. - If `--meson` is passed, create a basic template for a Meson-style build. - - If `--no-fetch` is passed, Homebrew will not download `URL` to the cache and - will thus not add the SHA256 to the formula for you. It will also not check - the GitHub API for GitHub projects (to fill out the description and homepage). - - The options `--set-name` and `--set-version` each take an argument and allow - you to explicitly set the name and version of the package you are creating. - - The option `--tap` takes a tap as its argument and generates the formula in - the specified tap. - - * `edit`: - Open all of Homebrew for editing. - - * `edit` `formula`: - Open `formula` in the editor. - - * `extract` [`--force`] `formula` `tap` [`--version=``version`]: - Looks through repository history to find the `version` of `formula` and - creates a copy in `tap`/Formula/`formula`@`version`.rb. If the tap is - not installed yet, attempts to install/clone the tap before continuing. - - If `--force` is passed, the file at the destination will be overwritten - if it already exists. Otherwise, existing files will be preserved. - - If an argument is passed through `--version`, `version` of `formula` - will be extracted and placed in the destination tap. Otherwise, the most - recent version that can be found will be used. - - * `formula` `formula`: - Display the path where `formula` is located. - - * `irb` [`--examples`] [`--pry`]: - Enter the interactive Homebrew Ruby shell. - - If `--examples` is passed, several examples will be shown. - If `--pry` is passed or HOMEBREW_PRY is set, pry will be - used instead of irb. - - * `linkage` [`--test`] [`--reverse`] [`formulae`]: - Checks the library links of installed formulae. - - Only works on installed formulae. An error is raised if it is run on - uninstalled formulae. - - If `--test` is passed, only display missing libraries and exit with a - non-zero exit code if any missing libraries were found. - - If `--reverse` is passed, print the dylib followed by the binaries - which link to it for each library the keg references. - - If `formulae` are given, check linkage for only the specified brews. - - * `man` [`--fail-if-changed`]: - Generate Homebrew's manpages. - - If `--fail-if-changed` is passed, the command will return a failing - status code if changes are detected in the manpage outputs. - This can be used for CI to be notified when the manpages are out of date. - Additionally, the date used in new manpages will match those in the existing - manpages (to allow comparison without factoring in the date). +* `-d`, `--debug`: +Display any debugging information. +* `-v`, `--verbose`: +Make some output more verbose. * `prof` [`ruby options`]: Run Homebrew with the Ruby profiler. For example: - * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] [`--bintray-org=``bintray-org`] [`--test-bot-user=``test-bot-user`] `patch-source` [`patch-source`]: +`bump-formula-pr` [`options`] `formula`: - Gets a patch from a GitHub commit or pull request and applies it to Homebrew. - Optionally, installs the formulae changed by the patch. +Gets a patch from a GitHub commit or pull request and applies it to Homebrew. +Optionally, installs the formulae changed by the patch. - Each `patch-source` may be one of: +Each `patch-source` may be one of: - ~ The ID number of a PR (pull request) in the homebrew/core GitHub - repository + ~ The ID number of a PR (pull request) in the homebrew/core GitHub + repository - ~ The URL of a PR on GitHub, using either the web page or API URL - formats. In this form, the PR may be on Homebrew/brew, - Homebrew/homebrew-core or any tap. + ~ The URL of a PR on GitHub, using either the web page or API URL + formats. In this form, the PR may be on Homebrew/brew, + Homebrew/homebrew-core or any tap. - ~ The URL of a commit on GitHub + ~ The URL of a commit on GitHub - ~ A "https://jenkins.brew.sh/job/..." string specifying a testing job ID + ~ A "https://jenkins.brew.sh/job/..." string specifying a testing job ID - If `--bottle` is passed, handle bottles, pulling the bottle-update - commit and publishing files on Bintray. +* `--bottle`: +Handle bottles, pulling the bottle-update commit and publishing files on Bintray. +* `--bump`: +For one-formula PRs, automatically reword commit message to our preferred format. +* `--clean`: +Do not rewrite or otherwise modify the commits found in the pulled PR. +* `--ignore-whitespace`: +Silently ignore whitespace discrepancies when applying diffs. +* `--resolve`: +When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting. +* `--branch-okay`: +Do not warn if pulling to a branch besides master (useful for testing). +* `--no-pbcopy`: +Do not copy anything to the system clipboard. +* `--no-publish`: +Do not publish bottles to Bintray. +* `--warn-on-publish-failure`: +Do not exit if there's a failure publishing bottles on Bintray. +* `--bintray-org`: +Publish at the given Bintray organisation. +* `--test-bot-user`: +Pull the bottle block commit from the specified user on GitHub. +* `-v`, `--verbose`: +Make some output more verbose. +* `-d`, `--debug`: +Display any debugging information. - If `--bump` is passed, for one-formula PRs, automatically reword - commit message to our preferred format. +`release-notes` [`previous_tag`] [`end_ref`]: - If `--clean` is passed, do not rewrite or otherwise modify the - commits found in the pulled PR. +Output the merged pull requests on Homebrew/brew between two Git refs. +If no `previous_tag` is provided it defaults to the latest tag. +If no `end_ref` is provided it defaults to `origin/master`. - If `--ignore-whitespace` is passed, silently ignore whitespace - discrepancies when applying diffs. - - If `--resolve` is passed, when a patch fails to apply, leave in - progress and allow user to resolve, instead of aborting. - - If `--branch-okay` is passed, do not warn if pulling to a branch - besides master (useful for testing). - - If `--no-pbcopy` is passed, do not copy anything to the system - clipboard. - - If `--no-publish` is passed, do not publish bottles to Bintray. - - If `--warn-on-publish-failure` was passed, do not exit if there's a - failure publishing bottles on Bintray. - - If `--bintray-org=``bintray-org` is passed, publish at the given Bintray - organisation. - - If `--test-bot-user=``test-bot-user` is passed, pull the bottle block - commit from the specified user on GitHub. - - * `release-notes` [`--markdown`] [`previous_tag`] [`end_ref`]: - Output the merged pull requests on Homebrew/brew between two Git refs. - If no `previous_tag` is provided it defaults to the latest tag. - If no `end_ref` is provided it defaults to `origin/master`. - - If `--markdown` is passed, output as a Markdown list. +* `--markdown`: +Output as a Markdown list. * `ruby` [`ruby options`]: Run a Ruby instance with Homebrew's libraries loaded. For example: - * `tap-new` `user``/``repo`: - Generate the template files for a new tap. +`tap-new` `user``/``repo`: + +Generate the template files for a new tap. + +* `-d`, `--debug`: +Display any debugging information. +* `-v`, `--verbose`: +Make some output more verbose. * `test` [`--devel`|`--HEAD`] [`--debug`] [`--keep-tmp`] `formula`: Most formulae provide a test method. `brew test` `formula` runs this @@ -978,38 +968,47 @@ Display any debugging information. Example: `brew install jruby && brew test jruby` - * `tests` [`--verbose`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=``test_script`[`:``line_number`]] [`--seed=``seed`] [`--online`] [`--official-cmd-taps`]: - Run Homebrew's unit and integration tests. If provided, - `--only=``test_script` runs only `test_script`_spec.rb, and `--seed` - randomizes tests with the provided value instead of a random seed. +`tests` [`options`] `formula`: - If `--verbose` (or `-v`) is passed, print the command that runs the tests. +Run Homebrew's unit and integration tests. If provided, +`--only=``test_script` runs only `test_script`_spec.rb, and `--seed` +randomizes tests with the provided value instead of a random seed. - If `--coverage` is passed, also generate code coverage reports. +* `--coverage`: +Generate code coverage reports. +* `--generic`: +Run only OS-agnostic tests. +* `--no-compat`: +Do not load the compatibility layer when running tests. +* `--online`: +Include tests that use the GitHub API and tests that use any of the taps for official external commands. +* `--only`: +Run only `test_script`_spec.rb +* `--seed`: +Randomizes tests with the provided value instead of a random seed. +* `-v`, `--verbose`: +Make some output more verbose. +* `-d`, `--debug`: +Display any debugging information. - If `--generic` is passed, only run OS-agnostic tests. +`update-test` [`options`]: - If `--no-compat` is passed, do not load the compatibility layer when - running tests. + Runs a test of `brew update` with a new repository clone. - If `--online` is passed, include tests that use the GitHub API and tests - that use any of the taps for official external commands. + If no arguments are passed, use `origin/master` as the start commit. - * `update-test` [`--commit=``commit`] [`--before=``date`] [`--to-tag`] [`--keep-tmp`]: - Runs a test of `brew update` with a new repository clone. - - If no arguments are passed, use `origin/master` as the start commit. - - If `--commit=``commit` is passed, use `commit` as the start commit. - - If `--before=``date` is passed, use the commit at `date` as the - start commit. - - If `--to-tag` is passed, set `HOMEBREW_UPDATE_TO_TAG` to test updating - between tags. - - If `--keep-tmp` is passed, retain the temporary directory containing - the new repository clone. +* `--to-tag`: +Set `HOMEBREW_UPDATE_TO_TAG` to test updating between tags. +* `--keep-tmp`: +Retain the temporary directory containing the new repository clone. +* `--commit`: +Use provided `commit` as the start commit. +* `--before`: +Use the commit at provided `date` as the start commit. +* `-v`, `--verbose`: +Make some output more verbose. +* `-d`, `--debug`: +Display any debugging information. ## OFFICIAL EXTERNAL COMMANDS diff --git a/manpages/brew.1 b/manpages/brew.1 index 87e07f7de3..0811cd9727 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -43,8 +43,55 @@ Perform a substring search of formula names for \fItext\fR\. If \fItext\fR is su . .SH "COMMANDS" . -.IP "\(bu" 4 -\fBanalytics\fR [\fBstate\fR]: Display anonymous user behaviour analytics state\. Read more at \fIhttps://docs\.brew\.sh/Analytics\fR\. +.TP +\fB\-\-cache\fR +Display Homebrew\'s download cache\. See also \fBHOMEBREW_CACHE\fR\. +. +.TP +\fB\-\-cache\fR [\fB\-\-build\-from\-source\fR|\fB\-s\fR] [\fB\-\-force\-bottle\fR] \fIformula\fR +Display the file or directory used to cache \fIformula\fR\. +. +.TP +\fB\-\-cellar\fR +Display Homebrew\'s Cellar path\. \fIDefault:\fR \fB$(brew \-\-prefix)/Cellar\fR, or if that directory doesn\'t exist, \fB$(brew \-\-repository)/Cellar\fR\. +. +.TP +\fB\-\-cellar\fR \fIformula\fR +Display the location in the cellar where \fIformula\fR would be installed, without any sort of versioned directory as the last path\. +. +.TP +\fB\-\-env\fR [\fB\-\-shell=\fR(\fIshell\fR|\fBauto\fR)|\fB\-\-plain\fR] +Show a summary of the Homebrew build environment as a plain list\. +. +.IP +Pass \fB\-\-shell=\fR\fIshell\fR to generate a list of environment variables for the specified shell, or \fB\-\-shell=auto\fR to detect the current shell\. +. +.IP +If the command\'s output is sent through a pipe and no shell is specified, the list is formatted for export to \fBbash\fR(1) unless \fB\-\-plain\fR is passed\. +. +.TP +\fB\-\-prefix\fR +Display Homebrew\'s install path\. \fIDefault:\fR \fB/usr/local\fR +. +.TP +\fB\-\-prefix\fR \fIformula\fR +Display the location in the cellar where \fIformula\fR is or would be installed\. +. +.TP +\fB\-\-repository\fR +Display where Homebrew\'s \fB\.git\fR directory is located\. +. +.TP +\fB\-\-repository\fR \fIuser\fR\fB/\fR\fIrepo\fR +Display where tap \fIuser\fR\fB/\fR\fIrepo\fR\'s directory is located\. +. +.TP +\fB\-\-version\fR +Print the version number of Homebrew to standard output and exit\. +. +.TP +\fBanalytics\fR [\fBstate\fR] +Display anonymous user behaviour analytics state\. Read more at \fIhttps://docs\.brew\.sh/Analytics\fR\. . .IP "\(bu" 4 \fBanalytics\fR (\fBon\fR|\fBoff\fR): Turn on/off Homebrew\'s analytics\. @@ -433,8 +480,38 @@ Exits with a non\-zero status if any style violations are found\. .IP "\(bu" 4 \fBswitch\fR \fIformula\fR \fIversion\fR: Symlink all of the specific \fIversion\fR of \fIformula\fR\'s install to Homebrew prefix\. . -.IP "\(bu" 4 -\fBtap\fR: List all installed taps\. +.TP +\fBtap\-info\fR +Display a brief summary of all installed taps\. +. +.TP +\fBtap\-info\fR (\fB\-\-installed\fR|\fItaps\fR) +Display detailed information about one or more \fItaps\fR\. +. +.IP +Pass \fB\-\-installed\fR to display information on all installed taps\. +. +.TP +\fBtap\-info\fR \fB\-\-json=\fR\fIversion\fR (\fB\-\-installed\fR|\fItaps\fR) +Print a JSON representation of \fItaps\fR\. Currently the only accepted value for \fIversion\fR is \fBv1\fR\. +. +.IP +Pass \fB\-\-installed\fR to get information on installed taps\. +. +.IP +See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR +. +.TP +\fBtap\-pin\fR \fItap\fR +Pin \fItap\fR, prioritizing its formulae over core when formula names are supplied by the user\. See also \fBtap\-unpin\fR\. +. +.TP +\fBtap\-unpin\fR \fItap\fR +Unpin \fItap\fR so its formulae are no longer prioritized\. See also \fBtap\-pin\fR\. +. +.TP +\fBtap\fR +List all installed taps\. . .IP "\(bu" 4 \fBtap\fR [\fB\-\-full\fR] [\fB\-\-force\-auto\-update\fR] \fIuser\fR\fB/\fR\fIrepo\fR [\fIURL\fR]: Tap a formula repository\. @@ -460,32 +537,9 @@ By default, only taps hosted on GitHub are auto\-updated (for performance reason .IP "\(bu" 4 \fBtap\fR \fB\-\-list\-pinned\fR: List all pinned taps\. . -.IP "\(bu" 4 -\fBtap\-info\fR: Display a brief summary of all installed taps\. -. -.IP "\(bu" 4 -\fBtap\-info\fR (\fB\-\-installed\fR|\fItaps\fR): Display detailed information about one or more \fItaps\fR\. -. -.IP -Pass \fB\-\-installed\fR to display information on all installed taps\. -. -.IP "\(bu" 4 -\fBtap\-info\fR \fB\-\-json=\fR\fIversion\fR (\fB\-\-installed\fR|\fItaps\fR): Print a JSON representation of \fItaps\fR\. Currently the only accepted value for \fIversion\fR is \fBv1\fR\. -. -.IP -Pass \fB\-\-installed\fR to get information on installed taps\. -. -.IP -See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR -. -.IP "\(bu" 4 -\fBtap\-pin\fR \fItap\fR: Pin \fItap\fR, prioritizing its formulae over core when formula names are supplied by the user\. See also \fBtap\-unpin\fR\. -. -.IP "\(bu" 4 -\fBtap\-unpin\fR \fItap\fR: Unpin \fItap\fR so its formulae are no longer prioritized\. See also \fBtap\-pin\fR\. -. -.IP "\(bu" 4 -\fBuninstall\fR, \fBrm\fR, \fBremove\fR [\fB\-\-force\fR] [\fB\-\-ignore\-dependencies\fR] \fIformula\fR: Uninstall \fIformula\fR\. +.TP +\fBuninstall\fR, \fBrm\fR, \fBremove\fR [\fB\-\-force\fR] [\fB\-\-ignore\-dependencies\fR] \fIformula\fR +Uninstall \fIformula\fR\. . .IP If \fB\-\-force\fR (or \fB\-f\fR) is passed, and there are multiple versions of \fIformula\fR installed, delete all installed versions\. @@ -514,20 +568,9 @@ If \fB\-\-git\fR (or \fB\-g\fR) is passed, a Git repository will be initialized .IP "\(bu" 4 \fBuntap\fR \fItap\fR: Remove a tapped repository\. . -.IP "\(bu" 4 -\fBupdate\fR [\fB\-\-merge\fR] [\fB\-\-force\fR]: Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1) and perform any necessary migrations\. -. -.IP -If \fB\-\-merge\fR is specified then \fBgit merge\fR is used to include updates (rather than \fBgit rebase\fR)\. -. -.IP -If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full update check even if unnecessary\. -. -.IP "\(bu" 4 -\fBupdate\-reset\fR [\fIrepositories\fR]: Fetches and resets Homebrew and all tap repositories (or the specified \fBrepositories\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\. -. -.IP "\(bu" 4 -\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fB\-\-display\-times\fR] [\fIformulae\fR]: Upgrade outdated, unpinned brews (with existing install options)\. +.TP +\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fIformulae\fR] +Upgrade outdated, unpinned brews (with existing install options)\. . .IP Options for the \fBinstall\fR command are also valid here\. @@ -562,43 +605,19 @@ By default, \fBuses\fR shows all formulae that specify \fIformulae\fR as a requi .IP By default, \fBuses\fR shows usage of \fIformulae\fR by stable builds\. To find cases where \fIformulae\fR is used by development or HEAD build, pass \fB\-\-devel\fR or \fB\-\-HEAD\fR\. . -.IP "\(bu" 4 -\fB\-\-cache\fR: Display Homebrew\'s download cache\. See also \fBHOMEBREW_CACHE\fR\. +.TP +\fBupdate\-reset\fR +Fetches and resets Homebrew and all tap repositories using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\. . -.IP "\(bu" 4 -\fB\-\-cache\fR [\fB\-\-build\-from\-source\fR|\fB\-s\fR] [\fB\-\-force\-bottle\fR] \fIformula\fR: Display the file or directory used to cache \fIformula\fR\. -. -.IP "\(bu" 4 -\fB\-\-cellar\fR: Display Homebrew\'s Cellar path\. \fIDefault:\fR \fB$(brew \-\-prefix)/Cellar\fR, or if that directory doesn\'t exist, \fB$(brew \-\-repository)/Cellar\fR\. -. -.IP "\(bu" 4 -\fB\-\-cellar\fR \fIformula\fR: Display the location in the cellar where \fIformula\fR would be installed, without any sort of versioned directory as the last path\. -. -.IP "\(bu" 4 -\fB\-\-env\fR [\fB\-\-shell=\fR(\fIshell\fR|\fBauto\fR)|\fB\-\-plain\fR]: Show a summary of the Homebrew build environment as a plain list\. +.TP +\fBupdate\fR [\fB\-\-merge\fR] [\fB\-\-force\fR] +Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1) and perform any necessary migrations\. . .IP -Pass \fB\-\-shell=\fR\fIshell\fR to generate a list of environment variables for the specified shell, or \fB\-\-shell=auto\fR to detect the current shell\. +If \fB\-\-merge\fR is specified then \fBgit merge\fR is used to include updates (rather than \fBgit rebase\fR)\. . .IP -If the command\'s output is sent through a pipe and no shell is specified, the list is formatted for export to \fBbash\fR(1) unless \fB\-\-plain\fR is passed\. -. -.IP "\(bu" 4 -\fB\-\-prefix\fR: Display Homebrew\'s install path\. \fIDefault:\fR \fB/usr/local\fR on macOS and \fB/home/linuxbrew/\.linuxbrew\fR on Linux -. -.IP "\(bu" 4 -\fB\-\-prefix\fR \fIformula\fR: Display the location in the cellar where \fIformula\fR is or would be installed\. -. -.IP "\(bu" 4 -\fB\-\-repository\fR: Display where Homebrew\'s \fB\.git\fR directory is located\. -. -.IP "\(bu" 4 -\fB\-\-repository\fR \fIuser\fR\fB/\fR\fIrepo\fR: Display where tap \fIuser\fR\fB/\fR\fIrepo\fR\'s directory is located\. -. -.IP "\(bu" 4 -\fB\-\-version\fR: Print the version number of Homebrew to standard output and exit\. -. -.IP "" 0 +If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full update check even if unnecessary\. . .SH "DEVELOPER COMMANDS" \fBaudit\fR [\fIoptions\fR] [\fIformulae\fR]: @@ -661,130 +680,198 @@ Make some output more verbose\. \fB\-d\fR, \fB\-\-debug\fR Display any debugging information\. . -.TP -\fBaudit\fR [\fB\-\-strict\fR] [\fB\-\-fix\fR] [\fB\-\-online\fR] [\fB\-\-new\-formula\fR] [\fB\-\-display\-cop\-names\fR] [\fB\-\-display\-filename\fR] [\fB\-\-only=\fR\fImethod\fR|\fB\-\-except=\fR\fImethod\fR] [\fB\-\-only\-cops=\fR\fIcops\fR|\fB\-\-except\-cops=\fR\fIcops\fR] [\fIformulae\fR] -Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\. +.P +\fBbottle\fR [\fIoptions\fR] [\fIformulae\fR]: . -.IP -If no \fIformulae\fR are provided, all of them are checked\. -. -.IP -If \fB\-\-strict\fR is passed, additional checks are run, including RuboCop style checks\. -. -.IP -If \fB\-\-fix\fR is passed, style violations will be automatically fixed using RuboCop\'s auto\-correct feature\. -. -.IP -If \fB\-\-online\fR is passed, additional slower checks that require a network connection are run\. -. -.IP -If \fB\-\-new\-formula\fR is passed, various additional checks are run that check if a new formula is eligible for Homebrew\. This should be used when creating new formulae and implies \fB\-\-strict\fR and \fB\-\-online\fR\. -. -.IP -If \fB\-\-display\-cop\-names\fR is passed, the RuboCop cop name for each violation is included in the output\. -. -.IP -If \fB\-\-display\-filename\fR is passed, every line of output is prefixed with the name of the file or formula being audited, to make the output easy to grep\. -. -.IP -Passing \fB\-\-only=\fR\fImethod\fR will run only the methods named \fBaudit_\fR, while \fB\-\-except=\fR\fImethod\fR will skip the methods named \fBaudit_\fR\. For either option \fImethod\fR should be a comma\-separated list\. -. -.IP -Passing \fB\-\-only\-cops=\fR\fIcops\fR will check for violations of only the listed RuboCop \fIcops\fR, while \fB\-\-except\-cops=\fR\fIcops\fR will skip checking the listed \fIcops\fR\. For either option \fIcops\fR should be a comma\-separated list of cop names\. -. -.IP -\fBaudit\fR exits with a non\-zero status if any errors are found\. This is useful, for instance, for implementing pre\-commit hooks\. -. -.TP -\fBbottle\fR [\fB\-\-verbose\fR] [\fB\-\-no\-rebuild\fR|\fB\-\-keep\-old\fR] [\fB\-\-skip\-relocation\fR] [\fB\-\-or\-later\fR] [\fB\-\-root\-url=\fR\fIURL\fR] [\fB\-\-force\-core\-tap\fR] [\fB\-\-json\fR] \fIformulae\fR +.P Generate a bottle (binary package) from a formula installed with \fB\-\-build\-bottle\fR\. . -.IP +.P If the formula specifies a rebuild version, it will be incremented in the generated DSL\. Passing \fB\-\-keep\-old\fR will attempt to keep it at its original value, while \fB\-\-no\-rebuild\fR will remove it\. . -.IP -If \fB\-\-verbose\fR (or \fB\-v\fR) is passed, print the bottling commands and any warnings encountered\. +.TP +\fB\-\-skip\-relocation\fR +Do not check if the bottle can be marked as relocatable\. . -.IP -If \fB\-\-skip\-relocation\fR is passed, do not check if the bottle can be marked as relocatable\. +.TP +\fB\-\-or\-later\fR +Append \fB_or_later\fR to the bottle tag\. . -.IP -If \fB\-\-root\-url\fR is passed, use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew\'s default\. +.TP +\fB\-\-force\-core\-tap\fR +Build a bottle even if \fIformula\fR is not in homebrew/core or any installed taps\. . -.IP -If \fB\-\-or\-later\fR is passed, append _or_later to the bottle tag\. +.TP +\fB\-\-no\-rebuild\fR +If the formula specifies a rebuild version, it will be removed in the generated DSL\. . -.IP -If \fB\-\-force\-core\-tap\fR is passed, build a bottle even if \fIformula\fR is not in homebrew/core or any installed taps\. +.TP +\fB\-\-keep\-old\fR +If the formula specifies a rebuild version, it will attempted to be kept in the generated DSL\. +. +.TP +\fB\-\-merge\fR +Generate a bottle from a formula and print the new DSL merged into the existing formula\. +. +.TP +\fB\-\-write\fR +Changes will be written to the formula file\. A new commit will be generated unless \fB\-\-no\-commit\fR is passed\. +. +.TP +\fB\-\-no\-commit\fR +When passed with \fB\-\-write\fR, a new commit will not generated while writing changes to the formula file\. +. +.TP +\fB\-\-json\fR +Write bottle information to a JSON file, which can be used as the argument for \fB\-\-merge\fR\. +. +.TP +\fB\-\-root\-url\fR +Use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew\'s default\. +. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. +. +.TP +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. +. +.P +\fBbump\-formula\-pr\fR [\fIoptions\fR] \fIformula\fR: +. +.P +Creates a pull request to update the formula with a new URL or a new tag\. +. +.P +If a \fIURL\fR is specified, the \fIsha\-256\fR checksum of the new download must also be specified\. A best effort to determine the \fIsha\-256\fR and \fIformula\fR name will be made if either or both values are not supplied by the user\. +. +.P +If a \fItag\fR is specified, the git commit \fIrevision\fR corresponding to that tag must also be specified\. +. +.P +Note that this command cannot be used to transition a formula from a URL\-and\-sha256 style specification into a tag\-and\-revision style specification, nor vice versa\. It must use whichever style specification the preexisting formula already uses\. . .IP If \fB\-\-json\fR is passed, write bottle information to a JSON file, which can be used as the argument for \fB\-\-merge\fR\. . .TP -\fBbottle\fR \fB\-\-merge\fR [\fB\-\-keep\-old\fR] [\fB\-\-write\fR [\fB\-\-no\-commit\fR]] \fIbottle_json_files\fR -Generate a bottle from a \fB\-\-json\fR output file and print the new DSL merged into the existing formula\. -. -.IP -If \fB\-\-write\fR is passed, write the changes to the formula file\. A new commit will then be generated unless \fB\-\-no\-commit\fR is passed\. +\fB\-\-devel\fR +Bump the development rather than stable version\. The development spec must already exist\. . .TP -\fBbump\-formula\-pr\fR [\fB\-\-devel\fR] [\fB\-\-dry\-run\fR [\fB\-\-write\fR]] [\fB\-\-audit\fR|\fB\-\-strict\fR] [\fB\-\-mirror=\fR\fIURL\fR] [\fB\-\-version=\fR\fIversion\fR] [\fB\-\-message=\fR\fImessage\fR] (\fB\-\-url=\fR\fIURL\fR \fB\-\-sha256=\fR\fIsha\-256\fR|\fB\-\-tag=\fR\fItag\fR \fB\-\-revision=\fR\fIrevision\fR) \fIformula\fR -Creates a pull request to update the formula with a new URL or a new tag\. -. -.IP -If a \fIURL\fR is specified, the \fIsha\-256\fR checksum of the new download must also be specified\. A best effort to determine the \fIsha\-256\fR and \fIformula\fR name will be made if either or both values are not supplied by the user\. -. -.IP -If a \fItag\fR is specified, the git commit \fIrevision\fR corresponding to that tag must also be specified\. -. -.IP -If \fB\-\-devel\fR is passed, bump the development rather than stable version\. The development spec must already exist\. -. -.IP -If \fB\-\-dry\-run\fR is passed, print what would be done rather than doing it\. -. -.IP -If \fB\-\-write\fR is passed along with \fB\-\-dry\-run\fR, perform a not\-so\-dry run making the expected file modifications but not taking any git actions\. -. -.IP -If \fB\-\-audit\fR is passed, run \fBbrew audit\fR before opening the PR\. -. -.IP -If \fB\-\-strict\fR is passed, run \fBbrew audit \-\-strict\fR before opening the PR\. -. -.IP -If \fB\-\-mirror=\fR\fIURL\fR is passed, use the value as a mirror URL\. -. -.IP -If \fB\-\-version=\fR\fIversion\fR is passed, use the value to override the value parsed from the URL or tag\. Note that \fB\-\-version=0\fR can be used to delete an existing \fBversion\fR override from a formula if it has become redundant\. -. -.IP -If \fB\-\-message=\fR\fImessage\fR is passed, append \fImessage\fR to the default PR message\. -. -.IP -If \fB\-\-no\-browse\fR is passed, don\'t pass the \fB\-\-browse\fR argument to \fBhub\fR which opens the pull request URL in a browser\. Instead, output it to the command line\. -. -.IP -If \fB\-\-quiet\fR is passed, don\'t output replacement messages or warn about duplicate pull requests\. -. -.IP -Note that this command cannot be used to transition a formula from a URL\-and\-sha256 style specification into a tag\-and\-revision style specification, nor vice versa\. It must use whichever style specification the preexisting formula already uses\. +\fB\-n\fR, \fB\-\-dry\-run\fR +Print what would be done rather than doing it\. . .TP -\fBcreate\fR \fIURL\fR [\fB\-\-autotools\fR|\fB\-\-cmake\fR|\fB\-\-meson\fR] [\fB\-\-no\-fetch\fR] [\fB\-\-set\-name\fR \fIname\fR] [\fB\-\-set\-version\fR \fIversion\fR] [\fB\-\-tap\fR \fIuser\fR\fB/\fR\fIrepo\fR] +\fB\-\-write\fR +When passed along with \fB\-\-dry\-run\fR, perform a not\-so\-dry run making the expected file modifications but not taking any git actions\. +. +.TP +\fB\-\-audit\fR +Run \fBbrew audit\fR before opening the PR\. +. +.TP +\fB\-\-strict\fR +Run \fBbrew audit \-\-strict\fR before opening the PR\. +. +.TP +\fB\-\-no\-browse\fR +Output the pull request URL instead of opening in a browser +. +.TP +\fB\-\-url\fR +Provide new \fIURL\fR for the formula\. If a \fIURL\fR is specified, the \fIsha\-256\fR checksum of the new download must also be specified\. +. +.TP +\fB\-\-revision\fR +Specify the new git commit \fIrevision\fR corresponding to a specified \fItag\fR\. +. +.TP +\fB\-\-tag\fR +Specify the new git commit \fItag\fR for the formula\. +. +.TP +\fB\-\-sha256\fR +Specify the \fIsha\-256\fR checksum of new download\. +. +.TP +\fB\-\-mirror\fR +Use the provided \fIURL\fR as a mirror URL\. +. +.TP +\fB\-\-version\fR +Use the provided \fIversion\fR to override the value parsed from the URL or tag\. Note that \fB\-\-version=0\fR can be used to delete an existing \fBversion\fR override from a formula if it has become redundant\. +. +.TP +\fB\-\-message\fR +Append provided \fImessage\fR to the default PR message\. +. +.TP +\fB\-q\fR, \fB\-\-quiet\fR +Suppress any warnings\. +. +.TP +\fB\-f\fR, \fB\-\-force\fR +Override warnings and enable potentially unsafe operations\. +. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. +. +.TP +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. +. +.P +\fBcreate\fR \fIURL\fR [\fIoptions\fR]: +. +.P Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The \fBwget\fR formula serves as a simple example\. For the complete API have a look at \fIhttp://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\fR\. . -.IP -If \fB\-\-autotools\fR is passed, create a basic template for an Autotools\-style build\. If \fB\-\-cmake\fR is passed, create a basic template for a CMake\-style build\. If \fB\-\-meson\fR is passed, create a basic template for a Meson\-style build\. +.TP +\fB\-\-autotools\fR +Create a basic template for an Autotools\-style build\. . -.IP -If \fB\-\-no\-fetch\fR is passed, Homebrew will not download \fIURL\fR to the cache and will thus not add the SHA256 to the formula for you\. It will also not check the GitHub API for GitHub projects (to fill out the description and homepage)\. +.TP +\fB\-\-cmake\fR +Create a basic template for a CMake\-style build\. . -.IP -The options \fB\-\-set\-name\fR and \fB\-\-set\-version\fR each take an argument and allow you to explicitly set the name and version of the package you are creating\. +.TP +\fB\-\-meson\fR +Create a basic template for a Meson\-style build\. . -.IP -The option \fB\-\-tap\fR takes a tap as its argument and generates the formula in the specified tap\. +.TP +\fB\-\-no\-fetch\fR +Homebrew will not download \fIURL\fR to the cache and will thus not add the SHA256 to the formula for you\. It will also not check the GitHub API for GitHub projects (to fill out the description and homepage)\. +. +.TP +\fB\-\-HEAD\fR +HEAD +. +.TP +\fB\-\-set\-name\fR +Set the provided name of the package you are creating\. +. +.TP +\fB\-\-set\-version\fR +Set the provided version of the package you are creating\. +. +.TP +\fB\-\-tap\fR +Takes a tap [\fIuser\fR\fB/\fR\fIrepo\fR] as argument and generates the formula in the specified tap\. +. +.TP +\fB\-f\fR, \fB\-\-force\fR +Override warnings and enable potentially unsafe operations\. +. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. +. +.TP +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. . .TP \fBedit\fR @@ -795,123 +882,209 @@ Open all of Homebrew for editing\. Open \fIformula\fR in the editor\. . .TP -\fBextract\fR [\fB\-\-force\fR] \fIformula\fR \fItap\fR [\fB\-\-version=\fR\fIversion\fR] -Looks through repository history to find the \fIversion\fR of \fIformula\fR and creates a copy in \fItap\fR/Formula/\fIformula\fR@\fIversion\fR\.rb\. If the tap is not installed yet, attempts to install/clone the tap before continuing\. -. -.IP -If \fB\-\-force\fR is passed, the file at the destination will be overwritten if it already exists\. Otherwise, existing files will be preserved\. -. -.IP -If an argument is passed through \fB\-\-version\fR, \fIversion\fR of \fIformula\fR will be extracted and placed in the destination tap\. Otherwise, the most recent version that can be found will be used\. +\fB\-f\fR, \fB\-\-force\fR +Override warnings and enable potentially unsafe operations\. . .TP -\fBformula\fR \fIformula\fR +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. +. +.TP +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. +. +.P +\fBformula\fR \fIformula\fR: +. +.P Display the path where \fIformula\fR is located\. . .TP -\fBirb\fR [\fB\-\-examples\fR] [\fB\-\-pry\fR] +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. +. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. +. +.P +\fBirb\fR [\fIoptions\fR]: +. +.P Enter the interactive Homebrew Ruby shell\. . -.IP -If \fB\-\-examples\fR is passed, several examples will be shown\. If \fB\-\-pry\fR is passed or HOMEBREW_PRY is set, pry will be used instead of irb\. +.TP +\fB\-\-examples\fR +Show several examples\. . .TP -\fBlinkage\fR [\fB\-\-test\fR] [\fB\-\-reverse\fR] [\fIformulae\fR] -Checks the library links of installed formulae\. +\fB\-\-pry\fR +Pry will be used instead of irb if \fB\-\-pry\fR is passed or HOMEBREW_PRY is set\. . -.IP +.P +\fBlinkage\fR [\fIoptions\fR] \fIformula\fR: +. +.P +Checks the library links of an installed formula\. +. +.P Only works on installed formulae\. An error is raised if it is run on uninstalled formulae\. . -.IP -If \fB\-\-test\fR is passed, only display missing libraries and exit with a non\-zero exit code if any missing libraries were found\. -. -.IP -If \fB\-\-reverse\fR is passed, print the dylib followed by the binaries which link to it for each library the keg references\. -. -.IP -If \fIformulae\fR are given, check linkage for only the specified brews\. +.TP +\fB\-\-test\fR +Display only missing libraries and exit with a non\-zero exit code if any missing libraries were found\. . .TP -\fBman\fR [\fB\-\-fail\-if\-changed\fR] +\fB\-\-reverse\fR +Print the dylib followed by the binaries which link to it for each library the keg references\. +. +.TP +\fB\-\-cached\fR +Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous \fBbrew linkage\fR run\. +. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. +. +.TP +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. +. +.P +\fBman\fR [\fIoptions\fR]: +. +.P Generate Homebrew\'s manpages\. . -.IP -If \fB\-\-fail\-if\-changed\fR is passed, the command will return a failing status code if changes are detected in the manpage outputs\. This can be used for CI to be notified when the manpages are out of date\. Additionally, the date used in new manpages will match those in the existing manpages (to allow comparison without factoring in the date)\. +.TP +\fB\-\-fail\-if\-changed\fR +Return a failing status code if changes are detected in the manpage outputs\. This can be used for CI to be notified when the manpages are out of date\. Additionally, the date used in new manpages will match those in the existing manpages (to allow comparison without factoring in the date)\. +. +.TP +\fB\-\-link\fR +It is now done automatically by \fBbrew update\fR\. +. +.P +\fBmirror\fR [\fIformulae\fR]: +. +.P +Reuploads the stable URL for a formula to Bintray to use it as a mirror\. +. +.TP +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. +. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. . .TP \fBprof\fR [\fIruby options\fR] Run Homebrew with the Ruby profiler\. For example: + . -.TP -\fBpull\fR [\fB\-\-bottle\fR] [\fB\-\-bump\fR] [\fB\-\-clean\fR] [\fB\-\-ignore\-whitespace\fR] [\fB\-\-resolve\fR] [\fB\-\-branch\-okay\fR] [\fB\-\-no\-pbcopy\fR] [\fB\-\-no\-publish\fR] [\fB\-\-warn\-on\-publish\-failure\fR] [\fB\-\-bintray\-org=\fR\fIbintray\-org\fR] [\fB\-\-test\-bot\-user=\fR\fItest\-bot\-user\fR] \fIpatch\-source\fR [\fIpatch\-source\fR]: +.P +\fBbump\-formula\-pr\fR [\fIoptions\fR] \fIformula\fR: . -.IP +.P Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\. . -.IP +.P Each \fIpatch\-source\fR may be one of: . -.IP +.P ~ The ID number of a PR (pull request) in the homebrew/core GitHub repository . -.IP +.P ~ The URL of a PR on GitHub, using either the web page or API URL formats\. In this form, the PR may be on Homebrew/brew, Homebrew/homebrew\-core or any tap\. . -.IP +.P ~ The URL of a commit on GitHub . -.IP +.P ~ A "https://jenkins\.brew\.sh/job/\.\.\." string specifying a testing job ID . -.IP -If \fB\-\-bottle\fR is passed, handle bottles, pulling the bottle\-update commit and publishing files on Bintray\. -. -.IP -If \fB\-\-bump\fR is passed, for one\-formula PRs, automatically reword commit message to our preferred format\. -. -.IP -If \fB\-\-clean\fR is passed, do not rewrite or otherwise modify the commits found in the pulled PR\. -. -.IP -If \fB\-\-ignore\-whitespace\fR is passed, silently ignore whitespace discrepancies when applying diffs\. -. -.IP -If \fB\-\-resolve\fR is passed, when a patch fails to apply, leave in progress and allow user to resolve, instead of aborting\. -. -.IP -If \fB\-\-branch\-okay\fR is passed, do not warn if pulling to a branch besides master (useful for testing)\. -. -.IP -If \fB\-\-no\-pbcopy\fR is passed, do not copy anything to the system clipboard\. -. -.IP -If \fB\-\-no\-publish\fR is passed, do not publish bottles to Bintray\. -. -.IP -If \fB\-\-warn\-on\-publish\-failure\fR was passed, do not exit if there\'s a failure publishing bottles on Bintray\. -. -.IP -If \fB\-\-bintray\-org=\fR\fIbintray\-org\fR is passed, publish at the given Bintray organisation\. -. -.IP -If \fB\-\-test\-bot\-user=\fR\fItest\-bot\-user\fR is passed, pull the bottle block commit from the specified user on GitHub\. +.TP +\fB\-\-bottle\fR +Handle bottles, pulling the bottle\-update commit and publishing files on Bintray\. . .TP -\fBrelease\-notes\fR [\fB\-\-markdown\fR] [\fIprevious_tag\fR] [\fIend_ref\fR] +\fB\-\-bump\fR +For one\-formula PRs, automatically reword commit message to our preferred format\. +. +.TP +\fB\-\-clean\fR +Do not rewrite or otherwise modify the commits found in the pulled PR\. +. +.TP +\fB\-\-ignore\-whitespace\fR +Silently ignore whitespace discrepancies when applying diffs\. +. +.TP +\fB\-\-resolve\fR +When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting\. +. +.TP +\fB\-\-branch\-okay\fR +Do not warn if pulling to a branch besides master (useful for testing)\. +. +.TP +\fB\-\-no\-pbcopy\fR +Do not copy anything to the system clipboard\. +. +.TP +\fB\-\-no\-publish\fR +Do not publish bottles to Bintray\. +. +.TP +\fB\-\-warn\-on\-publish\-failure\fR +Do not exit if there\'s a failure publishing bottles on Bintray\. +. +.TP +\fB\-\-bintray\-org\fR +Publish at the given Bintray organisation\. +. +.TP +\fB\-\-test\-bot\-user\fR +Pull the bottle block commit from the specified user on GitHub\. +. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. +. +.TP +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. +. +.P +\fBrelease\-notes\fR [\fIprevious_tag\fR] [\fIend_ref\fR]: +. +.P Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. . -.IP -If \fB\-\-markdown\fR is passed, output as a Markdown list\. +.TP +\fB\-\-markdown\fR +Output as a Markdown list\. . .TP \fBruby\fR [\fIruby options\fR] Run a Ruby instance with Homebrew\'s libraries loaded\. For example: . -.TP -\fBtap\-new\fR \fIuser\fR\fB/\fR\fIrepo\fR +.P +\fBtap\-new\fR \fIuser\fR\fB/\fR\fIrepo\fR: +. +.P Generate the template files for a new tap\. . .TP +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. +. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. +. +.TP \fBtest\fR [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-debug\fR] [\fB\-\-keep\-tmp\fR] \fIformula\fR Most formulae provide a test method\. \fBbrew test\fR \fIformula\fR runs this test method\. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed formula\. . @@ -926,45 +1099,78 @@ If \fB\-\-keep\-tmp\fR is passed, the temporary files created for the test are n . .IP Example: \fBbrew install jruby && brew test jruby\fR + . -.TP -\fBtests\fR [\fB\-\-verbose\fR] [\fB\-\-coverage\fR] [\fB\-\-generic\fR] [\fB\-\-no\-compat\fR] [\fB\-\-only=\fR\fItest_script\fR[\fB:\fR\fIline_number\fR]] [\fB\-\-seed=\fR\fIseed\fR] [\fB\-\-online\fR] [\fB\-\-official\-cmd\-taps\fR] +.P +\fBtests\fR [\fIoptions\fR] \fIformula\fR: +. +.P Run Homebrew\'s unit and integration tests\. If provided, \fB\-\-only=\fR\fItest_script\fR runs only \fItest_script\fR_spec\.rb, and \fB\-\-seed\fR randomizes tests with the provided value instead of a random seed\. . -.IP -If \fB\-\-verbose\fR (or \fB\-v\fR) is passed, print the command that runs the tests\. -. -.IP -If \fB\-\-coverage\fR is passed, also generate code coverage reports\. -. -.IP -If \fB\-\-generic\fR is passed, only run OS\-agnostic tests\. -. -.IP -If \fB\-\-no\-compat\fR is passed, do not load the compatibility layer when running tests\. -. -.IP -If \fB\-\-online\fR is passed, include tests that use the GitHub API and tests that use any of the taps for official external commands\. +.TP +\fB\-\-coverage\fR +Generate code coverage reports\. . .TP -\fBupdate\-test\fR [\fB\-\-commit=\fR\fIcommit\fR] [\fB\-\-before=\fR\fIdate\fR] [\fB\-\-to\-tag\fR] [\fB\-\-keep\-tmp\fR] +\fB\-\-generic\fR +Run only OS\-agnostic tests\. +. +.TP +\fB\-\-no\-compat\fR +Do not load the compatibility layer when running tests\. +. +.TP +\fB\-\-online\fR +Include tests that use the GitHub API and tests that use any of the taps for official external commands\. +. +.TP +\fB\-\-only\fR +Run only \fItest_script\fR_spec\.rb +. +.TP +\fB\-\-seed\fR +Randomizes tests with the provided value instead of a random seed\. +. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. +. +.TP +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. +. +.P +\fBupdate\-test\fR [\fIoptions\fR]: +. +.P Runs a test of \fBbrew update\fR with a new repository clone\. . -.IP +.P If no arguments are passed, use \fBorigin/master\fR as the start commit\. . -.IP -If \fB\-\-commit=\fR\fIcommit\fR is passed, use \fIcommit\fR as the start commit\. +.TP +\fB\-\-to\-tag\fR +Set \fBHOMEBREW_UPDATE_TO_TAG\fR to test updating between tags\. . -.IP -If \fB\-\-before=\fR\fIdate\fR is passed, use the commit at \fIdate\fR as the start commit\. +.TP +\fB\-\-keep\-tmp\fR +Retain the temporary directory containing the new repository clone\. . -.IP -If \fB\-\-to\-tag\fR is passed, set \fBHOMEBREW_UPDATE_TO_TAG\fR to test updating between tags\. +.TP +\fB\-\-commit\fR +Use provided \fIcommit\fR as the start commit\. . -.IP -If \fB\-\-keep\-tmp\fR is passed, retain the temporary directory containing the new repository clone\. - +.TP +\fB\-\-before\fR +Use the commit at provided \fIdate\fR as the start commit\. +. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Make some output more verbose\. +. +.TP +\fB\-d\fR, \fB\-\-debug\fR +Display any debugging information\. . .SH "OFFICIAL EXTERNAL COMMANDS" . From e0e876cf37c11b9389d27dccf987178e809b2f4f Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Mon, 1 Oct 2018 10:54:49 +0530 Subject: [PATCH 09/18] man: Make command heading H3 --- Library/Homebrew/dev-cmd/audit.rb | 3 +- Library/Homebrew/dev-cmd/bottle.rb | 3 +- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 2 +- Library/Homebrew/dev-cmd/create.rb | 2 +- Library/Homebrew/dev-cmd/edit.rb | 4 +- Library/Homebrew/dev-cmd/formula.rb | 2 +- Library/Homebrew/dev-cmd/irb.rb | 2 +- Library/Homebrew/dev-cmd/linkage.rb | 2 +- Library/Homebrew/dev-cmd/man.rb | 2 +- Library/Homebrew/dev-cmd/mirror.rb | 2 +- Library/Homebrew/dev-cmd/prof.rb | 2 +- Library/Homebrew/dev-cmd/pull.rb | 2 +- Library/Homebrew/dev-cmd/release-notes.rb | 2 +- Library/Homebrew/dev-cmd/tap-new.rb | 2 +- Library/Homebrew/dev-cmd/test.rb | 2 +- Library/Homebrew/dev-cmd/tests.rb | 2 +- Library/Homebrew/dev-cmd/update-test.rb | 2 +- docs/Manpage.md | 38 ++++---- manpages/brew-cask.1 | 2 +- manpages/brew.1 | 98 ++++++--------------- 20 files changed, 62 insertions(+), 114 deletions(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index fbafa459e7..961bf6c228 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -55,11 +55,10 @@ module Homebrew def audit_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `audit` [] []: + ### audit [options] [formulae]: Check for Homebrew coding style violations. This should be run before submitting a new formula. - If no are provided, all of them are checked. EOS switch "--strict", diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index f4ae7546cd..68f1060a9a 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -72,11 +72,10 @@ module Homebrew def bottle_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `bottle` [] []: + ### bottle [options] [formulae]: Generate a bottle (binary package) from a formula installed with `--build-bottle`. - If the formula specifies a rebuild version, it will be incremented in the generated DSL. Passing `--keep-old` will attempt to keep it at its original value, while `--no-rebuild` will remove it. diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 89b616d037..283a792e81 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -50,7 +50,7 @@ module Homebrew def bump_formula_pr_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `bump-formula-pr` [] : + ### bump-formula-pr [options] [formula]: Creates a pull request to update the formula with a new URL or a new tag. diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index f5f174f12f..5ecda0543b 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -30,7 +30,7 @@ module Homebrew def create_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `create` []: + ### create URL [options]: Generate a formula for the downloadable file at and open it in the editor. Homebrew will attempt to automatically derive the formula name diff --git a/Library/Homebrew/dev-cmd/edit.rb b/Library/Homebrew/dev-cmd/edit.rb index 8c033cf107..84f81a2779 100644 --- a/Library/Homebrew/dev-cmd/edit.rb +++ b/Library/Homebrew/dev-cmd/edit.rb @@ -13,10 +13,10 @@ module Homebrew def edit_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - * `edit`: + ### edit: Open all of Homebrew for editing. - * `edit` : + ### edit [formula]: Open in the editor. EOS switch :force diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb index 904f8e2aa6..e10a664d66 100644 --- a/Library/Homebrew/dev-cmd/formula.rb +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -10,7 +10,7 @@ module Homebrew def formula_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `formula` : + ### formula [formula]: Display the path where is located. EOS diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index 486970c774..2f7cfe1294 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -25,7 +25,7 @@ module Homebrew def irb_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `irb` []: + ### irb [options]: Enter the interactive Homebrew Ruby shell. EOS diff --git a/Library/Homebrew/dev-cmd/linkage.rb b/Library/Homebrew/dev-cmd/linkage.rb index 2feb98f899..79c2f938b2 100644 --- a/Library/Homebrew/dev-cmd/linkage.rb +++ b/Library/Homebrew/dev-cmd/linkage.rb @@ -22,7 +22,7 @@ module Homebrew def linkage_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `linkage` [] : + ### linkage [options] [formula]: Checks the library links of an installed formula. diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 618c2b5487..541fbb544c 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -36,7 +36,7 @@ module Homebrew def man_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `man` []: + ### man [options]: Generate Homebrew's manpages. EOS diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index 139a63bb75..8c98952171 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -10,7 +10,7 @@ module Homebrew def mirror_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `mirror` []: + ### mirror [formulae]: Reuploads the stable URL for a formula to Bintray to use it as a mirror. EOS diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index c7121f6e85..e2242a961e 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -1,4 +1,4 @@ -#: * `prof` []: +#: ### prof [ruby options]: #: Run Homebrew with the Ruby profiler. #: For example: # brew prof readall diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index c83a8ccf4b..f0d3604da9 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -75,7 +75,7 @@ module Homebrew def pull_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `bump-formula-pr` [] : + ### pull [options] [formula]: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index 6eb8d19bec..8ef8022837 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -13,7 +13,7 @@ module Homebrew def release_notes_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `release-notes` [] []: + ### release-notes [previous_tag] [end_ref]: Output the merged pull requests on Homebrew/brew between two Git refs. If no is provided it defaults to the latest tag. diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index b2751bfa71..da5e34951e 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -18,7 +18,7 @@ module Homebrew def tap_new_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `tap-new` `/`: + ### tap-new [user]/[repo]: Generate the template files for a new tap. EOS diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index 1e74496dc5..e643dd1bf4 100644 --- a/Library/Homebrew/dev-cmd/test.rb +++ b/Library/Homebrew/dev-cmd/test.rb @@ -1,4 +1,4 @@ -#: * `test` [`--devel`|`--HEAD`] [`--debug`] [`--keep-tmp`] : +#: ### test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: #: Most formulae provide a test method. `brew test` runs this #: test method. There is no standard output or return code, but it should #: generally indicate to the user if something is wrong with the installed diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 5730c7cab7..c73336ef07 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -24,7 +24,7 @@ module Homebrew def tests_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `tests` [] : + ### tests [options] [formula]: Run Homebrew's unit and integration tests. If provided, `--only=` runs only _spec.rb, and `--seed` diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index 41668a4bf7..0ff78bcfd1 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -22,7 +22,7 @@ module Homebrew def update_test_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `update-test` []: + ### update-test [options]: Runs a test of `brew update` with a new repository clone. diff --git a/docs/Manpage.md b/docs/Manpage.md index 9f7f9b1730..ef168fcd48 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -663,11 +663,10 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note ## DEVELOPER COMMANDS -`audit` [`options`] [`formulae`]: +### audit [options] [formulae]: Check `formulae` for Homebrew coding style violations. This should be run before submitting a new formula. - If no `formulae` are provided, all of them are checked. * `--strict`: @@ -697,11 +696,10 @@ Make some output more verbose. * `-d`, `--debug`: Display any debugging information. -`bottle` [`options`] [`formulae`]: +### bottle [options] [formulae]: Generate a bottle (binary package) from a formula installed with `--build-bottle`. - If the formula specifies a rebuild version, it will be incremented in the generated DSL. Passing `--keep-old` will attempt to keep it at its original value, while `--no-rebuild` will remove it. @@ -731,7 +729,7 @@ Make some output more verbose. * `-d`, `--debug`: Display any debugging information. -`bump-formula-pr` [`options`] `formula`: +### bump-formula-pr [options] [formula]: Creates a pull request to update the formula with a new URL or a new tag. @@ -782,7 +780,7 @@ Make some output more verbose. * `-d`, `--debug`: Display any debugging information. -`create` `URL` [`options`]: +### create URL [options]: Generate a formula for the downloadable file at `URL` and open it in the editor. Homebrew will attempt to automatically derive the formula name @@ -813,10 +811,10 @@ Make some output more verbose. * `-d`, `--debug`: Display any debugging information. -* `edit`: +### edit: Open all of Homebrew for editing. -* `edit` `formula`: +### edit [formula]: Open `formula` in the editor. * `-f`, `--force`: @@ -826,7 +824,7 @@ Make some output more verbose. * `-d`, `--debug`: Display any debugging information. -`formula` `formula`: +### formula [formula]: Display the path where `formula` is located. @@ -835,7 +833,7 @@ Display any debugging information. * `-v`, `--verbose`: Make some output more verbose. -`irb` [`options`]: +### irb [options]: Enter the interactive Homebrew Ruby shell. @@ -844,7 +842,7 @@ Show several examples. * `--pry`: Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set. -`linkage` [`options`] `formula`: +### linkage [options] [formula]: Checks the library links of an installed formula. @@ -862,7 +860,7 @@ Make some output more verbose. * `-d`, `--debug`: Display any debugging information. -`man` [`options`]: +### man [options]: Generate Homebrew's manpages. @@ -871,7 +869,7 @@ Return a failing status code if changes are detected in the manpage outputs. Thi * `--link`: It is now done automatically by `brew update`. -`mirror` [`formulae`]: +### mirror [formulae]: Reuploads the stable URL for a formula to Bintray to use it as a mirror. @@ -880,11 +878,11 @@ Display any debugging information. * `-v`, `--verbose`: Make some output more verbose. - * `prof` [`ruby options`]: + ### prof [ruby options]: Run Homebrew with the Ruby profiler. For example: -`bump-formula-pr` [`options`] `formula`: +### pull [options] [formula]: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. @@ -929,7 +927,7 @@ Make some output more verbose. * `-d`, `--debug`: Display any debugging information. -`release-notes` [`previous_tag`] [`end_ref`]: +### release-notes [previous_tag] [end_ref]: Output the merged pull requests on Homebrew/brew between two Git refs. If no `previous_tag` is provided it defaults to the latest tag. @@ -942,7 +940,7 @@ Output as a Markdown list. Run a Ruby instance with Homebrew's libraries loaded. For example: -`tap-new` `user``/``repo`: +### tap-new [user]/[repo]: Generate the template files for a new tap. @@ -951,7 +949,7 @@ Display any debugging information. * `-v`, `--verbose`: Make some output more verbose. - * `test` [`--devel`|`--HEAD`] [`--debug`] [`--keep-tmp`] `formula`: + ### test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: Most formulae provide a test method. `brew test` `formula` runs this test method. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed @@ -968,7 +966,7 @@ Make some output more verbose. Example: `brew install jruby && brew test jruby` -`tests` [`options`] `formula`: +### tests [options] [formula]: Run Homebrew's unit and integration tests. If provided, `--only=``test_script` runs only `test_script`_spec.rb, and `--seed` @@ -991,7 +989,7 @@ Make some output more verbose. * `-d`, `--debug`: Display any debugging information. -`update-test` [`options`]: +### update-test [options]: Runs a test of `brew update` with a new repository clone. diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index 1043b68704..859ad7d1e4 100644 --- a/manpages/brew-cask.1 +++ b/manpages/brew-cask.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW\-CASK" "1" "September 2018" "Homebrew" "brew-cask" +.TH "BREW\-CASK" "1" "October 2018" "Homebrew" "brew-cask" . .SH "NAME" \fBbrew\-cask\fR \- a friendly binary installer for macOS diff --git a/manpages/brew.1 b/manpages/brew.1 index 0811cd9727..6b1427bc06 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "September 2018" "Homebrew" "brew" +.TH "BREW" "1" "October 2018" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for macOS @@ -620,13 +620,9 @@ If \fB\-\-merge\fR is specified then \fBgit merge\fR is used to include updates If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full update check even if unnecessary\. . .SH "DEVELOPER COMMANDS" -\fBaudit\fR [\fIoptions\fR] [\fIformulae\fR]: . -.P -Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\. -. -.P -If no \fIformulae\fR are provided, all of them are checked\. +.SS "audit [options] [formulae]:" +Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\. If no \fIformulae\fR are provided, all of them are checked\. . .TP \fB\-\-strict\fR @@ -680,14 +676,8 @@ Make some output more verbose\. \fB\-d\fR, \fB\-\-debug\fR Display any debugging information\. . -.P -\fBbottle\fR [\fIoptions\fR] [\fIformulae\fR]: -. -.P -Generate a bottle (binary package) from a formula installed with \fB\-\-build\-bottle\fR\. -. -.P -If the formula specifies a rebuild version, it will be incremented in the generated DSL\. Passing \fB\-\-keep\-old\fR will attempt to keep it at its original value, while \fB\-\-no\-rebuild\fR will remove it\. +.SS "bottle [options] [formulae]:" +Generate a bottle (binary package) from a formula installed with \fB\-\-build\-bottle\fR\. If the formula specifies a rebuild version, it will be incremented in the generated DSL\. Passing \fB\-\-keep\-old\fR will attempt to keep it at its original value, while \fB\-\-no\-rebuild\fR will remove it\. . .TP \fB\-\-skip\-relocation\fR @@ -737,10 +727,7 @@ Make some output more verbose\. \fB\-d\fR, \fB\-\-debug\fR Display any debugging information\. . -.P -\fBbump\-formula\-pr\fR [\fIoptions\fR] \fIformula\fR: -. -.P +.SS "bump\-formula\-pr [options] [formula]:" Creates a pull request to update the formula with a new URL or a new tag\. . .P @@ -823,10 +810,7 @@ Make some output more verbose\. \fB\-d\fR, \fB\-\-debug\fR Display any debugging information\. . -.P -\fBcreate\fR \fIURL\fR [\fIoptions\fR]: -. -.P +.SS "create URL [options]:" Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The \fBwget\fR formula serves as a simple example\. For the complete API have a look at \fIhttp://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\fR\. . .TP @@ -873,12 +857,10 @@ Make some output more verbose\. \fB\-d\fR, \fB\-\-debug\fR Display any debugging information\. . -.TP -\fBedit\fR +.SS "edit:" Open all of Homebrew for editing\. . -.TP -\fBedit\fR \fIformula\fR +.SS "edit [formula]:" Open \fIformula\fR in the editor\. . .TP @@ -893,10 +875,7 @@ Make some output more verbose\. \fB\-d\fR, \fB\-\-debug\fR Display any debugging information\. . -.P -\fBformula\fR \fIformula\fR: -. -.P +.SS "formula [formula]:" Display the path where \fIformula\fR is located\. . .TP @@ -907,10 +886,7 @@ Display any debugging information\. \fB\-v\fR, \fB\-\-verbose\fR Make some output more verbose\. . -.P -\fBirb\fR [\fIoptions\fR]: -. -.P +.SS "irb [options]:" Enter the interactive Homebrew Ruby shell\. . .TP @@ -921,10 +897,7 @@ Show several examples\. \fB\-\-pry\fR Pry will be used instead of irb if \fB\-\-pry\fR is passed or HOMEBREW_PRY is set\. . -.P -\fBlinkage\fR [\fIoptions\fR] \fIformula\fR: -. -.P +.SS "linkage [options] [formula]:" Checks the library links of an installed formula\. . .P @@ -950,10 +923,7 @@ Make some output more verbose\. \fB\-d\fR, \fB\-\-debug\fR Display any debugging information\. . -.P -\fBman\fR [\fIoptions\fR]: -. -.P +.SS "man [options]:" Generate Homebrew\'s manpages\. . .TP @@ -964,10 +934,7 @@ Return a failing status code if changes are detected in the manpage outputs\. Th \fB\-\-link\fR It is now done automatically by \fBbrew update\fR\. . -.P -\fBmirror\fR [\fIformulae\fR]: -. -.P +.SS "mirror [formulae]:" Reuploads the stable URL for a formula to Bintray to use it as a mirror\. . .TP @@ -978,15 +945,12 @@ Display any debugging information\. \fB\-v\fR, \fB\-\-verbose\fR Make some output more verbose\. . -.TP -\fBprof\fR [\fIruby options\fR] +.SS "prof [ruby options]:" +. +.IP Run Homebrew with the Ruby profiler\. For example: - . -.P -\fBbump\-formula\-pr\fR [\fIoptions\fR] \fIformula\fR: -. -.P +.SS "pull [options] [formula]:" Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\. . .P @@ -1056,10 +1020,7 @@ Make some output more verbose\. \fB\-d\fR, \fB\-\-debug\fR Display any debugging information\. . -.P -\fBrelease\-notes\fR [\fIprevious_tag\fR] [\fIend_ref\fR]: -. -.P +.SS "release\-notes [previous_tag] [end_ref]:" Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. . .TP @@ -1070,10 +1031,7 @@ Output as a Markdown list\. \fBruby\fR [\fIruby options\fR] Run a Ruby instance with Homebrew\'s libraries loaded\. For example: . -.P -\fBtap\-new\fR \fIuser\fR\fB/\fR\fIrepo\fR: -. -.P +.SS "tap\-new [user]/[repo]:" Generate the template files for a new tap\. . .TP @@ -1084,8 +1042,9 @@ Display any debugging information\. \fB\-v\fR, \fB\-\-verbose\fR Make some output more verbose\. . -.TP -\fBtest\fR [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-debug\fR] [\fB\-\-keep\-tmp\fR] \fIformula\fR +.SS "test [\-\-devel|\-\-HEAD] [\-\-debug] [\-\-keep\-tmp] [formula]:" +. +.IP Most formulae provide a test method\. \fBbrew test\fR \fIformula\fR runs this test method\. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed formula\. . .IP @@ -1099,12 +1058,8 @@ If \fB\-\-keep\-tmp\fR is passed, the temporary files created for the test are n . .IP Example: \fBbrew install jruby && brew test jruby\fR - . -.P -\fBtests\fR [\fIoptions\fR] \fIformula\fR: -. -.P +.SS "tests [options] [formula]:" Run Homebrew\'s unit and integration tests\. If provided, \fB\-\-only=\fR\fItest_script\fR runs only \fItest_script\fR_spec\.rb, and \fB\-\-seed\fR randomizes tests with the provided value instead of a random seed\. . .TP @@ -1139,10 +1094,7 @@ Make some output more verbose\. \fB\-d\fR, \fB\-\-debug\fR Display any debugging information\. . -.P -\fBupdate\-test\fR [\fIoptions\fR]: -. -.P +.SS "update\-test [options]:" Runs a test of \fBbrew update\fR with a new repository clone\. . .P From 446b1cb9e3c5d93c731cfc16013f1aa8cc24451a Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Tue, 2 Oct 2018 14:44:38 +0530 Subject: [PATCH 10/18] man: Seperate global options into a section --- Library/Homebrew/cli_parser.rb | 29 ++-- Library/Homebrew/dev-cmd/audit.rb | 2 +- Library/Homebrew/dev-cmd/bottle.rb | 2 +- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 2 +- Library/Homebrew/dev-cmd/create.rb | 2 +- Library/Homebrew/dev-cmd/edit.rb | 8 +- Library/Homebrew/dev-cmd/formula.rb | 2 +- Library/Homebrew/dev-cmd/irb.rb | 2 +- Library/Homebrew/dev-cmd/linkage.rb | 2 +- Library/Homebrew/dev-cmd/man.rb | 27 +++- Library/Homebrew/dev-cmd/mirror.rb | 4 +- Library/Homebrew/dev-cmd/prof.rb | 2 +- Library/Homebrew/dev-cmd/pull.rb | 2 +- Library/Homebrew/dev-cmd/release-notes.rb | 2 +- Library/Homebrew/dev-cmd/tap-new.rb | 2 +- Library/Homebrew/dev-cmd/test.rb | 2 +- Library/Homebrew/dev-cmd/tests.rb | 2 +- Library/Homebrew/dev-cmd/update-test.rb | 6 +- Library/Homebrew/manpages/brew.1.md.erb | 4 + docs/Manpage.md | 143 ++++++----------- manpages/brew.1 | 162 ++++---------------- 21 files changed, 149 insertions(+), 260 deletions(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index 511472ea76..8ef63c7232 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -11,6 +11,15 @@ module Homebrew new(&block).parse(args) end + def self.global_options + { + quiet: [["-q", "--quiet"], :quiet, "Suppress any warnings."], + verbose: [["-v", "--verbose"], :verbose, "Make some output more verbose."], + debug: [["-d", "--debug"], :debug, "Display any debugging information."], + force: [["-f", "--force"], :force, "Override warnings and enable potentially unsafe operations."], + } + end + def initialize(&block) @parser = OptionParser.new Homebrew.args = OpenStruct.new @@ -34,10 +43,6 @@ module Homebrew end end - def wrap_option_desc(desc) - Formatter.wrap(desc, @desc_line_length).split("\n") - end - def switch(*names, description: nil, env: nil, required_for: nil, depends_on: nil) global_switch = names.first.is_a?(Symbol) names, env, description = common_switch(*names) if global_switch @@ -119,6 +124,10 @@ module Homebrew @parser end + def global_option?(name) + Homebrew::CLI::Parser.global_options.has_key?(name.to_sym) + end + private def enable_switch(*names) @@ -129,19 +138,17 @@ module Homebrew # These are common/global switches accessible throughout Homebrew def common_switch(name) - case name - when :quiet then [["-q", "--quiet"], :quiet, "Suppress any warnings."] - when :verbose then [["-v", "--verbose"], :verbose, "Make some output more verbose."] - when :debug then [["-d", "--debug"], :debug, "Display any debugging information."] - when :force then [["-f", "--force"], :force, "Override warnings and enable potentially unsafe operations."] - else name - end + Homebrew::CLI::Parser.global_options.fetch(name, name) end def option_passed?(name) Homebrew.args.respond_to?(name) || Homebrew.args.respond_to?("#{name}?") end + def wrap_option_desc(desc) + Formatter.wrap(desc, @desc_line_length).split("\n") + end + def set_constraints(name, depends_on:, required_for:) secondary = option_to_name(name) unless required_for.nil? diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 961bf6c228..461c770d4a 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -55,7 +55,7 @@ module Homebrew def audit_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### audit [options] [formulae]: + `audit` [`options`] []: Check for Homebrew coding style violations. This should be run before submitting a new formula. diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 68f1060a9a..908d71f1f9 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -72,7 +72,7 @@ module Homebrew def bottle_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### bottle [options] [formulae]: + `bottle` [] []: Generate a bottle (binary package) from a formula installed with `--build-bottle`. diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 283a792e81..89b616d037 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -50,7 +50,7 @@ module Homebrew def bump_formula_pr_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### bump-formula-pr [options] [formula]: + `bump-formula-pr` [] : Creates a pull request to update the formula with a new URL or a new tag. diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 5ecda0543b..f5f174f12f 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -30,7 +30,7 @@ module Homebrew def create_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### create URL [options]: + `create` []: Generate a formula for the downloadable file at and open it in the editor. Homebrew will attempt to automatically derive the formula name diff --git a/Library/Homebrew/dev-cmd/edit.rb b/Library/Homebrew/dev-cmd/edit.rb index 84f81a2779..42d7ecf941 100644 --- a/Library/Homebrew/dev-cmd/edit.rb +++ b/Library/Homebrew/dev-cmd/edit.rb @@ -13,11 +13,9 @@ module Homebrew def edit_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### edit: - Open all of Homebrew for editing. - - ### edit [formula]: - Open in the editor. + `edit` : + Open in the editor. Open all of Homebrew for editing if + no is provided. EOS switch :force switch :verbose diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb index e10a664d66..904f8e2aa6 100644 --- a/Library/Homebrew/dev-cmd/formula.rb +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -10,7 +10,7 @@ module Homebrew def formula_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### formula [formula]: + `formula` : Display the path where is located. EOS diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index 2f7cfe1294..486970c774 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -25,7 +25,7 @@ module Homebrew def irb_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### irb [options]: + `irb` []: Enter the interactive Homebrew Ruby shell. EOS diff --git a/Library/Homebrew/dev-cmd/linkage.rb b/Library/Homebrew/dev-cmd/linkage.rb index 79c2f938b2..2feb98f899 100644 --- a/Library/Homebrew/dev-cmd/linkage.rb +++ b/Library/Homebrew/dev-cmd/linkage.rb @@ -22,7 +22,7 @@ module Homebrew def linkage_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### linkage [options] [formula]: + `linkage` [] : Checks the library links of an installed formula. diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 541fbb544c..7e6929d924 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -36,7 +36,7 @@ module Homebrew def man_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### man [options]: + `man` []: Generate Homebrew's manpages. EOS @@ -93,6 +93,7 @@ module Homebrew variables[:commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}") variables[:developer_commands] = generate_cmd_manpages("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") + variables[:global_options] = global_options_manpage_lines readme = HOMEBREW_REPOSITORY/"README.md" variables[:lead_maintainer] = readme.read[/(Homebrew's lead maintainer .*\.)/, 1] @@ -180,7 +181,7 @@ module Homebrew cmd_paths.each do |cmd_path| begin cmd_parser = Homebrew.send(cmd_arg_parser(cmd_path)) - man_page_lines << generate_cmd_manpage_lines(cmd_parser).join + man_page_lines << cmd_manpage_lines(cmd_parser).join rescue NoMethodError man_page_lines << path_glob_commands(cmd_path.to_s)[0] end @@ -192,9 +193,19 @@ module Homebrew "#{cmd_path.basename.to_s.gsub('.rb', '').gsub('-', '_')}_args".to_sym end - def generate_cmd_manpage_lines(cmd_parser) - lines = [cmd_parser.usage_banner_text] + def cmd_manpage_lines(cmd_parser) + lines = ["#{format_usage_banner(cmd_parser.usage_banner_text)}"] lines += cmd_parser.processed_options.map do |short, long, _, desc| + next if !long.nil? && cmd_parser.global_option?(cmd_parser.option_to_name(long)) + generate_option_doc(short, long, desc) + end + lines + end + + def global_options_manpage_lines + lines = ["These options are applicable across all sub-commands.\n"] + lines += Homebrew::CLI::Parser.global_options.values.map do |names, _, desc| + short, long = names generate_option_doc(short, long, desc) end lines @@ -211,4 +222,12 @@ module Homebrew def format_long_opt(opt) "`#{opt}`" end + + def format_usage_banner(usage_banner) + synopsis, *remaining_lines = usage_banner.split('\n') + synopsis = synopsis.sub(/^/, "###") + .gsub(/`/, "") + .gsub(/<(.*?)>/, "\\1") + [synopsis, *remaining_lines].join("\n") + end end diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index 8c98952171..95144f93eb 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -10,9 +10,9 @@ module Homebrew def mirror_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### mirror [formulae]: + `mirror` : - Reuploads the stable URL for a formula to Bintray to use it as a mirror. + Reuploads the stable URL for a formula to Bintray to use it as a mirror. EOS switch :debug switch :verbose diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index e2242a961e..0a7409ec53 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -1,4 +1,4 @@ -#: ### prof [ruby options]: +#: * `prof` [ruby options]: #: Run Homebrew with the Ruby profiler. #: For example: # brew prof readall diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index f0d3604da9..fda4aed9fc 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -75,7 +75,7 @@ module Homebrew def pull_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### pull [options] [formula]: + pull [options] [formula]: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index 8ef8022837..6eb8d19bec 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -13,7 +13,7 @@ module Homebrew def release_notes_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### release-notes [previous_tag] [end_ref]: + `release-notes` [] []: Output the merged pull requests on Homebrew/brew between two Git refs. If no is provided it defaults to the latest tag. diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index da5e34951e..a658aa0f73 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -18,7 +18,7 @@ module Homebrew def tap_new_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### tap-new [user]/[repo]: + `tap-new` /: Generate the template files for a new tap. EOS diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index e643dd1bf4..849c004205 100644 --- a/Library/Homebrew/dev-cmd/test.rb +++ b/Library/Homebrew/dev-cmd/test.rb @@ -1,4 +1,4 @@ -#: ### test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: +#: * test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: #: Most formulae provide a test method. `brew test` runs this #: test method. There is no standard output or return code, but it should #: generally indicate to the user if something is wrong with the installed diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index c73336ef07..5730c7cab7 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -24,7 +24,7 @@ module Homebrew def tests_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### tests [options] [formula]: + `tests` [] : Run Homebrew's unit and integration tests. If provided, `--only=` runs only _spec.rb, and `--seed` diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index 0ff78bcfd1..6f3ca832bf 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -22,11 +22,11 @@ module Homebrew def update_test_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - ### update-test [options]: + `update-test` [options]: - Runs a test of `brew update` with a new repository clone. + Runs a test of `brew update` with a new repository clone. - If no arguments are passed, use `origin/master` as the start commit. + If no arguments are passed, use `origin/master` as the start commit. EOS switch "--to-tag", description: "Set `HOMEBREW_UPDATE_TO_TAG` to test updating between tags." diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 04804651e8..75bcf3416c 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -54,6 +54,10 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note <%= developer_commands.join("\n") %> +## GLOBAL OPTIONS + +<%= global_options.join("\n") %> + ## OFFICIAL EXTERNAL COMMANDS <%= homebrew_bundle.join("\n ").strip %> diff --git a/docs/Manpage.md b/docs/Manpage.md index ef168fcd48..dac186a7d0 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -663,11 +663,11 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note ## DEVELOPER COMMANDS -### audit [options] [formulae]: +###audit [options] [formulae]: -Check `formulae` for Homebrew coding style violations. This should be +Check formulae for Homebrew coding style violations. This should be run before submitting a new formula. -If no `formulae` are provided, all of them are checked. +If no formulae are provided, all of them are checked. * `--strict`: Run additional style checks, including Rubocop style checks. @@ -691,18 +691,14 @@ Passing `--except`=`method` will run only the methods named audit_`method`, `met Passing `--only-cops`=`cops` will check for violations of only the listed RuboCop cops. `cops` should be a comma-separated list of cop names. * `--except-cops`: Passing `--except-cops`=`cops` will skip checking the listed RuboCop cops violations. `cops` should be a comma-separated list of cop names. -* `-v`, `--verbose`: -Make some output more verbose. -* `-d`, `--debug`: -Display any debugging information. -### bottle [options] [formulae]: +###bottle [options] [formulae]: Generate a bottle (binary package) from a formula installed with -`--build-bottle`. +--build-bottle. If the formula specifies a rebuild version, it will be incremented in the -generated DSL. Passing `--keep-old` will attempt to keep it at its -original value, while `--no-rebuild` will remove it. +generated DSL. Passing --keep-old will attempt to keep it at its +original value, while --no-rebuild will remove it. * `--skip-relocation`: Do not check if the bottle can be marked as relocatable. @@ -724,20 +720,16 @@ When passed with `--write`, a new commit will not generated while writing change Write bottle information to a JSON file, which can be used as the argument for `--merge`. * `--root-url`: Use the specified `URL` as the root of the bottle's URL instead of Homebrew's default. -* `-v`, `--verbose`: -Make some output more verbose. -* `-d`, `--debug`: -Display any debugging information. -### bump-formula-pr [options] [formula]: +###bump-formula-pr [options] formula: Creates a pull request to update the formula with a new URL or a new tag. -If a `URL` is specified, the `sha-256` checksum of the new download must -also be specified. A best effort to determine the `sha-256` and `formula` +If a URL is specified, the sha-256 checksum of the new download must +also be specified. A best effort to determine the sha-256 and formula name will be made if either or both values are not supplied by the user. -If a `tag` is specified, the git commit `revision` corresponding to that +If a tag is specified, the git commit revision corresponding to that tag must also be specified. Note that this command cannot be used to transition a formula from a @@ -771,22 +763,14 @@ Use the provided `URL` as a mirror URL. Use the provided `version` to override the value parsed from the URL or tag. Note that `--version=0` can be used to delete an existing `version` override from a formula if it has become redundant. * `--message`: Append provided `message` to the default PR message. -* `-q`, `--quiet`: -Suppress any warnings. -* `-f`, `--force`: -Override warnings and enable potentially unsafe operations. -* `-v`, `--verbose`: -Make some output more verbose. -* `-d`, `--debug`: -Display any debugging information. -### create URL [options]: +###create URL [options]: -Generate a formula for the downloadable file at `URL` and open it in the editor. +Generate a formula for the downloadable file at URL and open it in the editor. Homebrew will attempt to automatically derive the formula name -and version, but if it fails, you'll have to make your own template. The `wget` +and version, but if it fails, you'll have to make your own template. The wget formula serves as a simple example. For the complete API have a look at -. +http://www.rubydoc.info/github/Homebrew/brew/master/Formula. * `--autotools`: Create a basic template for an Autotools-style build. @@ -804,36 +788,18 @@ Set the provided name of the package you are creating. Set the provided version of the package you are creating. * `--tap`: Takes a tap [`user``/``repo`] as argument and generates the formula in the specified tap. -* `-f`, `--force`: -Override warnings and enable potentially unsafe operations. -* `-v`, `--verbose`: -Make some output more verbose. -* `-d`, `--debug`: -Display any debugging information. -### edit: - Open all of Homebrew for editing. +###edit formula: + Open formula in the editor. Open all of Homebrew for editing if + no formula is provided. -### edit [formula]: - Open `formula` in the editor. -* `-f`, `--force`: -Override warnings and enable potentially unsafe operations. -* `-v`, `--verbose`: -Make some output more verbose. -* `-d`, `--debug`: -Display any debugging information. +###formula formula: -### formula [formula]: +Display the path where formula is located. -Display the path where `formula` is located. -* `-d`, `--debug`: -Display any debugging information. -* `-v`, `--verbose`: -Make some output more verbose. - -### irb [options]: +###irb [options]: Enter the interactive Homebrew Ruby shell. @@ -842,7 +808,7 @@ Show several examples. * `--pry`: Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set. -### linkage [options] [formula]: +###linkage [options] formula: Checks the library links of an installed formula. @@ -855,12 +821,8 @@ Display only missing libraries and exit with a non-zero exit code if any missing Print the dylib followed by the binaries which link to it for each library the keg references. * `--cached`: Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous `brew linkage` run. -* `-v`, `--verbose`: -Make some output more verbose. -* `-d`, `--debug`: -Display any debugging information. -### man [options]: +###man [options]: Generate Homebrew's manpages. @@ -869,25 +831,21 @@ Return a failing status code if changes are detected in the manpage outputs. Thi * `--link`: It is now done automatically by `brew update`. -### mirror [formulae]: +###mirror formulae: - Reuploads the stable URL for a formula to Bintray to use it as a mirror. +Reuploads the stable URL for a formula to Bintray to use it as a mirror. -* `-d`, `--debug`: -Display any debugging information. -* `-v`, `--verbose`: -Make some output more verbose. - ### prof [ruby options]: + * `prof` [ruby options]: Run Homebrew with the Ruby profiler. For example: -### pull [options] [formula]: +###pull [options] [formula]: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. -Each `patch-source` may be one of: +Each patch-source may be one of: ~ The ID number of a PR (pull request) in the homebrew/core GitHub repository @@ -922,16 +880,12 @@ Do not exit if there's a failure publishing bottles on Bintray. Publish at the given Bintray organisation. * `--test-bot-user`: Pull the bottle block commit from the specified user on GitHub. -* `-v`, `--verbose`: -Make some output more verbose. -* `-d`, `--debug`: -Display any debugging information. -### release-notes [previous_tag] [end_ref]: +###release-notes [previous_tag] [end_ref]: Output the merged pull requests on Homebrew/brew between two Git refs. -If no `previous_tag` is provided it defaults to the latest tag. -If no `end_ref` is provided it defaults to `origin/master`. +If no previous_tag is provided it defaults to the latest tag. +If no end_ref is provided it defaults to origin/master. * `--markdown`: Output as a Markdown list. @@ -940,16 +894,12 @@ Output as a Markdown list. Run a Ruby instance with Homebrew's libraries loaded. For example: -### tap-new [user]/[repo]: +###tap-new user/repo: Generate the template files for a new tap. -* `-d`, `--debug`: -Display any debugging information. -* `-v`, `--verbose`: -Make some output more verbose. - ### test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: + * test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: Most formulae provide a test method. `brew test` `formula` runs this test method. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed @@ -966,10 +916,10 @@ Make some output more verbose. Example: `brew install jruby && brew test jruby` -### tests [options] [formula]: +###tests [options] formula: Run Homebrew's unit and integration tests. If provided, -`--only=``test_script` runs only `test_script`_spec.rb, and `--seed` +--only=test_script runs only test_script_spec.rb, and --seed randomizes tests with the provided value instead of a random seed. * `--coverage`: @@ -984,16 +934,12 @@ Include tests that use the GitHub API and tests that use any of the taps for off Run only `test_script`_spec.rb * `--seed`: Randomizes tests with the provided value instead of a random seed. -* `-v`, `--verbose`: -Make some output more verbose. -* `-d`, `--debug`: -Display any debugging information. -### update-test [options]: +###update-test [options]: - Runs a test of `brew update` with a new repository clone. +Runs a test of brew update with a new repository clone. - If no arguments are passed, use `origin/master` as the start commit. +If no arguments are passed, use origin/master as the start commit. * `--to-tag`: Set `HOMEBREW_UPDATE_TO_TAG` to test updating between tags. @@ -1003,11 +949,23 @@ Retain the temporary directory containing the new repository clone. Use provided `commit` as the start commit. * `--before`: Use the commit at provided `date` as the start commit. + +## GLOBAL OPTIONS + +These options are applicable across all sub-commands. + +* `-q`, `--quiet`: +Suppress any warnings. + * `-v`, `--verbose`: Make some output more verbose. + * `-d`, `--debug`: Display any debugging information. +* `-f`, `--force`: +Override warnings and enable potentially unsafe operations. + ## OFFICIAL EXTERNAL COMMANDS * `bundle` `command`: @@ -1409,6 +1367,7 @@ See our issues on GitHub: [ESSENTIAL COMMANDS]: #ESSENTIAL-COMMANDS "ESSENTIAL COMMANDS" [COMMANDS]: #COMMANDS "COMMANDS" [DEVELOPER COMMANDS]: #DEVELOPER-COMMANDS "DEVELOPER COMMANDS" +[GLOBAL OPTIONS]: #GLOBAL-OPTIONS "GLOBAL OPTIONS" [OFFICIAL EXTERNAL COMMANDS]: #OFFICIAL-EXTERNAL-COMMANDS "OFFICIAL EXTERNAL COMMANDS" [CUSTOM EXTERNAL COMMANDS]: #CUSTOM-EXTERNAL-COMMANDS "CUSTOM EXTERNAL COMMANDS" [SPECIFYING FORMULAE]: #SPECIFYING-FORMULAE "SPECIFYING FORMULAE" diff --git a/manpages/brew.1 b/manpages/brew.1 index 6b1427bc06..708d4ef152 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -622,7 +622,7 @@ If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full upd .SH "DEVELOPER COMMANDS" . .SS "audit [options] [formulae]:" -Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\. If no \fIformulae\fR are provided, all of them are checked\. +Check formulae for Homebrew coding style violations\. This should be run before submitting a new formula\. If no formulae are provided, all of them are checked\. . .TP \fB\-\-strict\fR @@ -668,16 +668,8 @@ Passing \fB\-\-only\-cops\fR=\fIcops\fR will check for violations of only the li \fB\-\-except\-cops\fR Passing \fB\-\-except\-cops\fR=\fIcops\fR will skip checking the listed RuboCop cops violations\. \fBcops\fR should be a comma\-separated list of cop names\. . -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Make some output more verbose\. -. -.TP -\fB\-d\fR, \fB\-\-debug\fR -Display any debugging information\. -. .SS "bottle [options] [formulae]:" -Generate a bottle (binary package) from a formula installed with \fB\-\-build\-bottle\fR\. If the formula specifies a rebuild version, it will be incremented in the generated DSL\. Passing \fB\-\-keep\-old\fR will attempt to keep it at its original value, while \fB\-\-no\-rebuild\fR will remove it\. +Generate a bottle (binary package) from a formula installed with \-\-build\-bottle\. If the formula specifies a rebuild version, it will be incremented in the generated DSL\. Passing \-\-keep\-old will attempt to keep it at its original value, while \-\-no\-rebuild will remove it\. . .TP \fB\-\-skip\-relocation\fR @@ -719,22 +711,14 @@ Write bottle information to a JSON file, which can be used as the argument for \ \fB\-\-root\-url\fR Use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew\'s default\. . -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Make some output more verbose\. -. -.TP -\fB\-d\fR, \fB\-\-debug\fR -Display any debugging information\. -. -.SS "bump\-formula\-pr [options] [formula]:" +.SS "bump\-formula\-pr [options] formula:" Creates a pull request to update the formula with a new URL or a new tag\. . .P -If a \fIURL\fR is specified, the \fIsha\-256\fR checksum of the new download must also be specified\. A best effort to determine the \fIsha\-256\fR and \fIformula\fR name will be made if either or both values are not supplied by the user\. +If a URL is specified, the sha\-256 checksum of the new download must also be specified\. A best effort to determine the sha\-256 and formula name will be made if either or both values are not supplied by the user\. . .P -If a \fItag\fR is specified, the git commit \fIrevision\fR corresponding to that tag must also be specified\. +If a tag is specified, the git commit revision corresponding to that tag must also be specified\. . .P Note that this command cannot be used to transition a formula from a URL\-and\-sha256 style specification into a tag\-and\-revision style specification, nor vice versa\. It must use whichever style specification the preexisting formula already uses\. @@ -794,24 +778,8 @@ Use the provided \fIversion\fR to override the value parsed from the URL or tag\ \fB\-\-message\fR Append provided \fImessage\fR to the default PR message\. . -.TP -\fB\-q\fR, \fB\-\-quiet\fR -Suppress any warnings\. -. -.TP -\fB\-f\fR, \fB\-\-force\fR -Override warnings and enable potentially unsafe operations\. -. -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Make some output more verbose\. -. -.TP -\fB\-d\fR, \fB\-\-debug\fR -Display any debugging information\. -. .SS "create URL [options]:" -Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The \fBwget\fR formula serves as a simple example\. For the complete API have a look at \fIhttp://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\fR\. +Generate a formula for the downloadable file at URL and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The wget formula serves as a simple example\. For the complete API have a look at http://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\. . .TP \fB\-\-autotools\fR @@ -845,46 +813,11 @@ Set the provided version of the package you are creating\. \fB\-\-tap\fR Takes a tap [\fIuser\fR\fB/\fR\fIrepo\fR] as argument and generates the formula in the specified tap\. . -.TP -\fB\-f\fR, \fB\-\-force\fR -Override warnings and enable potentially unsafe operations\. +.SS "edit formula:" +Open formula in the editor\. Open all of Homebrew for editing if no formula is provided\. . -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Make some output more verbose\. -. -.TP -\fB\-d\fR, \fB\-\-debug\fR -Display any debugging information\. -. -.SS "edit:" -Open all of Homebrew for editing\. -. -.SS "edit [formula]:" -Open \fIformula\fR in the editor\. -. -.TP -\fB\-f\fR, \fB\-\-force\fR -Override warnings and enable potentially unsafe operations\. -. -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Make some output more verbose\. -. -.TP -\fB\-d\fR, \fB\-\-debug\fR -Display any debugging information\. -. -.SS "formula [formula]:" -Display the path where \fIformula\fR is located\. -. -.TP -\fB\-d\fR, \fB\-\-debug\fR -Display any debugging information\. -. -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Make some output more verbose\. +.SS "formula formula:" +Display the path where formula is located\. . .SS "irb [options]:" Enter the interactive Homebrew Ruby shell\. @@ -897,7 +830,7 @@ Show several examples\. \fB\-\-pry\fR Pry will be used instead of irb if \fB\-\-pry\fR is passed or HOMEBREW_PRY is set\. . -.SS "linkage [options] [formula]:" +.SS "linkage [options] formula:" Checks the library links of an installed formula\. . .P @@ -915,14 +848,6 @@ Print the dylib followed by the binaries which link to it for each library the k \fB\-\-cached\fR Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous \fBbrew linkage\fR run\. . -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Make some output more verbose\. -. -.TP -\fB\-d\fR, \fB\-\-debug\fR -Display any debugging information\. -. .SS "man [options]:" Generate Homebrew\'s manpages\. . @@ -934,27 +859,18 @@ Return a failing status code if changes are detected in the manpage outputs\. Th \fB\-\-link\fR It is now done automatically by \fBbrew update\fR\. . -.SS "mirror [formulae]:" +.SS "mirror formulae:" Reuploads the stable URL for a formula to Bintray to use it as a mirror\. . .TP -\fB\-d\fR, \fB\-\-debug\fR -Display any debugging information\. -. -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Make some output more verbose\. -. -.SS "prof [ruby options]:" -. -.IP +\fBprof\fR [ruby options] Run Homebrew with the Ruby profiler\. For example: . .SS "pull [options] [formula]:" Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\. . .P -Each \fIpatch\-source\fR may be one of: +Each patch\-source may be one of: . .P ~ The ID number of a PR (pull request) in the homebrew/core GitHub repository @@ -1012,16 +928,8 @@ Publish at the given Bintray organisation\. \fB\-\-test\-bot\-user\fR Pull the bottle block commit from the specified user on GitHub\. . -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Make some output more verbose\. -. -.TP -\fB\-d\fR, \fB\-\-debug\fR -Display any debugging information\. -. .SS "release\-notes [previous_tag] [end_ref]:" -Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. +Output the merged pull requests on Homebrew/brew between two Git refs\. If no previous_tag is provided it defaults to the latest tag\. If no end_ref is provided it defaults to origin/master\. . .TP \fB\-\-markdown\fR @@ -1031,20 +939,11 @@ Output as a Markdown list\. \fBruby\fR [\fIruby options\fR] Run a Ruby instance with Homebrew\'s libraries loaded\. For example: . -.SS "tap\-new [user]/[repo]:" +.SS "tap\-new user/repo:" Generate the template files for a new tap\. . .TP -\fB\-d\fR, \fB\-\-debug\fR -Display any debugging information\. -. -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Make some output more verbose\. -. -.SS "test [\-\-devel|\-\-HEAD] [\-\-debug] [\-\-keep\-tmp] [formula]:" -. -.IP +test [\-\-devel|\-\-HEAD] [\-\-debug] [\-\-keep\-tmp] [formula] Most formulae provide a test method\. \fBbrew test\fR \fIformula\fR runs this test method\. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed formula\. . .IP @@ -1059,8 +958,8 @@ If \fB\-\-keep\-tmp\fR is passed, the temporary files created for the test are n .IP Example: \fBbrew install jruby && brew test jruby\fR . -.SS "tests [options] [formula]:" -Run Homebrew\'s unit and integration tests\. If provided, \fB\-\-only=\fR\fItest_script\fR runs only \fItest_script\fR_spec\.rb, and \fB\-\-seed\fR randomizes tests with the provided value instead of a random seed\. +.SS "tests [options] formula:" +Run Homebrew\'s unit and integration tests\. If provided, \-\-only=test_script runs only test_script_spec\.rb, and \-\-seed randomizes tests with the provided value instead of a random seed\. . .TP \fB\-\-coverage\fR @@ -1086,19 +985,11 @@ Run only \fItest_script\fR_spec\.rb \fB\-\-seed\fR Randomizes tests with the provided value instead of a random seed\. . -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Make some output more verbose\. -. -.TP -\fB\-d\fR, \fB\-\-debug\fR -Display any debugging information\. -. .SS "update\-test [options]:" -Runs a test of \fBbrew update\fR with a new repository clone\. +Runs a test of brew update with a new repository clone\. . .P -If no arguments are passed, use \fBorigin/master\fR as the start commit\. +If no arguments are passed, use origin/master as the start commit\. . .TP \fB\-\-to\-tag\fR @@ -1116,6 +1007,13 @@ Use provided \fIcommit\fR as the start commit\. \fB\-\-before\fR Use the commit at provided \fIdate\fR as the start commit\. . +.SH "GLOBAL OPTIONS" +These options are applicable across all sub\-commands\. +. +.TP +\fB\-q\fR, \fB\-\-quiet\fR +Suppress any warnings\. +. .TP \fB\-v\fR, \fB\-\-verbose\fR Make some output more verbose\. @@ -1124,6 +1022,10 @@ Make some output more verbose\. \fB\-d\fR, \fB\-\-debug\fR Display any debugging information\. . +.TP +\fB\-f\fR, \fB\-\-force\fR +Override warnings and enable potentially unsafe operations\. +. .SH "OFFICIAL EXTERNAL COMMANDS" . .TP From 3c74683d88f128086a4cc5952d6c729540248026 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Tue, 2 Oct 2018 18:46:48 +0530 Subject: [PATCH 11/18] man: Format h3 tags in ronn output --- Library/Homebrew/dev-cmd/man.rb | 4 +- Library/Homebrew/dev-cmd/pull.rb | 2 +- docs/Manpage.md | 70 ++++++++++++++++---------------- manpages/brew.1 | 54 ++++++++++++------------ 4 files changed, 65 insertions(+), 65 deletions(-) diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 7e6929d924..17808cc92e 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -156,6 +156,8 @@ module Homebrew ronn_output = ronn.read odie "Got no output from ronn!" unless ronn_output ronn_output.gsub!(%r{`(?=[.!?,;:]?\s)}, "").gsub!(%r{}, "`") if format_flag == "--markdown" + ronn_output = ronn_output.gsub(%r{}, "\\fB").gsub(%r{}, "\\fR") + .gsub(%r{}, "\\fI").gsub(%r{}, "\\fR") unless format_flag == '--markdown' target.atomic_write ronn_output end end @@ -226,8 +228,6 @@ module Homebrew def format_usage_banner(usage_banner) synopsis, *remaining_lines = usage_banner.split('\n') synopsis = synopsis.sub(/^/, "###") - .gsub(/`/, "") - .gsub(/<(.*?)>/, "\\1") [synopsis, *remaining_lines].join("\n") end end diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index fda4aed9fc..07497540b5 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -75,7 +75,7 @@ module Homebrew def pull_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - pull [options] [formula]: + pull [`options`] []: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. diff --git a/docs/Manpage.md b/docs/Manpage.md index dac186a7d0..bda0afc00a 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -663,11 +663,11 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note ## DEVELOPER COMMANDS -###audit [options] [formulae]: +###`audit` [`options`] [`formulae`]: -Check formulae for Homebrew coding style violations. This should be +Check `formulae` for Homebrew coding style violations. This should be run before submitting a new formula. -If no formulae are provided, all of them are checked. +If no `formulae` are provided, all of them are checked. * `--strict`: Run additional style checks, including Rubocop style checks. @@ -692,13 +692,13 @@ Passing `--only-cops`=`cops` will check for violations of only the listed RuboCo * `--except-cops`: Passing `--except-cops`=`cops` will skip checking the listed RuboCop cops violations. `cops` should be a comma-separated list of cop names. -###bottle [options] [formulae]: +###`bottle` [`options`] [`formulae`]: Generate a bottle (binary package) from a formula installed with ---build-bottle. +`--build-bottle`. If the formula specifies a rebuild version, it will be incremented in the -generated DSL. Passing --keep-old will attempt to keep it at its -original value, while --no-rebuild will remove it. +generated DSL. Passing `--keep-old` will attempt to keep it at its +original value, while `--no-rebuild` will remove it. * `--skip-relocation`: Do not check if the bottle can be marked as relocatable. @@ -721,15 +721,15 @@ Write bottle information to a JSON file, which can be used as the argument for ` * `--root-url`: Use the specified `URL` as the root of the bottle's URL instead of Homebrew's default. -###bump-formula-pr [options] formula: +###`bump-formula-pr` [`options`] `formula`: Creates a pull request to update the formula with a new URL or a new tag. -If a URL is specified, the sha-256 checksum of the new download must -also be specified. A best effort to determine the sha-256 and formula +If a `URL` is specified, the `sha-256` checksum of the new download must +also be specified. A best effort to determine the `sha-256` and `formula` name will be made if either or both values are not supplied by the user. -If a tag is specified, the git commit revision corresponding to that +If a `tag` is specified, the git commit `revision` corresponding to that tag must also be specified. Note that this command cannot be used to transition a formula from a @@ -764,13 +764,13 @@ Use the provided `version` to override the value parsed from the URL or tag. Not * `--message`: Append provided `message` to the default PR message. -###create URL [options]: +###`create` `URL` [`options`]: -Generate a formula for the downloadable file at URL and open it in the editor. +Generate a formula for the downloadable file at `URL` and open it in the editor. Homebrew will attempt to automatically derive the formula name -and version, but if it fails, you'll have to make your own template. The wget +and version, but if it fails, you'll have to make your own template. The `wget` formula serves as a simple example. For the complete API have a look at -http://www.rubydoc.info/github/Homebrew/brew/master/Formula. +. * `--autotools`: Create a basic template for an Autotools-style build. @@ -789,17 +789,17 @@ Set the provided version of the package you are creating. * `--tap`: Takes a tap [`user``/``repo`] as argument and generates the formula in the specified tap. -###edit formula: - Open formula in the editor. Open all of Homebrew for editing if - no formula is provided. +###`edit` `formula`: + Open `formula` in the editor. Open all of Homebrew for editing if + no `formula` is provided. -###formula formula: +###`formula` `formula`: -Display the path where formula is located. +Display the path where `formula` is located. -###irb [options]: +###`irb` [`options`]: Enter the interactive Homebrew Ruby shell. @@ -808,7 +808,7 @@ Show several examples. * `--pry`: Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set. -###linkage [options] formula: +###`linkage` [`options`] `formula`: Checks the library links of an installed formula. @@ -822,7 +822,7 @@ Print the dylib followed by the binaries which link to it for each library the k * `--cached`: Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous `brew linkage` run. -###man [options]: +###`man` [`options`]: Generate Homebrew's manpages. @@ -831,7 +831,7 @@ Return a failing status code if changes are detected in the manpage outputs. Thi * `--link`: It is now done automatically by `brew update`. -###mirror formulae: +###`mirror` `formulae`: Reuploads the stable URL for a formula to Bintray to use it as a mirror. @@ -840,12 +840,12 @@ Reuploads the stable URL for a formula to Bintray to use it as a mirror. Run Homebrew with the Ruby profiler. For example: -###pull [options] [formula]: +###pull [`options`] [`formula`]: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. -Each patch-source may be one of: +Each `patch-source` may be one of: ~ The ID number of a PR (pull request) in the homebrew/core GitHub repository @@ -881,11 +881,11 @@ Publish at the given Bintray organisation. * `--test-bot-user`: Pull the bottle block commit from the specified user on GitHub. -###release-notes [previous_tag] [end_ref]: +###`release-notes` [`previous_tag`] [`end_ref`]: Output the merged pull requests on Homebrew/brew between two Git refs. -If no previous_tag is provided it defaults to the latest tag. -If no end_ref is provided it defaults to origin/master. +If no `previous_tag` is provided it defaults to the latest tag. +If no `end_ref` is provided it defaults to `origin/master`. * `--markdown`: Output as a Markdown list. @@ -894,7 +894,7 @@ Output as a Markdown list. Run a Ruby instance with Homebrew's libraries loaded. For example: -###tap-new user/repo: +###`tap-new` `user`/`repo`: Generate the template files for a new tap. @@ -916,10 +916,10 @@ Generate the template files for a new tap. Example: `brew install jruby && brew test jruby` -###tests [options] formula: +###`tests` [`options`] `formula`: Run Homebrew's unit and integration tests. If provided, ---only=test_script runs only test_script_spec.rb, and --seed +`--only=``test_script` runs only `test_script`_spec.rb, and `--seed` randomizes tests with the provided value instead of a random seed. * `--coverage`: @@ -935,11 +935,11 @@ Run only `test_script`_spec.rb * `--seed`: Randomizes tests with the provided value instead of a random seed. -###update-test [options]: +###`update-test` [options]: -Runs a test of brew update with a new repository clone. +Runs a test of `brew update` with a new repository clone. -If no arguments are passed, use origin/master as the start commit. +If no arguments are passed, use `origin/master` as the start commit. * `--to-tag`: Set `HOMEBREW_UPDATE_TO_TAG` to test updating between tags. diff --git a/manpages/brew.1 b/manpages/brew.1 index 708d4ef152..c2f3eb06d8 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -621,8 +621,8 @@ If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full upd . .SH "DEVELOPER COMMANDS" . -.SS "audit [options] [formulae]:" -Check formulae for Homebrew coding style violations\. This should be run before submitting a new formula\. If no formulae are provided, all of them are checked\. +.SS "\fBaudit\fR [\fBoptions\fR] [\fIformulae\fR]:" +Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\. If no \fIformulae\fR are provided, all of them are checked\. . .TP \fB\-\-strict\fR @@ -668,8 +668,8 @@ Passing \fB\-\-only\-cops\fR=\fIcops\fR will check for violations of only the li \fB\-\-except\-cops\fR Passing \fB\-\-except\-cops\fR=\fIcops\fR will skip checking the listed RuboCop cops violations\. \fBcops\fR should be a comma\-separated list of cop names\. . -.SS "bottle [options] [formulae]:" -Generate a bottle (binary package) from a formula installed with \-\-build\-bottle\. If the formula specifies a rebuild version, it will be incremented in the generated DSL\. Passing \-\-keep\-old will attempt to keep it at its original value, while \-\-no\-rebuild will remove it\. +.SS "\fBbottle\fR [\fIoptions\fR] [\fIformulae\fR]:" +Generate a bottle (binary package) from a formula installed with \fB\-\-build\-bottle\fR\. If the formula specifies a rebuild version, it will be incremented in the generated DSL\. Passing \fB\-\-keep\-old\fR will attempt to keep it at its original value, while \fB\-\-no\-rebuild\fR will remove it\. . .TP \fB\-\-skip\-relocation\fR @@ -711,14 +711,14 @@ Write bottle information to a JSON file, which can be used as the argument for \ \fB\-\-root\-url\fR Use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew\'s default\. . -.SS "bump\-formula\-pr [options] formula:" +.SS "\fBbump\-formula\-pr\fR [\fIoptions\fR] \fIformula\fR:" Creates a pull request to update the formula with a new URL or a new tag\. . .P -If a URL is specified, the sha\-256 checksum of the new download must also be specified\. A best effort to determine the sha\-256 and formula name will be made if either or both values are not supplied by the user\. +If a \fIURL\fR is specified, the \fIsha\-256\fR checksum of the new download must also be specified\. A best effort to determine the \fIsha\-256\fR and \fIformula\fR name will be made if either or both values are not supplied by the user\. . .P -If a tag is specified, the git commit revision corresponding to that tag must also be specified\. +If a \fItag\fR is specified, the git commit \fIrevision\fR corresponding to that tag must also be specified\. . .P Note that this command cannot be used to transition a formula from a URL\-and\-sha256 style specification into a tag\-and\-revision style specification, nor vice versa\. It must use whichever style specification the preexisting formula already uses\. @@ -778,8 +778,8 @@ Use the provided \fIversion\fR to override the value parsed from the URL or tag\ \fB\-\-message\fR Append provided \fImessage\fR to the default PR message\. . -.SS "create URL [options]:" -Generate a formula for the downloadable file at URL and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The wget formula serves as a simple example\. For the complete API have a look at http://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\. +.SS "\fBcreate\fR \fIURL\fR [\fIoptions\fR]:" +Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The \fBwget\fR formula serves as a simple example\. For the complete API have a look at \fIhttp://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\fR\. . .TP \fB\-\-autotools\fR @@ -813,13 +813,13 @@ Set the provided version of the package you are creating\. \fB\-\-tap\fR Takes a tap [\fIuser\fR\fB/\fR\fIrepo\fR] as argument and generates the formula in the specified tap\. . -.SS "edit formula:" -Open formula in the editor\. Open all of Homebrew for editing if no formula is provided\. +.SS "\fBedit\fR \fIformula\fR:" +Open \fIformula\fR in the editor\. Open all of Homebrew for editing if no \fIformula\fR is provided\. . -.SS "formula formula:" -Display the path where formula is located\. +.SS "\fBformula\fR \fIformula\fR:" +Display the path where \fIformula\fR is located\. . -.SS "irb [options]:" +.SS "\fBirb\fR [\fIoptions\fR]:" Enter the interactive Homebrew Ruby shell\. . .TP @@ -830,7 +830,7 @@ Show several examples\. \fB\-\-pry\fR Pry will be used instead of irb if \fB\-\-pry\fR is passed or HOMEBREW_PRY is set\. . -.SS "linkage [options] formula:" +.SS "\fBlinkage\fR [\fIoptions\fR] \fIformula\fR:" Checks the library links of an installed formula\. . .P @@ -848,7 +848,7 @@ Print the dylib followed by the binaries which link to it for each library the k \fB\-\-cached\fR Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous \fBbrew linkage\fR run\. . -.SS "man [options]:" +.SS "\fBman\fR [\fIoptions\fR]:" Generate Homebrew\'s manpages\. . .TP @@ -859,18 +859,18 @@ Return a failing status code if changes are detected in the manpage outputs\. Th \fB\-\-link\fR It is now done automatically by \fBbrew update\fR\. . -.SS "mirror formulae:" +.SS "\fBmirror\fR \fIformulae\fR:" Reuploads the stable URL for a formula to Bintray to use it as a mirror\. . .TP \fBprof\fR [ruby options] Run Homebrew with the Ruby profiler\. For example: . -.SS "pull [options] [formula]:" +.SS "pull [\fBoptions\fR] [\fIformula\fR]:" Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\. . .P -Each patch\-source may be one of: +Each \fIpatch\-source\fR may be one of: . .P ~ The ID number of a PR (pull request) in the homebrew/core GitHub repository @@ -928,8 +928,8 @@ Publish at the given Bintray organisation\. \fB\-\-test\-bot\-user\fR Pull the bottle block commit from the specified user on GitHub\. . -.SS "release\-notes [previous_tag] [end_ref]:" -Output the merged pull requests on Homebrew/brew between two Git refs\. If no previous_tag is provided it defaults to the latest tag\. If no end_ref is provided it defaults to origin/master\. +.SS "\fBrelease\-notes\fR [\fIprevious_tag\fR] [\fIend_ref\fR]:" +Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. . .TP \fB\-\-markdown\fR @@ -939,7 +939,7 @@ Output as a Markdown list\. \fBruby\fR [\fIruby options\fR] Run a Ruby instance with Homebrew\'s libraries loaded\. For example: . -.SS "tap\-new user/repo:" +.SS "\fBtap\-new\fR \fIuser\fR/\fIrepo\fR:" Generate the template files for a new tap\. . .TP @@ -958,8 +958,8 @@ If \fB\-\-keep\-tmp\fR is passed, the temporary files created for the test are n .IP Example: \fBbrew install jruby && brew test jruby\fR . -.SS "tests [options] formula:" -Run Homebrew\'s unit and integration tests\. If provided, \-\-only=test_script runs only test_script_spec\.rb, and \-\-seed randomizes tests with the provided value instead of a random seed\. +.SS "\fBtests\fR [\fIoptions\fR] \fIformula\fR:" +Run Homebrew\'s unit and integration tests\. If provided, \fB\-\-only=\fR\fItest_script\fR runs only \fItest_script\fR_spec\.rb, and \fB\-\-seed\fR randomizes tests with the provided value instead of a random seed\. . .TP \fB\-\-coverage\fR @@ -985,11 +985,11 @@ Run only \fItest_script\fR_spec\.rb \fB\-\-seed\fR Randomizes tests with the provided value instead of a random seed\. . -.SS "update\-test [options]:" -Runs a test of brew update with a new repository clone\. +.SS "\fBupdate\-test\fR [options]:" +Runs a test of \fBbrew update\fR with a new repository clone\. . .P -If no arguments are passed, use origin/master as the start commit\. +If no arguments are passed, use \fBorigin/master\fR as the start commit\. . .TP \fB\-\-to\-tag\fR From f60582ca48006b2eff67021a67fed2a1020c03bc Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Tue, 2 Oct 2018 18:50:59 +0530 Subject: [PATCH 12/18] man: Remove [] from command synopsis --- Library/Homebrew/dev-cmd/audit.rb | 2 +- Library/Homebrew/dev-cmd/bottle.rb | 2 +- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 2 +- Library/Homebrew/dev-cmd/create.rb | 2 +- Library/Homebrew/dev-cmd/irb.rb | 2 +- Library/Homebrew/dev-cmd/linkage.rb | 2 +- Library/Homebrew/dev-cmd/man.rb | 6 ++---- Library/Homebrew/dev-cmd/pull.rb | 2 +- Library/Homebrew/dev-cmd/release-notes.rb | 2 +- Library/Homebrew/dev-cmd/tests.rb | 2 +- Library/Homebrew/dev-cmd/update-test.rb | 2 +- docs/Manpage.md | 22 ++++++++++----------- manpages/brew.1 | 22 ++++++++++----------- 13 files changed, 34 insertions(+), 36 deletions(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 461c770d4a..e6dbe345aa 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -55,7 +55,7 @@ module Homebrew def audit_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `audit` [`options`] []: + `audit` : Check for Homebrew coding style violations. This should be run before submitting a new formula. diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 908d71f1f9..6e5e960dc7 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -72,7 +72,7 @@ module Homebrew def bottle_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `bottle` [] []: + `bottle` : Generate a bottle (binary package) from a formula installed with `--build-bottle`. diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 89b616d037..8b7aae6c98 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -50,7 +50,7 @@ module Homebrew def bump_formula_pr_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `bump-formula-pr` [] : + `bump-formula-pr` : Creates a pull request to update the formula with a new URL or a new tag. diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index f5f174f12f..90c81294fa 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -30,7 +30,7 @@ module Homebrew def create_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `create` []: + `create` : Generate a formula for the downloadable file at and open it in the editor. Homebrew will attempt to automatically derive the formula name diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index 486970c774..4638d302c9 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -25,7 +25,7 @@ module Homebrew def irb_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `irb` []: + `irb` : Enter the interactive Homebrew Ruby shell. EOS diff --git a/Library/Homebrew/dev-cmd/linkage.rb b/Library/Homebrew/dev-cmd/linkage.rb index 2feb98f899..6c5f50a669 100644 --- a/Library/Homebrew/dev-cmd/linkage.rb +++ b/Library/Homebrew/dev-cmd/linkage.rb @@ -22,7 +22,7 @@ module Homebrew def linkage_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `linkage` [] : + `linkage` : Checks the library links of an installed formula. diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 17808cc92e..177dd8fb98 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -36,7 +36,7 @@ module Homebrew def man_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `man` []: + `man` : Generate Homebrew's manpages. EOS @@ -226,8 +226,6 @@ module Homebrew end def format_usage_banner(usage_banner) - synopsis, *remaining_lines = usage_banner.split('\n') - synopsis = synopsis.sub(/^/, "###") - [synopsis, *remaining_lines].join("\n") + usage_banner.sub(/^/, "###") end end diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 07497540b5..a1a35d51df 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -75,7 +75,7 @@ module Homebrew def pull_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - pull [`options`] []: + pull : Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index 6eb8d19bec..3ed6b3cd67 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -13,7 +13,7 @@ module Homebrew def release_notes_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `release-notes` [] []: + `release-notes` : Output the merged pull requests on Homebrew/brew between two Git refs. If no is provided it defaults to the latest tag. diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 5730c7cab7..bfe0702d2a 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -24,7 +24,7 @@ module Homebrew def tests_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `tests` [] : + `tests` : Run Homebrew's unit and integration tests. If provided, `--only=` runs only _spec.rb, and `--seed` diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index 6f3ca832bf..9ca8731186 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -22,7 +22,7 @@ module Homebrew def update_test_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `update-test` [options]: + `update-test` : Runs a test of `brew update` with a new repository clone. diff --git a/docs/Manpage.md b/docs/Manpage.md index bda0afc00a..e80ac95c32 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -663,7 +663,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note ## DEVELOPER COMMANDS -###`audit` [`options`] [`formulae`]: +###`audit` `options` `formulae`: Check `formulae` for Homebrew coding style violations. This should be run before submitting a new formula. @@ -692,7 +692,7 @@ Passing `--only-cops`=`cops` will check for violations of only the listed RuboCo * `--except-cops`: Passing `--except-cops`=`cops` will skip checking the listed RuboCop cops violations. `cops` should be a comma-separated list of cop names. -###`bottle` [`options`] [`formulae`]: +###`bottle` `options` `formulae`: Generate a bottle (binary package) from a formula installed with `--build-bottle`. @@ -721,7 +721,7 @@ Write bottle information to a JSON file, which can be used as the argument for ` * `--root-url`: Use the specified `URL` as the root of the bottle's URL instead of Homebrew's default. -###`bump-formula-pr` [`options`] `formula`: +###`bump-formula-pr` `options` `formula`: Creates a pull request to update the formula with a new URL or a new tag. @@ -764,7 +764,7 @@ Use the provided `version` to override the value parsed from the URL or tag. Not * `--message`: Append provided `message` to the default PR message. -###`create` `URL` [`options`]: +###`create` `URL` `options`: Generate a formula for the downloadable file at `URL` and open it in the editor. Homebrew will attempt to automatically derive the formula name @@ -799,7 +799,7 @@ Takes a tap [`user``/``repo`] as argument and generates the formula in the speci Display the path where `formula` is located. -###`irb` [`options`]: +###`irb` `options`: Enter the interactive Homebrew Ruby shell. @@ -808,7 +808,7 @@ Show several examples. * `--pry`: Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set. -###`linkage` [`options`] `formula`: +###`linkage` `options` `formula`: Checks the library links of an installed formula. @@ -822,7 +822,7 @@ Print the dylib followed by the binaries which link to it for each library the k * `--cached`: Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous `brew linkage` run. -###`man` [`options`]: +###`man` `options`: Generate Homebrew's manpages. @@ -840,7 +840,7 @@ Reuploads the stable URL for a formula to Bintray to use it as a mirror. Run Homebrew with the Ruby profiler. For example: -###pull [`options`] [`formula`]: +###pull `options` `formula`: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. @@ -881,7 +881,7 @@ Publish at the given Bintray organisation. * `--test-bot-user`: Pull the bottle block commit from the specified user on GitHub. -###`release-notes` [`previous_tag`] [`end_ref`]: +###`release-notes` `previous_tag` `end_ref`: Output the merged pull requests on Homebrew/brew between two Git refs. If no `previous_tag` is provided it defaults to the latest tag. @@ -916,7 +916,7 @@ Generate the template files for a new tap. Example: `brew install jruby && brew test jruby` -###`tests` [`options`] `formula`: +###`tests` `options` `formula`: Run Homebrew's unit and integration tests. If provided, `--only=``test_script` runs only `test_script`_spec.rb, and `--seed` @@ -935,7 +935,7 @@ Run only `test_script`_spec.rb * `--seed`: Randomizes tests with the provided value instead of a random seed. -###`update-test` [options]: +###`update-test` `options`: Runs a test of `brew update` with a new repository clone. diff --git a/manpages/brew.1 b/manpages/brew.1 index c2f3eb06d8..9f5c57ff9e 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -621,7 +621,7 @@ If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full upd . .SH "DEVELOPER COMMANDS" . -.SS "\fBaudit\fR [\fBoptions\fR] [\fIformulae\fR]:" +.SS "\fBaudit\fR \fIoptions\fR \fIformulae\fR:" Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\. If no \fIformulae\fR are provided, all of them are checked\. . .TP @@ -668,7 +668,7 @@ Passing \fB\-\-only\-cops\fR=\fIcops\fR will check for violations of only the li \fB\-\-except\-cops\fR Passing \fB\-\-except\-cops\fR=\fIcops\fR will skip checking the listed RuboCop cops violations\. \fBcops\fR should be a comma\-separated list of cop names\. . -.SS "\fBbottle\fR [\fIoptions\fR] [\fIformulae\fR]:" +.SS "\fBbottle\fR \fIoptions\fR \fIformulae\fR:" Generate a bottle (binary package) from a formula installed with \fB\-\-build\-bottle\fR\. If the formula specifies a rebuild version, it will be incremented in the generated DSL\. Passing \fB\-\-keep\-old\fR will attempt to keep it at its original value, while \fB\-\-no\-rebuild\fR will remove it\. . .TP @@ -711,7 +711,7 @@ Write bottle information to a JSON file, which can be used as the argument for \ \fB\-\-root\-url\fR Use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew\'s default\. . -.SS "\fBbump\-formula\-pr\fR [\fIoptions\fR] \fIformula\fR:" +.SS "\fBbump\-formula\-pr\fR \fIoptions\fR \fIformula\fR:" Creates a pull request to update the formula with a new URL or a new tag\. . .P @@ -778,7 +778,7 @@ Use the provided \fIversion\fR to override the value parsed from the URL or tag\ \fB\-\-message\fR Append provided \fImessage\fR to the default PR message\. . -.SS "\fBcreate\fR \fIURL\fR [\fIoptions\fR]:" +.SS "\fBcreate\fR \fIURL\fR \fIoptions\fR:" Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The \fBwget\fR formula serves as a simple example\. For the complete API have a look at \fIhttp://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\fR\. . .TP @@ -819,7 +819,7 @@ Open \fIformula\fR in the editor\. Open all of Homebrew for editing if no \fIfor .SS "\fBformula\fR \fIformula\fR:" Display the path where \fIformula\fR is located\. . -.SS "\fBirb\fR [\fIoptions\fR]:" +.SS "\fBirb\fR \fIoptions\fR:" Enter the interactive Homebrew Ruby shell\. . .TP @@ -830,7 +830,7 @@ Show several examples\. \fB\-\-pry\fR Pry will be used instead of irb if \fB\-\-pry\fR is passed or HOMEBREW_PRY is set\. . -.SS "\fBlinkage\fR [\fIoptions\fR] \fIformula\fR:" +.SS "\fBlinkage\fR \fIoptions\fR \fIformula\fR:" Checks the library links of an installed formula\. . .P @@ -848,7 +848,7 @@ Print the dylib followed by the binaries which link to it for each library the k \fB\-\-cached\fR Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous \fBbrew linkage\fR run\. . -.SS "\fBman\fR [\fIoptions\fR]:" +.SS "\fBman\fR \fIoptions\fR:" Generate Homebrew\'s manpages\. . .TP @@ -866,7 +866,7 @@ Reuploads the stable URL for a formula to Bintray to use it as a mirror\. \fBprof\fR [ruby options] Run Homebrew with the Ruby profiler\. For example: . -.SS "pull [\fBoptions\fR] [\fIformula\fR]:" +.SS "pull \fIoptions\fR \fIformula\fR:" Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\. . .P @@ -928,7 +928,7 @@ Publish at the given Bintray organisation\. \fB\-\-test\-bot\-user\fR Pull the bottle block commit from the specified user on GitHub\. . -.SS "\fBrelease\-notes\fR [\fIprevious_tag\fR] [\fIend_ref\fR]:" +.SS "\fBrelease\-notes\fR \fIprevious_tag\fR \fIend_ref\fR:" Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. . .TP @@ -958,7 +958,7 @@ If \fB\-\-keep\-tmp\fR is passed, the temporary files created for the test are n .IP Example: \fBbrew install jruby && brew test jruby\fR . -.SS "\fBtests\fR [\fIoptions\fR] \fIformula\fR:" +.SS "\fBtests\fR \fIoptions\fR \fIformula\fR:" Run Homebrew\'s unit and integration tests\. If provided, \fB\-\-only=\fR\fItest_script\fR runs only \fItest_script\fR_spec\.rb, and \fB\-\-seed\fR randomizes tests with the provided value instead of a random seed\. . .TP @@ -985,7 +985,7 @@ Run only \fItest_script\fR_spec\.rb \fB\-\-seed\fR Randomizes tests with the provided value instead of a random seed\. . -.SS "\fBupdate\-test\fR [options]:" +.SS "\fBupdate\-test\fR \fIoptions\fR:" Runs a test of \fBbrew update\fR with a new repository clone\. . .P From 604dfb4ae64270cfdf86a2355c8b795d9accd803 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Tue, 2 Oct 2018 19:34:46 +0530 Subject: [PATCH 13/18] help: Let OptionParser generate help text for supported commands --- Library/Homebrew/dev-cmd/prof.rb | 2 +- Library/Homebrew/help.rb | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index 0a7409ec53..ebf9dc98e3 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -1,7 +1,7 @@ #: * `prof` [ruby options]: #: Run Homebrew with the Ruby profiler. #: For example: -# brew prof readall +#: brew prof readall module Homebrew module_function diff --git a/Library/Homebrew/help.rb b/Library/Homebrew/help.rb index b1bc461e4e..3d334901bd 100644 --- a/Library/Homebrew/help.rb +++ b/Library/Homebrew/help.rb @@ -38,8 +38,13 @@ module Homebrew module_function def help(cmd = nil, flags = {}) - # Let OptionParser generate help text for developer commands - return if require? HOMEBREW_LIBRARY_PATH/"dev-cmd"/cmd + # Let OptionParser generate help text for commands which have a parser defined + begin + Homebrew.send("#{cmd.gsub('-','_')}_args".to_sym) + return + rescue NoMethodError + nil + end # Resolve command aliases and find file containing the implementation. if cmd From 7b0f27ca3929faeff3deb0fcbbecb314f805884e Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Tue, 2 Oct 2018 19:54:22 +0530 Subject: [PATCH 14/18] style: Fix style errors --- Library/Homebrew/cli_parser.rb | 2 +- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 40 +++++++++++---------- Library/Homebrew/dev-cmd/irb.rb | 3 +- Library/Homebrew/dev-cmd/man.rb | 10 +++--- Library/Homebrew/dev-cmd/mirror.rb | 2 +- Library/Homebrew/dev-cmd/prof.rb | 4 +-- Library/Homebrew/dev-cmd/pull.rb | 10 +++--- Library/Homebrew/dev-cmd/tap-new.rb | 2 +- Library/Homebrew/dev-cmd/test.rb | 2 +- Library/Homebrew/help.rb | 2 +- docs/Manpage.md | 9 ++--- manpages/brew.1 | 6 ++-- 12 files changed, 49 insertions(+), 43 deletions(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index 8ef63c7232..0de33a37e7 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -125,7 +125,7 @@ module Homebrew end def global_option?(name) - Homebrew::CLI::Parser.global_options.has_key?(name.to_sym) + Homebrew::CLI::Parser.global_options.key?(name.to_sym) end private diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 8b7aae6c98..9755b009a5 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -53,11 +53,11 @@ module Homebrew `bump-formula-pr` : Creates a pull request to update the formula with a new URL or a new tag. - + If a is specified, the checksum of the new download must also be specified. A best effort to determine the and name will be made if either or both values are not supplied by the user. - + If a is specified, the git commit corresponding to that tag must also be specified. @@ -66,41 +66,43 @@ module Homebrew specification, nor vice versa. It must use whichever style specification the preexisting formula already uses. EOS - switch "--devel", + switch "--devel", description: "Bump the development rather than stable version. The development spec must already exist." - switch "-n", "--dry-run", + switch "-n", "--dry-run", description: "Print what would be done rather than doing it." - switch "--write", + switch "--write", description: "When passed along with `--dry-run`, perform a not-so-dry run making the expected "\ "file modifications but not taking any git actions." - switch "--audit", + switch "--audit", description: "Run `brew audit` before opening the PR." - switch "--strict", + switch "--strict", description: "Run `brew audit --strict` before opening the PR." - switch "--no-browse", + switch "--no-browse", description: "Output the pull request URL instead of opening in a browser" - flag "--url=", + flag "--url=", description: "Provide new for the formula. If a is specified, the "\ "checksum of the new download must also be specified." - flag "--revision=", + flag "--revision=", description: "Specify the new git commit corresponding to a specified ." - flag "--tag=", required_for: "--revision=", + flag "--tag=", + required_for: "--revision=", description: "Specify the new git commit for the formula." - flag "--sha256=", depends_on: "--url=", + flag "--sha256=", + depends_on: "--url=", description: "Specify the checksum of new download." - flag "--mirror=", + flag "--mirror=", description: "Use the provided as a mirror URL." - flag "--version=", + flag "--version=", description: "Use the provided to override the value parsed from the URL or tag. Note "\ "that `--version=0` can be used to delete an existing `version` override from a "\ "formula if it has become redundant." - flag "--message=", + flag "--message=", description: "Append provided to the default PR message." - switch :quiet - switch :force - switch :verbose - switch :debug + switch :quiet + switch :force + switch :verbose + switch :debug conflicts "--url", "--tag" end end diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index 4638d302c9..af24a8a677 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -31,7 +31,8 @@ module Homebrew EOS switch "--examples", description: "Show several examples." - switch "--pry", env: :pry, + switch "--pry", + env: :pry, description: "Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set." end end diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 177dd8fb98..8548c8357c 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -156,8 +156,10 @@ module Homebrew ronn_output = ronn.read odie "Got no output from ronn!" unless ronn_output ronn_output.gsub!(%r{`(?=[.!?,;:]?\s)}, "").gsub!(%r{}, "`") if format_flag == "--markdown" - ronn_output = ronn_output.gsub(%r{}, "\\fB").gsub(%r{}, "\\fR") - .gsub(%r{}, "\\fI").gsub(%r{}, "\\fR") unless format_flag == '--markdown' + unless format_flag == "--markdown" + ronn_output = ronn_output.gsub(//, "\\fB").gsub(%r{}, "\\fR") + .gsub(//, "\\fI").gsub(%r{}, "\\fR") + end target.atomic_write ronn_output end end @@ -192,11 +194,11 @@ module Homebrew end def cmd_arg_parser(cmd_path) - "#{cmd_path.basename.to_s.gsub('.rb', '').gsub('-', '_')}_args".to_sym + "#{cmd_path.basename.to_s.gsub(".rb", "").tr("-", "_")}_args".to_sym end def cmd_manpage_lines(cmd_parser) - lines = ["#{format_usage_banner(cmd_parser.usage_banner_text)}"] + lines = [format_usage_banner(cmd_parser.usage_banner_text)] lines += cmd_parser.processed_options.map do |short, long, _, desc| next if !long.nil? && cmd_parser.global_option?(cmd_parser.option_to_name(long)) generate_option_doc(short, long, desc) diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index 95144f93eb..a707e1dc7e 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -11,7 +11,7 @@ module Homebrew Homebrew::CLI::Parser.new do usage_banner <<~EOS `mirror` : - + Reuploads the stable URL for a formula to Bintray to use it as a mirror. EOS switch :debug diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index ebf9dc98e3..f2750e83c2 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -1,7 +1,7 @@ -#: * `prof` [ruby options]: +#: * `prof` []: #: Run Homebrew with the Ruby profiler. #: For example: -#: brew prof readall +#: brew prof readall module Homebrew module_function diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index a1a35d51df..26c597e8e2 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -79,18 +79,18 @@ module Homebrew Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. - + Each may be one of: - + ~ The ID number of a PR (pull request) in the homebrew/core GitHub repository - + ~ The URL of a PR on GitHub, using either the web page or API URL formats. In this form, the PR may be on Homebrew/brew, Homebrew/homebrew-core or any tap. - + ~ The URL of a commit on GitHub - + ~ A "https://jenkins.brew.sh/job/..." string specifying a testing job ID EOS switch "--bottle", diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index a658aa0f73..92ff6a40b9 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -19,7 +19,7 @@ module Homebrew Homebrew::CLI::Parser.new do usage_banner <<~EOS `tap-new` /: - + Generate the template files for a new tap. EOS switch :debug diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index 849c004205..1e74496dc5 100644 --- a/Library/Homebrew/dev-cmd/test.rb +++ b/Library/Homebrew/dev-cmd/test.rb @@ -1,4 +1,4 @@ -#: * test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: +#: * `test` [`--devel`|`--HEAD`] [`--debug`] [`--keep-tmp`] : #: Most formulae provide a test method. `brew test` runs this #: test method. There is no standard output or return code, but it should #: generally indicate to the user if something is wrong with the installed diff --git a/Library/Homebrew/help.rb b/Library/Homebrew/help.rb index 3d334901bd..a73ad81981 100644 --- a/Library/Homebrew/help.rb +++ b/Library/Homebrew/help.rb @@ -40,7 +40,7 @@ module Homebrew def help(cmd = nil, flags = {}) # Let OptionParser generate help text for commands which have a parser defined begin - Homebrew.send("#{cmd.gsub('-','_')}_args".to_sym) + Homebrew.send("#{cmd.tr("-", "_")}_args".to_sym) return rescue NoMethodError nil diff --git a/docs/Manpage.md b/docs/Manpage.md index e80ac95c32..c5977786e0 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -832,13 +832,14 @@ Return a failing status code if changes are detected in the manpage outputs. Thi It is now done automatically by `brew update`. ###`mirror` `formulae`: - + Reuploads the stable URL for a formula to Bintray to use it as a mirror. - * `prof` [ruby options]: + * `prof` [`ruby options`]: Run Homebrew with the Ruby profiler. For example: + brew prof readall ###pull `options` `formula`: @@ -895,11 +896,11 @@ Output as a Markdown list. For example: ###`tap-new` `user`/`repo`: - + Generate the template files for a new tap. - * test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: + * `test` [`--devel`|`--HEAD`] [`--debug`] [`--keep-tmp`] `formula`: Most formulae provide a test method. `brew test` `formula` runs this test method. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed diff --git a/manpages/brew.1 b/manpages/brew.1 index 9f5c57ff9e..4eed60923e 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -863,8 +863,8 @@ It is now done automatically by \fBbrew update\fR\. Reuploads the stable URL for a formula to Bintray to use it as a mirror\. . .TP -\fBprof\fR [ruby options] -Run Homebrew with the Ruby profiler\. For example: +\fBprof\fR [\fIruby options\fR] +Run Homebrew with the Ruby profiler\. For example: brew prof readall . .SS "pull \fIoptions\fR \fIformula\fR:" Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\. @@ -943,7 +943,7 @@ Run a Ruby instance with Homebrew\'s libraries loaded\. For example: Generate the template files for a new tap\. . .TP -test [\-\-devel|\-\-HEAD] [\-\-debug] [\-\-keep\-tmp] [formula] +\fBtest\fR [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-debug\fR] [\fB\-\-keep\-tmp\fR] \fIformula\fR Most formulae provide a test method\. \fBbrew test\fR \fIformula\fR runs this test method\. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed formula\. . .IP From a03d2e0cd1dfa1de7c5c0633eb20d794e346888f Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Wed, 3 Oct 2018 10:19:46 +0530 Subject: [PATCH 15/18] man: Correct option synopsis --- Library/Homebrew/dev-cmd/audit.rb | 2 +- Library/Homebrew/dev-cmd/bottle.rb | 2 +- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 2 +- Library/Homebrew/dev-cmd/create.rb | 2 +- Library/Homebrew/dev-cmd/irb.rb | 2 +- Library/Homebrew/dev-cmd/linkage.rb | 2 +- Library/Homebrew/dev-cmd/man.rb | 8 ++++---- Library/Homebrew/dev-cmd/pull.rb | 2 +- Library/Homebrew/dev-cmd/release-notes.rb | 2 +- Library/Homebrew/dev-cmd/tests.rb | 2 +- Library/Homebrew/dev-cmd/update-test.rb | 2 +- docs/Manpage.md | 22 ++++++++++----------- manpages/brew.1 | 22 ++++++++++----------- 13 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index e6dbe345aa..9cfb793344 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -55,7 +55,7 @@ module Homebrew def audit_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `audit` : + `audit` [] : Check for Homebrew coding style violations. This should be run before submitting a new formula. diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 6e5e960dc7..3f43214f02 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -72,7 +72,7 @@ module Homebrew def bottle_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `bottle` : + `bottle` [] : Generate a bottle (binary package) from a formula installed with `--build-bottle`. diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 9755b009a5..2cd9ed86f2 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -50,7 +50,7 @@ module Homebrew def bump_formula_pr_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `bump-formula-pr` : + `bump-formula-pr` [] : Creates a pull request to update the formula with a new URL or a new tag. diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 90c81294fa..f5f174f12f 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -30,7 +30,7 @@ module Homebrew def create_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `create` : + `create` []: Generate a formula for the downloadable file at and open it in the editor. Homebrew will attempt to automatically derive the formula name diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index af24a8a677..816ab6047c 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -25,7 +25,7 @@ module Homebrew def irb_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `irb` : + `irb` []: Enter the interactive Homebrew Ruby shell. EOS diff --git a/Library/Homebrew/dev-cmd/linkage.rb b/Library/Homebrew/dev-cmd/linkage.rb index 6c5f50a669..2feb98f899 100644 --- a/Library/Homebrew/dev-cmd/linkage.rb +++ b/Library/Homebrew/dev-cmd/linkage.rb @@ -22,7 +22,7 @@ module Homebrew def linkage_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `linkage` : + `linkage` [] : Checks the library links of an installed formula. diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 8548c8357c..84f38ceaf0 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -36,7 +36,7 @@ module Homebrew def man_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `man` : + `man` []: Generate Homebrew's manpages. EOS @@ -157,8 +157,8 @@ module Homebrew odie "Got no output from ronn!" unless ronn_output ronn_output.gsub!(%r{`(?=[.!?,;:]?\s)}, "").gsub!(%r{}, "`") if format_flag == "--markdown" unless format_flag == "--markdown" - ronn_output = ronn_output.gsub(//, "\\fB").gsub(%r{}, "\\fR") - .gsub(//, "\\fI").gsub(%r{}, "\\fR") + ronn_output = ronn_output.gsub(%r{(.*?)}, "\\fB\\1\\fR") + .gsub(%r{(.*?)}, "\\fI\\1\\fR") end target.atomic_write ronn_output end @@ -187,7 +187,7 @@ module Homebrew cmd_parser = Homebrew.send(cmd_arg_parser(cmd_path)) man_page_lines << cmd_manpage_lines(cmd_parser).join rescue NoMethodError - man_page_lines << path_glob_commands(cmd_path.to_s)[0] + man_page_lines << path_glob_commands(cmd_path.to_s).first end end man_page_lines diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 26c597e8e2..7f51c68c4b 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -75,7 +75,7 @@ module Homebrew def pull_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - pull : + pull [] : Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index 3ed6b3cd67..8445ee2d58 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -13,7 +13,7 @@ module Homebrew def release_notes_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `release-notes` : + `release-notes` [] [] []: Output the merged pull requests on Homebrew/brew between two Git refs. If no is provided it defaults to the latest tag. diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index bfe0702d2a..add193d968 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -24,7 +24,7 @@ module Homebrew def tests_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `tests` : + `tests` []: Run Homebrew's unit and integration tests. If provided, `--only=` runs only _spec.rb, and `--seed` diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index 9ca8731186..7a1ffef27f 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -22,7 +22,7 @@ module Homebrew def update_test_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `update-test` : + `update-test` []: Runs a test of `brew update` with a new repository clone. diff --git a/docs/Manpage.md b/docs/Manpage.md index c5977786e0..c8a5f34ad4 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -663,7 +663,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note ## DEVELOPER COMMANDS -###`audit` `options` `formulae`: +###`audit` [`options`] `formulae`: Check `formulae` for Homebrew coding style violations. This should be run before submitting a new formula. @@ -692,7 +692,7 @@ Passing `--only-cops`=`cops` will check for violations of only the listed RuboCo * `--except-cops`: Passing `--except-cops`=`cops` will skip checking the listed RuboCop cops violations. `cops` should be a comma-separated list of cop names. -###`bottle` `options` `formulae`: +###`bottle` [`options`] `formulae`: Generate a bottle (binary package) from a formula installed with `--build-bottle`. @@ -721,7 +721,7 @@ Write bottle information to a JSON file, which can be used as the argument for ` * `--root-url`: Use the specified `URL` as the root of the bottle's URL instead of Homebrew's default. -###`bump-formula-pr` `options` `formula`: +###`bump-formula-pr` [`options`] `formula`: Creates a pull request to update the formula with a new URL or a new tag. @@ -764,7 +764,7 @@ Use the provided `version` to override the value parsed from the URL or tag. Not * `--message`: Append provided `message` to the default PR message. -###`create` `URL` `options`: +###`create` `URL` [`options`]: Generate a formula for the downloadable file at `URL` and open it in the editor. Homebrew will attempt to automatically derive the formula name @@ -799,7 +799,7 @@ Takes a tap [`user``/``repo`] as argument and generates the formula in the speci Display the path where `formula` is located. -###`irb` `options`: +###`irb` [`options`]: Enter the interactive Homebrew Ruby shell. @@ -808,7 +808,7 @@ Show several examples. * `--pry`: Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set. -###`linkage` `options` `formula`: +###`linkage` [`options`] `formula`: Checks the library links of an installed formula. @@ -822,7 +822,7 @@ Print the dylib followed by the binaries which link to it for each library the k * `--cached`: Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous `brew linkage` run. -###`man` `options`: +###`man` [`options`]: Generate Homebrew's manpages. @@ -841,7 +841,7 @@ Reuploads the stable URL for a formula to Bintray to use it as a mirror. For example: brew prof readall -###pull `options` `formula`: +###pull [`options`] `formula`: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Optionally, installs the formulae changed by the patch. @@ -882,7 +882,7 @@ Publish at the given Bintray organisation. * `--test-bot-user`: Pull the bottle block commit from the specified user on GitHub. -###`release-notes` `previous_tag` `end_ref`: +###`release-notes` [`options`] [`previous_tag`] [`end_ref`]: Output the merged pull requests on Homebrew/brew between two Git refs. If no `previous_tag` is provided it defaults to the latest tag. @@ -917,7 +917,7 @@ Generate the template files for a new tap. Example: `brew install jruby && brew test jruby` -###`tests` `options` `formula`: +###`tests` [`options`]: Run Homebrew's unit and integration tests. If provided, `--only=``test_script` runs only `test_script`_spec.rb, and `--seed` @@ -936,7 +936,7 @@ Run only `test_script`_spec.rb * `--seed`: Randomizes tests with the provided value instead of a random seed. -###`update-test` `options`: +###`update-test` [`options`]: Runs a test of `brew update` with a new repository clone. diff --git a/manpages/brew.1 b/manpages/brew.1 index 4eed60923e..1788e230b9 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -621,7 +621,7 @@ If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full upd . .SH "DEVELOPER COMMANDS" . -.SS "\fBaudit\fR \fIoptions\fR \fIformulae\fR:" +.SS "\fBaudit\fR [\fIoptions\fR] \fIformulae\fR:" Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\. If no \fIformulae\fR are provided, all of them are checked\. . .TP @@ -668,7 +668,7 @@ Passing \fB\-\-only\-cops\fR=\fIcops\fR will check for violations of only the li \fB\-\-except\-cops\fR Passing \fB\-\-except\-cops\fR=\fIcops\fR will skip checking the listed RuboCop cops violations\. \fBcops\fR should be a comma\-separated list of cop names\. . -.SS "\fBbottle\fR \fIoptions\fR \fIformulae\fR:" +.SS "\fBbottle\fR [\fIoptions\fR] \fIformulae\fR:" Generate a bottle (binary package) from a formula installed with \fB\-\-build\-bottle\fR\. If the formula specifies a rebuild version, it will be incremented in the generated DSL\. Passing \fB\-\-keep\-old\fR will attempt to keep it at its original value, while \fB\-\-no\-rebuild\fR will remove it\. . .TP @@ -711,7 +711,7 @@ Write bottle information to a JSON file, which can be used as the argument for \ \fB\-\-root\-url\fR Use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew\'s default\. . -.SS "\fBbump\-formula\-pr\fR \fIoptions\fR \fIformula\fR:" +.SS "\fBbump\-formula\-pr\fR [\fIoptions\fR] \fIformula\fR:" Creates a pull request to update the formula with a new URL or a new tag\. . .P @@ -778,7 +778,7 @@ Use the provided \fIversion\fR to override the value parsed from the URL or tag\ \fB\-\-message\fR Append provided \fImessage\fR to the default PR message\. . -.SS "\fBcreate\fR \fIURL\fR \fIoptions\fR:" +.SS "\fBcreate\fR \fIURL\fR [\fIoptions\fR]:" Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The \fBwget\fR formula serves as a simple example\. For the complete API have a look at \fIhttp://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\fR\. . .TP @@ -819,7 +819,7 @@ Open \fIformula\fR in the editor\. Open all of Homebrew for editing if no \fIfor .SS "\fBformula\fR \fIformula\fR:" Display the path where \fIformula\fR is located\. . -.SS "\fBirb\fR \fIoptions\fR:" +.SS "\fBirb\fR [\fIoptions\fR]:" Enter the interactive Homebrew Ruby shell\. . .TP @@ -830,7 +830,7 @@ Show several examples\. \fB\-\-pry\fR Pry will be used instead of irb if \fB\-\-pry\fR is passed or HOMEBREW_PRY is set\. . -.SS "\fBlinkage\fR \fIoptions\fR \fIformula\fR:" +.SS "\fBlinkage\fR [\fIoptions\fR] \fIformula\fR:" Checks the library links of an installed formula\. . .P @@ -848,7 +848,7 @@ Print the dylib followed by the binaries which link to it for each library the k \fB\-\-cached\fR Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous \fBbrew linkage\fR run\. . -.SS "\fBman\fR \fIoptions\fR:" +.SS "\fBman\fR [\fIoptions\fR]:" Generate Homebrew\'s manpages\. . .TP @@ -866,7 +866,7 @@ Reuploads the stable URL for a formula to Bintray to use it as a mirror\. \fBprof\fR [\fIruby options\fR] Run Homebrew with the Ruby profiler\. For example: brew prof readall . -.SS "pull \fIoptions\fR \fIformula\fR:" +.SS "pull [\fIoptions\fR] \fIformula\fR:" Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\. . .P @@ -928,7 +928,7 @@ Publish at the given Bintray organisation\. \fB\-\-test\-bot\-user\fR Pull the bottle block commit from the specified user on GitHub\. . -.SS "\fBrelease\-notes\fR \fIprevious_tag\fR \fIend_ref\fR:" +.SS "\fBrelease\-notes\fR [\fIoptions\fR] [\fIprevious_tag\fR] [\fIend_ref\fR]:" Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. . .TP @@ -958,7 +958,7 @@ If \fB\-\-keep\-tmp\fR is passed, the temporary files created for the test are n .IP Example: \fBbrew install jruby && brew test jruby\fR . -.SS "\fBtests\fR \fIoptions\fR \fIformula\fR:" +.SS "\fBtests\fR [\fIoptions\fR]:" Run Homebrew\'s unit and integration tests\. If provided, \fB\-\-only=\fR\fItest_script\fR runs only \fItest_script\fR_spec\.rb, and \fB\-\-seed\fR randomizes tests with the provided value instead of a random seed\. . .TP @@ -985,7 +985,7 @@ Run only \fItest_script\fR_spec\.rb \fB\-\-seed\fR Randomizes tests with the provided value instead of a random seed\. . -.SS "\fBupdate\-test\fR \fIoptions\fR:" +.SS "\fBupdate\-test\fR [\fIoptions\fR]:" Runs a test of \fBbrew update\fR with a new repository clone\. . .P From f6081d6ab0724868e82845658bf6c76475062b22 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Wed, 3 Oct 2018 19:52:26 +0530 Subject: [PATCH 16/18] man: Update manpages --- docs/Manpage.md | 44 +++++++++------ manpages/brew.1 | 138 ++++++++++++++++++++++-------------------------- 2 files changed, 91 insertions(+), 91 deletions(-) diff --git a/docs/Manpage.md b/docs/Manpage.md index c8a5f34ad4..a676525aae 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -61,7 +61,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note the list is formatted for export to `bash`(1) unless `--plain` is passed. * `--prefix`: - Display Homebrew's install path. *Default:* `/usr/local` + Display Homebrew's install path. *Default:* `/usr/local` on macOS and `/home/linuxbrew/.linuxbrew` on Linux * `--prefix` `formula`: Display the location in the cellar where `formula` is or would be installed. @@ -479,16 +479,6 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note If `--env=std` is passed, use the standard `PATH` instead of superenv's. - * `shellenv`: - Prints export statements - run them in a shell and this installation of - Homebrew will be included into your PATH, MANPATH, and INFOPATH. - - HOMEBREW_PREFIX, HOMEBREW_CELLAR and HOMEBREW_REPOSITORY are also exported - to save multiple queries of those variables. - - Consider adding evaluating the output in your dotfiles (e.g. `~/.profile`) - with `eval $(brew shellenv)` - * `style` [`--fix`] [`--display-cop-names`] [`--only-cops=``cops`|`--except-cops=``cops`] [`files`|`taps`|`formulae`]: Check formulae or files for conformance to Homebrew style guidelines. @@ -604,7 +594,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note * `untap` `tap`: Remove a tapped repository. - * `upgrade` [`install-options`] [`--cleanup`] [`--fetch-HEAD`] [`--ignore-pinned`] [`formulae`]: + * `upgrade` [`install-options`] [`--cleanup`] [`--fetch-HEAD`] [`--ignore-pinned`] [`--display-times`] [`formulae`]: Upgrade outdated, unpinned brews (with existing install options). Options for the `install` command are also valid here. @@ -646,10 +636,20 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note cases where `formulae` is used by development or HEAD build, pass `--devel` or `--HEAD`. - * `update-reset`: - Fetches and resets Homebrew and all tap repositories using `git`(1) to - their latest `origin/master`. Note this will destroy all your uncommitted - or committed changes. + * `shellenv`: + Prints export statements - run them in a shell and this installation of + Homebrew will be included into your PATH, MANPATH, and INFOPATH. + + HOMEBREW_PREFIX, HOMEBREW_CELLAR and HOMEBREW_REPOSITORY are also exported + to save multiple queries of those variables. + + Consider adding evaluating the output in your dotfiles (e.g. `~/.profile`) + with `eval $(brew shellenv)` + + * `update-reset` [`repositories`]: + Fetches and resets Homebrew and all tap repositories (or the specified + `repositories`) using `git`(1) to their latest `origin/master`. Note this + will destroy all your uncommitted or committed changes. * `update` [`--merge`] [`--force`]: Fetch the newest version of Homebrew and all formulae from GitHub using @@ -794,6 +794,18 @@ Takes a tap [`user``/``repo`] as argument and generates the formula in the speci no `formula` is provided. + * `extract` [`--force`] `formula` `tap` [`--version=``version`]: + Looks through repository history to find the `version` of `formula` and + creates a copy in `tap`/Formula/`formula`@`version`.rb. If the tap is + not installed yet, attempts to install/clone the tap before continuing. + + If `--force` is passed, the file at the destination will be overwritten + if it already exists. Otherwise, existing files will be preserved. + + If an argument is passed through `--version`, `version` of `formula` + will be extracted and placed in the destination tap. Otherwise, the most + recent version that can be found will be used. + ###`formula` `formula`: Display the path where `formula` is located. diff --git a/manpages/brew.1 b/manpages/brew.1 index 1788e230b9..e94959da44 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -43,25 +43,20 @@ Perform a substring search of formula names for \fItext\fR\. If \fItext\fR is su . .SH "COMMANDS" . -.TP -\fB\-\-cache\fR -Display Homebrew\'s download cache\. See also \fBHOMEBREW_CACHE\fR\. +.IP "\(bu" 4 +\fB\-\-cache\fR: Display Homebrew\'s download cache\. See also \fBHOMEBREW_CACHE\fR\. . -.TP -\fB\-\-cache\fR [\fB\-\-build\-from\-source\fR|\fB\-s\fR] [\fB\-\-force\-bottle\fR] \fIformula\fR -Display the file or directory used to cache \fIformula\fR\. +.IP "\(bu" 4 +\fB\-\-cache\fR [\fB\-\-build\-from\-source\fR|\fB\-s\fR] [\fB\-\-force\-bottle\fR] \fIformula\fR: Display the file or directory used to cache \fIformula\fR\. . -.TP -\fB\-\-cellar\fR -Display Homebrew\'s Cellar path\. \fIDefault:\fR \fB$(brew \-\-prefix)/Cellar\fR, or if that directory doesn\'t exist, \fB$(brew \-\-repository)/Cellar\fR\. +.IP "\(bu" 4 +\fB\-\-cellar\fR: Display Homebrew\'s Cellar path\. \fIDefault:\fR \fB$(brew \-\-prefix)/Cellar\fR, or if that directory doesn\'t exist, \fB$(brew \-\-repository)/Cellar\fR\. . -.TP -\fB\-\-cellar\fR \fIformula\fR -Display the location in the cellar where \fIformula\fR would be installed, without any sort of versioned directory as the last path\. +.IP "\(bu" 4 +\fB\-\-cellar\fR \fIformula\fR: Display the location in the cellar where \fIformula\fR would be installed, without any sort of versioned directory as the last path\. . -.TP -\fB\-\-env\fR [\fB\-\-shell=\fR(\fIshell\fR|\fBauto\fR)|\fB\-\-plain\fR] -Show a summary of the Homebrew build environment as a plain list\. +.IP "\(bu" 4 +\fB\-\-env\fR [\fB\-\-shell=\fR(\fIshell\fR|\fBauto\fR)|\fB\-\-plain\fR]: Show a summary of the Homebrew build environment as a plain list\. . .IP Pass \fB\-\-shell=\fR\fIshell\fR to generate a list of environment variables for the specified shell, or \fB\-\-shell=auto\fR to detect the current shell\. @@ -69,29 +64,23 @@ Pass \fB\-\-shell=\fR\fIshell\fR to generate a list of environment variables for .IP If the command\'s output is sent through a pipe and no shell is specified, the list is formatted for export to \fBbash\fR(1) unless \fB\-\-plain\fR is passed\. . -.TP -\fB\-\-prefix\fR -Display Homebrew\'s install path\. \fIDefault:\fR \fB/usr/local\fR +.IP "\(bu" 4 +\fB\-\-prefix\fR: Display Homebrew\'s install path\. \fIDefault:\fR \fB/usr/local\fR on macOS and \fB/home/linuxbrew/\.linuxbrew\fR on Linux . -.TP -\fB\-\-prefix\fR \fIformula\fR -Display the location in the cellar where \fIformula\fR is or would be installed\. +.IP "\(bu" 4 +\fB\-\-prefix\fR \fIformula\fR: Display the location in the cellar where \fIformula\fR is or would be installed\. . -.TP -\fB\-\-repository\fR -Display where Homebrew\'s \fB\.git\fR directory is located\. +.IP "\(bu" 4 +\fB\-\-repository\fR: Display where Homebrew\'s \fB\.git\fR directory is located\. . -.TP -\fB\-\-repository\fR \fIuser\fR\fB/\fR\fIrepo\fR -Display where tap \fIuser\fR\fB/\fR\fIrepo\fR\'s directory is located\. +.IP "\(bu" 4 +\fB\-\-repository\fR \fIuser\fR\fB/\fR\fIrepo\fR: Display where tap \fIuser\fR\fB/\fR\fIrepo\fR\'s directory is located\. . -.TP -\fB\-\-version\fR -Print the version number of Homebrew to standard output and exit\. +.IP "\(bu" 4 +\fB\-\-version\fR: Print the version number of Homebrew to standard output and exit\. . -.TP -\fBanalytics\fR [\fBstate\fR] -Display anonymous user behaviour analytics state\. Read more at \fIhttps://docs\.brew\.sh/Analytics\fR\. +.IP "\(bu" 4 +\fBanalytics\fR [\fBstate\fR]: Display anonymous user behaviour analytics state\. Read more at \fIhttps://docs\.brew\.sh/Analytics\fR\. . .IP "\(bu" 4 \fBanalytics\fR (\fBon\fR|\fBoff\fR): Turn on/off Homebrew\'s analytics\. @@ -451,15 +440,6 @@ If \fB\-\-desc\fR is passed, search formulae with a description matching \fItext If \fB\-\-env=std\fR is passed, use the standard \fBPATH\fR instead of superenv\'s\. . .IP "\(bu" 4 -\fBshellenv\fR: Prints export statements \- run them in a shell and this installation of Homebrew will be included into your PATH, MANPATH, and INFOPATH\. -. -.IP -HOMEBREW_PREFIX, HOMEBREW_CELLAR and HOMEBREW_REPOSITORY are also exported to save multiple queries of those variables\. -. -.IP -Consider adding evaluating the output in your dotfiles (e\.g\. \fB~/\.profile\fR) with \fBeval $(brew shellenv)\fR -. -.IP "\(bu" 4 \fBstyle\fR [\fB\-\-fix\fR] [\fB\-\-display\-cop\-names\fR] [\fB\-\-only\-cops=\fR\fIcops\fR|\fB\-\-except\-cops=\fR\fIcops\fR] [\fIfiles\fR|\fItaps\fR|\fIformulae\fR]: Check formulae or files for conformance to Homebrew style guidelines\. . .IP @@ -480,20 +460,17 @@ Exits with a non\-zero status if any style violations are found\. .IP "\(bu" 4 \fBswitch\fR \fIformula\fR \fIversion\fR: Symlink all of the specific \fIversion\fR of \fIformula\fR\'s install to Homebrew prefix\. . -.TP -\fBtap\-info\fR -Display a brief summary of all installed taps\. +.IP "\(bu" 4 +\fBtap\-info\fR: Display a brief summary of all installed taps\. . -.TP -\fBtap\-info\fR (\fB\-\-installed\fR|\fItaps\fR) -Display detailed information about one or more \fItaps\fR\. +.IP "\(bu" 4 +\fBtap\-info\fR (\fB\-\-installed\fR|\fItaps\fR): Display detailed information about one or more \fItaps\fR\. . .IP Pass \fB\-\-installed\fR to display information on all installed taps\. . -.TP -\fBtap\-info\fR \fB\-\-json=\fR\fIversion\fR (\fB\-\-installed\fR|\fItaps\fR) -Print a JSON representation of \fItaps\fR\. Currently the only accepted value for \fIversion\fR is \fBv1\fR\. +.IP "\(bu" 4 +\fBtap\-info\fR \fB\-\-json=\fR\fIversion\fR (\fB\-\-installed\fR|\fItaps\fR): Print a JSON representation of \fItaps\fR\. Currently the only accepted value for \fIversion\fR is \fBv1\fR\. . .IP Pass \fB\-\-installed\fR to get information on installed taps\. @@ -501,17 +478,14 @@ Pass \fB\-\-installed\fR to get information on installed taps\. .IP See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR . -.TP -\fBtap\-pin\fR \fItap\fR -Pin \fItap\fR, prioritizing its formulae over core when formula names are supplied by the user\. See also \fBtap\-unpin\fR\. +.IP "\(bu" 4 +\fBtap\-pin\fR \fItap\fR: Pin \fItap\fR, prioritizing its formulae over core when formula names are supplied by the user\. See also \fBtap\-unpin\fR\. . -.TP -\fBtap\-unpin\fR \fItap\fR -Unpin \fItap\fR so its formulae are no longer prioritized\. See also \fBtap\-pin\fR\. +.IP "\(bu" 4 +\fBtap\-unpin\fR \fItap\fR: Unpin \fItap\fR so its formulae are no longer prioritized\. See also \fBtap\-pin\fR\. . -.TP -\fBtap\fR -List all installed taps\. +.IP "\(bu" 4 +\fBtap\fR: List all installed taps\. . .IP "\(bu" 4 \fBtap\fR [\fB\-\-full\fR] [\fB\-\-force\-auto\-update\fR] \fIuser\fR\fB/\fR\fIrepo\fR [\fIURL\fR]: Tap a formula repository\. @@ -537,9 +511,8 @@ By default, only taps hosted on GitHub are auto\-updated (for performance reason .IP "\(bu" 4 \fBtap\fR \fB\-\-list\-pinned\fR: List all pinned taps\. . -.TP -\fBuninstall\fR, \fBrm\fR, \fBremove\fR [\fB\-\-force\fR] [\fB\-\-ignore\-dependencies\fR] \fIformula\fR -Uninstall \fIformula\fR\. +.IP "\(bu" 4 +\fBuninstall\fR, \fBrm\fR, \fBremove\fR [\fB\-\-force\fR] [\fB\-\-ignore\-dependencies\fR] \fIformula\fR: Uninstall \fIformula\fR\. . .IP If \fB\-\-force\fR (or \fB\-f\fR) is passed, and there are multiple versions of \fIformula\fR installed, delete all installed versions\. @@ -568,9 +541,8 @@ If \fB\-\-git\fR (or \fB\-g\fR) is passed, a Git repository will be initialized .IP "\(bu" 4 \fBuntap\fR \fItap\fR: Remove a tapped repository\. . -.TP -\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fIformulae\fR] -Upgrade outdated, unpinned brews (with existing install options)\. +.IP "\(bu" 4 +\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fB\-\-display\-times\fR] [\fIformulae\fR]: Upgrade outdated, unpinned brews (with existing install options)\. . .IP Options for the \fBinstall\fR command are also valid here\. @@ -605,13 +577,20 @@ By default, \fBuses\fR shows all formulae that specify \fIformulae\fR as a requi .IP By default, \fBuses\fR shows usage of \fIformulae\fR by stable builds\. To find cases where \fIformulae\fR is used by development or HEAD build, pass \fB\-\-devel\fR or \fB\-\-HEAD\fR\. . -.TP -\fBupdate\-reset\fR -Fetches and resets Homebrew and all tap repositories using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\. +.IP "\(bu" 4 +\fBshellenv\fR: Prints export statements \- run them in a shell and this installation of Homebrew will be included into your PATH, MANPATH, and INFOPATH\. . -.TP -\fBupdate\fR [\fB\-\-merge\fR] [\fB\-\-force\fR] -Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1) and perform any necessary migrations\. +.IP +HOMEBREW_PREFIX, HOMEBREW_CELLAR and HOMEBREW_REPOSITORY are also exported to save multiple queries of those variables\. +. +.IP +Consider adding evaluating the output in your dotfiles (e\.g\. \fB~/\.profile\fR) with \fBeval $(brew shellenv)\fR +. +.IP "\(bu" 4 +\fBupdate\-reset\fR [\fIrepositories\fR]: Fetches and resets Homebrew and all tap repositories (or the specified \fBrepositories\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\. +. +.IP "\(bu" 4 +\fBupdate\fR [\fB\-\-merge\fR] [\fB\-\-force\fR]: Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1) and perform any necessary migrations\. . .IP If \fB\-\-merge\fR is specified then \fBgit merge\fR is used to include updates (rather than \fBgit rebase\fR)\. @@ -619,6 +598,8 @@ If \fB\-\-merge\fR is specified then \fBgit merge\fR is used to include updates .IP If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full update check even if unnecessary\. . +.IP "" 0 +. .SH "DEVELOPER COMMANDS" . .SS "\fBaudit\fR [\fIoptions\fR] \fIformulae\fR:" @@ -723,9 +704,6 @@ If a \fItag\fR is specified, the git commit \fIrevision\fR corresponding to that .P Note that this command cannot be used to transition a formula from a URL\-and\-sha256 style specification into a tag\-and\-revision style specification, nor vice versa\. It must use whichever style specification the preexisting formula already uses\. . -.IP -If \fB\-\-json\fR is passed, write bottle information to a JSON file, which can be used as the argument for \fB\-\-merge\fR\. -. .TP \fB\-\-devel\fR Bump the development rather than stable version\. The development spec must already exist\. @@ -816,6 +794,16 @@ Takes a tap [\fIuser\fR\fB/\fR\fIrepo\fR] as argument and generates the formula .SS "\fBedit\fR \fIformula\fR:" Open \fIformula\fR in the editor\. Open all of Homebrew for editing if no \fIformula\fR is provided\. . +.TP +\fBextract\fR [\fB\-\-force\fR] \fIformula\fR \fItap\fR [\fB\-\-version=\fR\fIversion\fR] +Looks through repository history to find the \fIversion\fR of \fIformula\fR and creates a copy in \fItap\fR/Formula/\fIformula\fR@\fIversion\fR\.rb\. If the tap is not installed yet, attempts to install/clone the tap before continuing\. +. +.IP +If \fB\-\-force\fR is passed, the file at the destination will be overwritten if it already exists\. Otherwise, existing files will be preserved\. +. +.IP +If an argument is passed through \fB\-\-version\fR, \fIversion\fR of \fIformula\fR will be extracted and placed in the destination tap\. Otherwise, the most recent version that can be found will be used\. +. .SS "\fBformula\fR \fIformula\fR:" Display the path where \fIformula\fR is located\. . From 38feaf12709d122c49d3d145c07c4d920df42d85 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Wed, 3 Oct 2018 20:16:05 +0530 Subject: [PATCH 17/18] extract: Add option descriptions --- Library/Homebrew/dev-cmd/extract.rb | 20 +++++++++++++++++--- Library/Homebrew/dev-cmd/man.rb | 1 + docs/Manpage.md | 15 ++++++--------- manpages/brew.1 | 11 ++++------- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/Library/Homebrew/dev-cmd/extract.rb b/Library/Homebrew/dev-cmd/extract.rb index cce25a171e..7f3c89ac67 100644 --- a/Library/Homebrew/dev-cmd/extract.rb +++ b/Library/Homebrew/dev-cmd/extract.rb @@ -96,12 +96,26 @@ end module Homebrew module_function - def extract - Homebrew::CLI::Parser.parse do - flag "--version=" + def extract_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `extract` [] + + Looks through repository history to find the of and + creates a copy in /Formula/@.rb. If the tap is + not installed yet, attempts to install/clone the tap before continuing. + EOS + + flag "--version=", + description: "Provided of will be extracted and placed in the destination "\ + "tap. Otherwise, the most recent version that can be found will be used." switch :debug switch :force end + end + + def extract + extract_args.parse # Expect exactly two named arguments: formula and tap raise UsageError if ARGV.named.length != 2 diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 84f38ceaf0..0cad8e98a5 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -21,6 +21,7 @@ require "dev-cmd/irb" require "dev-cmd/linkage" require "dev-cmd/mirror" require "dev-cmd/pull" +require "dev-cmd/extract" require "dev-cmd/release-notes" require "dev-cmd/tap-new" require "dev-cmd/tests" diff --git a/docs/Manpage.md b/docs/Manpage.md index a676525aae..dea38a6dfb 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -794,17 +794,14 @@ Takes a tap [`user``/``repo`] as argument and generates the formula in the speci no `formula` is provided. - * `extract` [`--force`] `formula` `tap` [`--version=``version`]: - Looks through repository history to find the `version` of `formula` and - creates a copy in `tap`/Formula/`formula`@`version`.rb. If the tap is - not installed yet, attempts to install/clone the tap before continuing. +###`extract` [`options`] `formula` `tap` - If `--force` is passed, the file at the destination will be overwritten - if it already exists. Otherwise, existing files will be preserved. +Looks through repository history to find the `version` of `formula` and +creates a copy in `tap`/Formula/`formula`@`version`.rb. If the tap is +not installed yet, attempts to install/clone the tap before continuing. - If an argument is passed through `--version`, `version` of `formula` - will be extracted and placed in the destination tap. Otherwise, the most - recent version that can be found will be used. +* `--version`: +Provided `version` of `formula` will be extracted and placed in the destination tap. Otherwise, the most recent version that can be found will be used. ###`formula` `formula`: diff --git a/manpages/brew.1 b/manpages/brew.1 index e94959da44..6b543aab3c 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -794,15 +794,12 @@ Takes a tap [\fIuser\fR\fB/\fR\fIrepo\fR] as argument and generates the formula .SS "\fBedit\fR \fIformula\fR:" Open \fIformula\fR in the editor\. Open all of Homebrew for editing if no \fIformula\fR is provided\. . -.TP -\fBextract\fR [\fB\-\-force\fR] \fIformula\fR \fItap\fR [\fB\-\-version=\fR\fIversion\fR] +.SS "\fBextract\fR [\fIoptions\fR] \fIformula\fR \fItap\fR" Looks through repository history to find the \fIversion\fR of \fIformula\fR and creates a copy in \fItap\fR/Formula/\fIformula\fR@\fIversion\fR\.rb\. If the tap is not installed yet, attempts to install/clone the tap before continuing\. . -.IP -If \fB\-\-force\fR is passed, the file at the destination will be overwritten if it already exists\. Otherwise, existing files will be preserved\. -. -.IP -If an argument is passed through \fB\-\-version\fR, \fIversion\fR of \fIformula\fR will be extracted and placed in the destination tap\. Otherwise, the most recent version that can be found will be used\. +.TP +\fB\-\-version\fR +Provided \fIversion\fR of \fIformula\fR will be extracted and placed in the destination tap\. Otherwise, the most recent version that can be found will be used\. . .SS "\fBformula\fR \fIformula\fR:" Display the path where \fIformula\fR is located\. From b5b988cbb14e021999885d3bb4e6b05467c0c1d2 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Wed, 3 Oct 2018 21:12:44 +0530 Subject: [PATCH 18/18] help_spec: fix and generate help text in help.rb --- Library/Homebrew/cli_parser.rb | 14 +++++++++----- Library/Homebrew/help.rb | 16 ++++++++-------- Library/Homebrew/test/cmd/help_spec.rb | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index 0de33a37e7..17b21cdca7 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -35,11 +35,8 @@ module Homebrew def post_initialize @parser.on_tail("-h", "--help", "Show this message") do - puts @parser.to_s.sub(/^/, "#{Tty.bold}Usage: brew#{Tty.reset} ") - .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}") - .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } - .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}") - exit + puts generate_help_text + exit 0 end end @@ -128,6 +125,13 @@ module Homebrew Homebrew::CLI::Parser.global_options.key?(name.to_sym) end + def generate_help_text + @parser.to_s.sub(/^/, "#{Tty.bold}Usage: brew#{Tty.reset} ") + .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}") + .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } + .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}") + end + private def enable_switch(*names) diff --git a/Library/Homebrew/help.rb b/Library/Homebrew/help.rb index a73ad81981..d541081c8d 100644 --- a/Library/Homebrew/help.rb +++ b/Library/Homebrew/help.rb @@ -38,14 +38,6 @@ module Homebrew module_function def help(cmd = nil, flags = {}) - # Let OptionParser generate help text for commands which have a parser defined - begin - Homebrew.send("#{cmd.tr("-", "_")}_args".to_sym) - return - rescue NoMethodError - nil - end - # Resolve command aliases and find file containing the implementation. if cmd cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd) @@ -83,6 +75,14 @@ module Homebrew end def command_help(path) + # Let OptionParser generate help text for commands which have a parser defined + begin + cmd = path.basename(path.extname) + return Homebrew.send("#{cmd.to_s.tr("-", "_")}_args".to_sym).generate_help_text + rescue NoMethodError + nil + end + help_lines = command_help_lines(path) if help_lines.empty? opoo "No help text in: #{path}" if ARGV.homebrew_developer? diff --git a/Library/Homebrew/test/cmd/help_spec.rb b/Library/Homebrew/test/cmd/help_spec.rb index 6d94d7444c..e3460dec0f 100644 --- a/Library/Homebrew/test/cmd/help_spec.rb +++ b/Library/Homebrew/test/cmd/help_spec.rb @@ -26,7 +26,7 @@ describe "brew", :integration_test do it "prints help for a documented Ruby developer command" do expect { brew "help", "update-test" } - .to output(/^brew update-test/).to_stdout + .to output(/^Usage: brew update-test/).to_stdout .and be_a_success end