Sha256: 50d3e848e66522fcef09de356ae73ceecf065b0171a231c0161f771bc67d9fdd

Contents?: true

Size: 972 Bytes

Versions: 4

Compression:

Stored size: 972 Bytes

Contents

require "gm/notepad/input_handlers/default_handler"
module Gm
  module Notepad
    module InputHandlers
      class HelpHandler < DefaultHandler
        HELP_PREFIX = '?'.freeze

        def self.handles?(input:)
          return false unless input.match(/^\?/)
          true
        end

        def after_initialize!
          [
            "Prefixes:",
            "\t? - Help (this command)",
            "\t+ - Query table names and contents",
            "\t<table_name: - Write the results to the given table",
            "",
            "Tokens:",
            "\t! - Skip expansion",
            "\t/search/ - Grep for the given 'search' within the prefix",
            "\t[index] - Target a specific 'index'",
            "\t{table_name} - expand_line the given 'table_name'"
          ].each do |text|
            input.for_rendering(text: text, to_interactive: true, to_output: false, expand_line: false)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gm-notepad-0.0.14 lib/gm/notepad/input_handlers/help_handler.rb
gm-notepad-0.0.13 lib/gm/notepad/input_handlers/help_handler.rb
gm-notepad-0.0.12 lib/gm/notepad/input_handlers/help_handler.rb
gm-notepad-0.0.11 lib/gm/notepad/input_handlers/help_handler.rb