Class | Thor::Shell::Basic |
In: |
lib/bundler/vendor/thor/shell/basic.rb
|
Parent: | Object |
base | [RW] | |
padding | [R] |
Asks something to the user and receives a response.
If asked to limit the correct responses, you can pass in an array of acceptable answers. If one of those is not supplied, they will be shown a message stating that one of those answers must be given and re-asked the question.
ask("What is your name?")
ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
Called if something goes wrong during the execution. This is used by Thor internally and should not be used inside your scripts. If something 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 overwritten and false otherwise. If a block is given, it uses the block response as the content for the diff.
destination<String>: | the destination file to solve conflicts |
block<Proc>: | an optional block that returns the value to be used in diff |
Prints a table.
Array[Array[String, String, …]]
indent<Integer>: | Indent the first column by indent value. |
colwidth<Integer>: | Force the first column to colwidth spaces wide. |
Prints a long string, word-wrapping the text to the current width of the terminal display. Ideal for printing heredocs.
String
indent<Integer>: | Indent each line of the printed paragraph by indent 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).
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.