module Spark

Overview

Spark is a CLI Utility library that makes working with users on the command line simpler than ever.

Extended Modules

Defined in:

spark.cr
spark/file.cr
spark/file/create_file.cr
spark/prompt.cr
spark/prompt/confirmation_question.cr
spark/prompt/question.cr
spark/prompt/statement.cr
spark/shard.cr
spark/shard/shard_content.cr
spark/shard/shard_file.cr
spark/template.cr

Constant Summary

VERSION = {{ (`shards version \"/__w/spark/spark/src\"`).chomp.stringify }}

Instance Method Summary

Instance Method Detail

def indent #

Increase the indentation level for Spark output by one level.


[View source]
def indent_level #

[View source]
def logger : Spark::Prompt #

Which object to use for logging optional output to users.


[View source]
def logger=(logger : Spark::Prompt) #

Control which object is used to log optional output to users.

Example:

Spark.logger = Spark::Prompt.new(input: File.tempfile.open, output: File.tempfile.open)

[View source]
def outdent #

Decrease the indentation level for Spark output by one level.

Cannot be decreased below zero.


[View source]
def quiet(active : Bool = true, &) #

Force a block of code to run in a temporary quiet mode setting.

Example temporarily enabling:

Spark.quiet do
  Spark::Prompt.new.log_action("TESTING")
end
# => ""

Example temporarily disabling:

Spark.quiet(false) do
  Spark::Prompt.new.log_action("TESTING")
end
# => ""

[View source]
def quiet=(quiet) #

Control whether or not optional terminal output is displayed to users.

Example:

Spark.logger.log_action("Testing") # => This will print something to the user
Spark.quiet = true
Spark.logger.log_action("Testing") # => Nothing will print to the user

[View source]
def quiet? #

Whether or not to suppress optional terminal output to users.


[View source]
def reset_indentation #

Reset the Spark indentation level back to 0.


[View source]