class Guard::CLI
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.
Public Class Methods
# File lib/guard/cli.rb, line 99 def self.help(shell, subcommand = false) super command_help(shell, default_task) end
Public Instance Methods
Initializes the templates of all installed Guard plugins and adds them to the `Guardfile` when no Guard name is passed. When passing Guard plugin names it does the same but only for those Guard plugins.
@see Guard::Guardfile.initialize_template @see Guard::Guardfile.initialize_all_templates
@param [Array<String>] plugin_names the name of the Guard plugins to initialize
# File lib/guard/cli.rb, line 181 def init(*plugin_names) env = Cli::Environments::Valid.new(options) exitcode = env.initialize_guardfile(plugin_names) exit(exitcode) end
List the Guard plugins that are available for use in your system and marks those that are currently used in your `Guardfile`.
# File lib/guard/cli.rb, line 132 def list Cli::Environments::EvaluateOnly.new(options).evaluate DslDescriber.new.list end
List the Notifiers for use in your system.
@see Guard::DslDescriber#notifiers
# File lib/guard/cli.rb, line 143 def notifiers Cli::Environments::EvaluateOnly.new(options).evaluate # TODO: pass the data directly to the notifiers? DslDescriber.new.notifiers end
Shows all Guard plugins and their options that are defined in the `Guardfile`
# File lib/guard/cli.rb, line 195 def show Cli::Environments::EvaluateOnly.new(options).evaluate DslDescriber.new.show end
Start Guard by initializing the defined Guard plugins and watch the file system.
This is the default task, so calling `guard` is the same as calling `guard start`.
@see Guard.start
# File lib/guard/cli.rb, line 112 def start if defined?(JRUBY_VERSION) unless options[:no_interactions] abort "\nSorry, JRuby and interactive mode are incompatible.\n" "As a workaround, use the '-i' option instead.\n\n" "More info: \n" " * https://github.com/guard/guard/issues/754\n" " * https://github.com/jruby/jruby/issues/2383\n\n" end end exit(Cli::Environments::Valid.new(options).start_guard) end
Shows the current version of Guard.
@see Guard::VERSION
# File lib/guard/cli.rb, line 156 def version $stdout.puts "Guard version #{ VERSION }" end