Port Homebrew::DevCmd::StyleCmd
This commit is contained in:
parent
1436b06e90
commit
0d04f198d2
@ -1,17 +1,16 @@
|
||||
# typed: true
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "abstract_command"
|
||||
require "json"
|
||||
require "open3"
|
||||
require "style"
|
||||
require "cli/parser"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
sig { returns(CLI::Parser) }
|
||||
def style_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
module DevCmd
|
||||
class StyleCmd < AbstractCommand
|
||||
cmd_args do
|
||||
description <<~EOS
|
||||
Check formulae or files for conformance to Homebrew style guidelines.
|
||||
|
||||
@ -42,11 +41,9 @@ module Homebrew
|
||||
|
||||
named_args [:file, :tap, :formula, :cask], without_api: true
|
||||
end
|
||||
end
|
||||
|
||||
def style
|
||||
args = style_args.parse
|
||||
|
||||
sig { override.void }
|
||||
def run
|
||||
target = if args.no_named?
|
||||
nil
|
||||
else
|
||||
@ -72,4 +69,6 @@ module Homebrew
|
||||
|
||||
Homebrew.failed = !Style.check_style_and_print(target, **options)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cmd/shared_examples/args_parse"
|
||||
require "dev-cmd/style"
|
||||
|
||||
RSpec.describe "brew style" do
|
||||
RSpec.describe Homebrew::DevCmd::StyleCmd do
|
||||
it_behaves_like "parseable arguments"
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user