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