Skip to content

Commit

Permalink
Merge pull request #9424 from EricFromCanada/flag-replacement
Browse files Browse the repository at this point in the history
pr-pull: prepare replacement for --workflow flag
  • Loading branch information
MikeMcQuaid committed Dec 14, 2020
2 parents 77561fc + 9dec442 commit 1a52862
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
9 changes: 7 additions & 2 deletions Library/Homebrew/cli/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,21 @@ def comma_array(name, description: nil)
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? "=" }
OptionParser::REQUIRED_ARGUMENT
else
OptionParser::OPTIONAL_ARGUMENT
end
names.map! { |name| name.chomp "=" }
description = option_to_description(*names) if description.nil?
process_option(*names, description)
if replacement.nil?
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|
odisabled "the `#{names.first}` flag", replacement unless replacement.nil?
names.each do |name|
@args[option_to_name(name)] = option_value
end
Expand Down
4 changes: 3 additions & 1 deletion Library/Homebrew/dev-cmd/pr-pull.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def pr_pull_args
description: "Message to include when autosquashing revision bumps, deletions, and rebuilds."
flag "--workflow=",
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=",
description: "Download artifacts with the specified name (default: `bottles`)."
flag "--bintray-org=",
Expand Down
2 changes: 1 addition & 1 deletion docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ Requires write access to the repository.
* `--message`:
Message to include when autosquashing revision bumps, deletions, and rebuilds.
* `--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`:
Download artifacts with the specified name (default: `bottles`).
* `--bintray-org`:
Expand Down
2 changes: 1 addition & 1 deletion manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ Message to include when autosquashing revision bumps, deletions, and rebuilds\.
.
.TP
\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
\fB\-\-artifact\fR
Expand Down

0 comments on commit 1a52862

Please sign in to comment.