Port Homebrew::Cmd::Docs
This commit is contained in:
parent
bde44cfc99
commit
67fd065e1d
@ -1,22 +1,21 @@
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cli/parser"
|
||||
require "abstract_command"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
module Cmd
|
||||
class Docs < AbstractCommand
|
||||
cmd_args do
|
||||
description <<~EOS
|
||||
Open Homebrew's online documentation at <#{HOMEBREW_DOCS_WWW}> in a browser.
|
||||
EOS
|
||||
end
|
||||
|
||||
sig { returns(CLI::Parser) }
|
||||
def docs_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
description <<~EOS
|
||||
Open Homebrew's online documentation at <#{HOMEBREW_DOCS_WWW}> in a browser.
|
||||
EOS
|
||||
sig { override.void }
|
||||
def run
|
||||
exec_browser HOMEBREW_DOCS_WWW
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
sig { void }
|
||||
def docs
|
||||
exec_browser HOMEBREW_DOCS_WWW
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "brew docs" do
|
||||
require "cmd/docs"
|
||||
require "cmd/shared_examples/args_parse"
|
||||
|
||||
RSpec.describe Homebrew::Cmd::Docs do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
it "opens the docs page", :integration_test do
|
||||
expect { brew "docs", "HOMEBREW_BROWSER" => "echo" }
|
||||
.to output("https://docs.brew.sh\n").to_stdout
|
||||
|
Loading…
x
Reference in New Issue
Block a user