-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13844 from troymccabe/feature/13834-brew-docs-cmd
Adds `brew docs` to close #13834
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# typed: true | ||
# frozen_string_literal: true | ||
|
||
require "cli/parser" | ||
|
||
module Homebrew | ||
extend T::Sig | ||
|
||
module_function | ||
|
||
sig { returns(CLI::Parser) } | ||
def docs_args | ||
Homebrew::CLI::Parser.new do | ||
description <<~EOS | ||
Open Homebrew's online documentation (#{HOMEBREW_DOCS_WWW}) in a browser. | ||
EOS | ||
end | ||
end | ||
|
||
sig { void } | ||
def docs | ||
exec_browser HOMEBREW_DOCS_WWW | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
describe "brew docs" do | ||
it "opens the docs page", :integration_test do | ||
expect { brew "docs", "HOMEBREW_BROWSER" => "echo" } | ||
.to output("https://docs.brew.sh\n").to_stdout | ||
.and not_to_output.to_stderr | ||
.and be_a_success | ||
end | ||
end |