lib/tty/templates/new/lib/newcli/command.rb.tt
# frozen_string_literal: true
<%- constantinized_parts.each_with_index do |const, i| -%>
<%= " " * i %>module <%= const %>
<%- end -%>
<%= indent %>class Command
<%= indent %> # Execute this command
<%= indent %> #
<%= indent %> # @api public
<%= indent %> def execute(*)
<%= indent %> raise(
<%= indent %> NotImplementedError,
<%= indent %> "#{self.class}##{__method__} must be implemented"
<%= indent %> )
<%= indent %> end
<%= indent %> # Below are examples of how to integrate TTY components
<%= indent %> # The external commands runner
<%= indent %> #
<%= indent %> # @see http://www.rubydoc.info/gems/tty-command
<%= indent %> #
<%= indent %> # @api public
<%= indent %> # def command(**options)
<%= indent %> # require "tty-command"
<%= indent %> # TTY::Command.new(options)
<%= indent %> # end
<%= indent %> # The interactive prompt
<%= indent %> #
<%= indent %> # @see http://www.rubydoc.info/gems/tty-prompt
<%= indent %> #
<%= indent %> # @api public
<%= indent %> # def prompt(**options)
<%= indent %> # require "tty-prompt"
<%= indent %> # TTY::Prompt.new(options)
<%= indent %> # end
<%- (constantinized_parts.size).downto(0) do |i| -%>
<%= " " * i %>end
<%- end -%>