class Toys::StandardMiddleware::ShowRootVersion
‘–version` flag is given.
A middleware that displays a version string for the root tool if the
#
def config(tool, _loader)
- Private:   -   
def config(tool, _loader) if @version_string && tool.root? tool.add_flag(SHOW_VERSION_KEY, @version_flags, report_collisions: false, desc: @version_flag_desc) end yield end
def initialize(version_string: nil,
- 
        stream(IO) -- Output stream to write to. Default is stdout.
- 
        version_flags(Array) -- A list of flags that should
- 
        version_string(String) -- The string that should be displayed.
def initialize(version_string: nil, version_flags: DEFAULT_VERSION_FLAGS, version_flag_desc: DEFAULT_VERSION_FLAG_DESC, stream: $stdout) @version_string = version_string @version_flags = version_flags @version_flag_desc = version_flag_desc @output = stream end
def run(context)
- Private:   -   
def run(context) if context[SHOW_VERSION_KEY] @output.puts(@version_string) else yield end end