Sha256: 4a9fee6daf91fcbe61afbcefbc26a4e3c9de5e2a4d479e83e5a72a08f1b1009b

Contents?: true

Size: 1.06 KB

Versions: 17

Compression:

Stored size: 1.06 KB

Contents

module Foobara
  class CommandConnector
    module Commands
      class ListCommands < Command
        inputs request: :duck, # TODO: have some way to specify by Ruby class...
               verbose: :boolean

        result [
          [
            :string,
            {
              type: :string,
              allow_nil: true
            }
          ]
        ]

        def execute
          build_list
          build_result
        end

        attr_accessor :list

        def build_list
          self.list = command_connector.command_registry.all_transformed_command_classes
        end

        def verbose?
          verbose
        end

        def build_result
          if verbose?
            list.map do |command_class|
              [command_class.full_command_name, command_class.description]
            end
          else
            list.map do |command_class|
              [command_class.full_command_name, nil]
            end
          end
        end

        def command_connector
          request.command_connector
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
foobara-0.0.26 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.25 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.24 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.23 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.22 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.21 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.20 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.19 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.18 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.17 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.16 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.15 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.14 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.13 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.12 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.11 projects/command_connectors/src/command_connector/commands/list_commands.rb
foobara-0.0.10 projects/command_connectors/src/command_connector/commands/list_commands.rb