Class: Guard::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/guard/cli.rb

Overview

Facade for the Guard command line interface managed by [Thor](github.com/wycats/thor). This is the main interface to Guard that is called by the Guard binary ‘bin/guard`. Do not put any logic in here, create a class and delegate instead.

Instance Method Summary collapse

Instance Method Details

#init(guard_name = nil) ⇒ Object

Appends the Guard template to the ‘Guardfile`, or creates an initial `Guardfile` when no Guard name is passed.

Parameters:

  • guard_name (String) (defaults to: nil)

    the name of the Guard to initialize

See Also:



108
109
110
# File 'lib/guard/cli.rb', line 108

def init(guard_name = nil)
  ::Guard.initialize_template(guard_name)
end

#listObject

List the Guards that are available for use in your system and marks those that are currently used in your ‘Guardfile`.

See Also:



84
85
86
# File 'lib/guard/cli.rb', line 84

def list
  ::Guard::DslDescriber.list(options)
end

#showObject

Shows all Guards and their options that are defined in the ‘Guardfile`.

See Also:



120
121
122
# File 'lib/guard/cli.rb', line 120

def show
  ::Guard::DslDescriber.show(options)
end

#startObject

Start Guard by initialize the defined Guards and watch the file system. This is the default task, so calling ‘guard` is the same as calling `guard start`.

See Also:



73
74
75
# File 'lib/guard/cli.rb', line 73

def start
  ::Guard.start(options)
end

#versionObject

Shows the current version of Guard.

See Also:



95
96
97
# File 'lib/guard/cli.rb', line 95

def version
  ::Guard::UI.info "Guard version #{ Guard::VERSION }"
end