pr-pull: prepare replacement for --workflow flag

This commit is contained in:
EricFromCanada 2020-12-04 11:39:02 -05:00
parent a6800dc853
commit 9dec442e71
4 changed files with 12 additions and 5 deletions

View File

@ -194,7 +194,7 @@ module Homebrew
end end
end end
def flag(*names, description: nil, required_for: nil, depends_on: nil) def flag(*names, description: nil, replacement: nil, required_for: nil, depends_on: nil)
required = if names.any? { |name| name.end_with? "=" } required = if names.any? { |name| name.end_with? "=" }
OptionParser::REQUIRED_ARGUMENT OptionParser::REQUIRED_ARGUMENT
else else
@ -202,8 +202,13 @@ module Homebrew
end end
names.map! { |name| name.chomp "=" } names.map! { |name| name.chomp "=" }
description = option_to_description(*names) if description.nil? description = option_to_description(*names) if description.nil?
if replacement.nil?
process_option(*names, description) process_option(*names, description)
else
description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})"
end
@parser.on(*names, *wrap_option_desc(description), required) do |option_value| @parser.on(*names, *wrap_option_desc(description), required) do |option_value|
odisabled "the `#{names.first}` flag", replacement unless replacement.nil?
names.each do |name| names.each do |name|
@args[option_to_name(name)] = option_value @args[option_to_name(name)] = option_value
end end

View File

@ -51,7 +51,9 @@ module Homebrew
description: "Message to include when autosquashing revision bumps, deletions, and rebuilds." description: "Message to include when autosquashing revision bumps, deletions, and rebuilds."
flag "--workflow=", flag "--workflow=",
description: "Retrieve artifacts from the specified workflow (default: `tests.yml`). "\ description: "Retrieve artifacts from the specified workflow (default: `tests.yml`). "\
"Legacy: use --workflows instead" "*Legacy:* use `--workflows` instead."
# TODO: enable for next major/minor release
# replacement: "`--workflows`"
flag "--artifact=", flag "--artifact=",
description: "Download artifacts with the specified name (default: `bottles`)." description: "Download artifacts with the specified name (default: `bottles`)."
flag "--bintray-org=", flag "--bintray-org=",

View File

@ -1141,7 +1141,7 @@ Requires write access to the repository.
* `--message`: * `--message`:
Message to include when autosquashing revision bumps, deletions, and rebuilds. Message to include when autosquashing revision bumps, deletions, and rebuilds.
* `--workflow`: * `--workflow`:
Retrieve artifacts from the specified workflow (default: `tests.yml`). Legacy: use --workflows instead Retrieve artifacts from the specified workflow (default: `tests.yml`). *Legacy:* use `--workflows` instead.
* `--artifact`: * `--artifact`:
Download artifacts with the specified name (default: `bottles`). Download artifacts with the specified name (default: `bottles`).
* `--bintray-org`: * `--bintray-org`:

View File

@ -1589,7 +1589,7 @@ Message to include when autosquashing revision bumps, deletions, and rebuilds\.
. .
.TP .TP
\fB\-\-workflow\fR \fB\-\-workflow\fR
Retrieve artifacts from the specified workflow (default: \fBtests\.yml\fR)\. Legacy: use \-\-workflows instead Retrieve artifacts from the specified workflow (default: \fBtests\.yml\fR)\. \fILegacy:\fR use \fB\-\-workflows\fR instead\.
. .
.TP .TP
\fB\-\-artifact\fR \fB\-\-artifact\fR