Sha256: 28fd1d8d9deb4932b7a93e0f7bde2f398e25fc687cd3f2a89c50c3b5668ca018

Contents?: true

Size: 1.76 KB

Versions: 18

Compression:

Stored size: 1.76 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2019 Eric Crane.  All rights reserved.
#
# Show the help information.
#

module Gloo
  module Verbs
    class Help < GlooLang::Core::Verb

      KEYWORD = 'help'.freeze
      KEYWORD_SHORT = '?'.freeze
      DEFAULT_HELP = 'default_help'.freeze
      HELP_NOT_FOUND_ERR = 'Help command could not be found:'.freeze

      DISPATCH = {
        settings: 'show_settings',
        keywords: 'show_keywords',
        verb: 'show_verbs',
        verbs: 'show_verbs',
        v: 'show_verbs',
        obj: 'show_objs',
        object: 'show_objs',
        objects: 'show_objs',
        o: 'show_objs',
        topics: 'show_topics'
      }.freeze

      #
      # Run the verb.
      #
      def run
        data = "\n For documentation use the gloo website. \n\n"
        @engine.log.show data
      end

      #
      # Get the Verb's keyword.
      #
      def self.keyword
        return KEYWORD
      end

      #
      # Get the Verb's keyword shortcut.
      #
      def self.keyword_shortcut
        return KEYWORD_SHORT
      end

      # ---------------------------------------------------------------------
      #    Private functions
      # ---------------------------------------------------------------------

      private

      #
      # Write output to it and show it unless we are in
      # silent mode.
      #
      def show_output( out )
        @engine.heap.it.set_to out
        puts out unless @engine.args.quiet?
      end

      #
      # Show application settings.
      #
      def show_settings
        @engine.settings.show
      end

      #
      # Show all keywords: verbs and objects.
      #
      def show_keywords
        @engine.dictionary.show_keywords
      end

    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
gloo-1.4.2 lib/gloo/verbs/help.rb
gloo-1.4.1 lib/gloo/verbs/help.rb
gloo-1.4.0 lib/gloo/verbs/help.rb
gloo-1.3.3 lib/gloo/verbs/help.rb
gloo-1.3.2 lib/gloo/verbs/help.rb
gloo-1.3.1 lib/gloo/verbs/help.rb
gloo-1.3.0 lib/gloo/verbs/help.rb
gloo-1.2.10 lib/gloo/verbs/help.rb
gloo-1.2.9 lib/gloo/verbs/help.rb
gloo-1.2.8 lib/gloo/verbs/help.rb
gloo-1.2.7 lib/gloo/verbs/help.rb
gloo-1.2.6 lib/gloo/verbs/help.rb
gloo-1.2.5 lib/gloo/verbs/help.rb
gloo-1.2.4 lib/gloo/verbs/help.rb
gloo-1.2.3 lib/gloo/verbs/help.rb
gloo-1.2.2 lib/gloo/verbs/help.rb
gloo-1.2.0 lib/gloo/verbs/help.rb
gloo-1.1.0 lib/gloo/verbs/help.rb