Class Thor::Shell::Basic
In: lib/thor/shell/basic.rb
Parent: Object

Methods

Attributes

base  [RW] 
padding  [RW] 

Public Instance methods

Ask something to the user and receives a response.

Example

ask("What is your name?")

Called if something goes wrong during the execution. This is used by Thor internally and should not be used inside your scripts. If someone went wrong, you can always raise an exception. If you raise a Thor::Error, it will be rescued and wrapped in the method below.

Deals with file collision and returns true if the file should be overwriten and false otherwise. If a block is given, it uses the block response as the content for the diff.

Parameters

destination<String>:the destination file to solve conflicts
block<Proc>:an optional block that returns the value to be used in diff

Make a question the to user and returns true if the user replies "n" or "no".

Sets the output padding, not allowing less than zero values.

Prints a table.

Parameters

Array[Array[String, String, …]]

Options

ident<Integer>:Ident the first column by ident value.

Say (print) something to the user. If the sentence ends with a whitespace or tab character, a new line is not appended (print + flush). Otherwise are passed straight to puts (behavior got from Highline).

Example

say("I know you knew that.")

Say a status with the given color and appends the message. Since this method is used frequently by actions, it allows nil or false to be given in log_status, avoiding the message from being shown. If a Symbol is given in log_status, it‘s used as the color.

Make a question the to user and returns true if the user replies "y" or "yes".

Protected Instance methods

Calculate the dynamic width of the terminal

This code was copied from Rake, available under MIT-LICENSE Copyright (c) 2003, 2004 Jim Weirich

[Validate]