Mark::Options
Inherits Reference < Object
Wraps arguments and options from CLI. Handles setting defaults and running validations.
Example usage:
options = Mark::Options.new(["source.md"], { :target => "/path/to/target.html" })
options.sources # => ["source.md"]
options.target # => "/path/to/target.html"
options.template_html # => ".... default html template ..."
options.open_command # => "open /path/to/target.html"
options.keep # => false
options.keep_for # => 300
options.validate! # => no-op since all options are valid
options = Mark::Options.new([], { :target => "/path/to/target.html" })
options.validate! # => raises OptionError, at least one source required
Constants
DEFAULT_KEEP_FOR = "300"
DEFAULT_OPEN = "open %"
DEFAULT_TARGET = ".mark.html"
DEFAULT_TEMPLATE = File.join(ENV["HOME"], ".mark", "template.html")
Constructors
new(sources : Array(String), options : Hash(Symbol, String))
Instance methods
keep
keep_for_seconds
open_command
sources
target
target_directory
template_html
validate!