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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,6 +2,9 @@
module Cask
class Cmd
# Implementation of the `brew cask home` command.
#
# @api private
class Home < AbstractCommand
def self.description
"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
class Cmd
# Implementation of the `brew cask info` command.
#
# @api private
class Info < AbstractCommand
def self.min_named
:cask

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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