Document Cask::Cmd.

This commit is contained in:
Markus Reiter 2020-08-19 10:34:07 +02:00
parent 5426e47579
commit 8fc4ac0ad7
23 changed files with 73 additions and 0 deletions

View File

@ -33,6 +33,9 @@ require "cask/cmd/internal_help"
require "cask/cmd/internal_stanza" require "cask/cmd/internal_stanza"
module Cask module Cask
# Implementation of the `brew cask` command-line interface.
#
# @api private
class Cmd class Cmd
include Context include Context
@ -240,6 +243,7 @@ module Cask
exit 1 exit 1
end end
# Wrapper class for running an external Ruby command.
class ExternalRubyCommand class ExternalRubyCommand
def initialize(command, path) def initialize(command, path)
@command_name = command.to_s.capitalize.to_sym @command_name = command.to_s.capitalize.to_sym
@ -269,6 +273,7 @@ module Cask
end end
end end
# Wrapper class for running an external command.
class ExternalCommand class ExternalCommand
def initialize(path) def initialize(path)
@path = path @path = path
@ -283,6 +288,7 @@ module Cask
end end
end end
# Helper class for showing help for unknown subcommands.
class UnknownSubcommand class UnknownSubcommand
def initialize(command_name) def initialize(command_name)
@command_name = command_name @command_name = command_name
@ -297,6 +303,7 @@ module Cask
end end
end end
# Helper class for showing help when no subcommand is given.
class NullCommand class NullCommand
def self.run(*) def self.run(*)
raise UsageError, "No subcommand given." raise UsageError, "No subcommand given."

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask --cache` command.
#
# @api private
class Cache < AbstractCommand class Cache < AbstractCommand
def self.min_named def self.min_named
:cask :cask

View File

@ -4,6 +4,9 @@ require "search"
module Cask module Cask
class Cmd class Cmd
# Abstract superclass for all `brew cask` commands.
#
# @api private
class AbstractCommand class AbstractCommand
include Homebrew::Search include Homebrew::Search

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Abstract superclass for all internal `brew cask` commands.
#
# @api private
class AbstractInternalCommand < AbstractCommand class AbstractInternalCommand < AbstractCommand
def self.command_name def self.command_name
super.sub(/^internal_/i, "_") super.sub(/^internal_/i, "_")

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask audit` command.
#
# @api private
class Audit < AbstractCommand class Audit < AbstractCommand
def self.description def self.description
<<~EOS <<~EOS

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask cat` command.
#
# @api private
class Cat < AbstractCommand class Cat < AbstractCommand
def self.min_named def self.min_named
:cask :cask

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask create` command.
#
# @api private
class Create < AbstractCommand class Create < AbstractCommand
def self.min_named def self.min_named
:cask :cask

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask doctor` command.
#
# @api private
class Doctor < AbstractCommand class Doctor < AbstractCommand
def self.max_named def self.max_named
0 0

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask edit` command.
#
# @api private
class Edit < AbstractCommand class Edit < AbstractCommand
def self.min_named def self.min_named
:cask :cask

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask fetch` command.
#
# @api private
class Fetch < AbstractCommand class Fetch < AbstractCommand
def self.min_named def self.min_named
:cask :cask

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask help` command.
#
# @api private
class Help < AbstractCommand class Help < AbstractCommand
def self.max_named def self.max_named
1 1

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask home` command.
#
# @api private
class Home < AbstractCommand class Home < AbstractCommand
def self.description def self.description
"Opens the homepage of the given <cask>. If no cask is given, opens the Homebrew homepage." "Opens the homepage of the given <cask>. If no cask is given, opens the Homebrew homepage."

View File

@ -4,6 +4,9 @@ require "json"
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask info` command.
#
# @api private
class Info < AbstractCommand class Info < AbstractCommand
def self.min_named def self.min_named
:cask :cask

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask install` command.
#
# @api private
class Install < AbstractCommand class Install < AbstractCommand
def self.min_named def self.min_named
:cask :cask

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask _help` command.
#
# @api private
class InternalHelp < AbstractInternalCommand class InternalHelp < AbstractInternalCommand
def self.max_named def self.max_named
0 0

View File

@ -4,6 +4,9 @@ require "cask/dsl"
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask _stanza` command.
#
# @api private
class InternalStanza < AbstractInternalCommand class InternalStanza < AbstractInternalCommand
# Syntax # Syntax
# #

View File

@ -4,6 +4,9 @@ require "cask/artifact/relocated"
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask list` command.
#
# @api private
class List < AbstractCommand class List < AbstractCommand
def self.description def self.description
"Lists installed casks or the casks provided in the arguments." "Lists installed casks or the casks provided in the arguments."

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask outdated` command.
#
# @api private
class Outdated < AbstractCommand class Outdated < AbstractCommand
def self.description def self.description
"List the outdated installed casks." "List the outdated installed casks."

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask reinstall` command.
#
# @api private
class Reinstall < Install class Reinstall < Install
def self.description def self.description
"Reinstalls the given <cask>." "Reinstalls the given <cask>."

View File

@ -4,6 +4,9 @@ require "json"
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask style` command.
#
# @api private
class Style < AbstractCommand class Style < AbstractCommand
def self.description def self.description
"Checks style of the given <cask> using RuboCop." "Checks style of the given <cask> using RuboCop."

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask uninstall` command.
#
# @api private
class Uninstall < AbstractCommand class Uninstall < AbstractCommand
def self.min_named def self.min_named
:cask :cask

View File

@ -5,6 +5,9 @@ require "cask/config"
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask upgrade` command.
#
# @api private
class Upgrade < AbstractCommand class Upgrade < AbstractCommand
def self.description def self.description
"Upgrades all outdated casks or the specified casks." "Upgrades all outdated casks or the specified casks."

View File

@ -2,6 +2,9 @@
module Cask module Cask
class Cmd class Cmd
# Implementation of the `brew cask zap` command.
#
# @api private
class Zap < AbstractCommand class Zap < AbstractCommand
def self.min_named def self.min_named
:cask :cask