Sha256: 824f43d0eb697fe384882895b3842cf3d2b5ac63f032edc176e3cdcb69bf63f6

Contents?: true

Size: 614 Bytes

Versions: 2

Compression:

Stored size: 614 Bytes

Contents

module Mayl
  # Public: The Commands module is a namespace for all the commands that Mayl
  # uses.
  module Commands
    def self.autocomplete(line, env)
      key = line.split.first || ''

      # Try to get namespaces or keys
      keys = env.autocomplete(key)
      return keys if keys.any?

      # If not, autocomplete commands
      opts = constants.map(&:to_s).map(&:downcase)
      opts.grep(/^#{Regexp.escape(key)}/)
    end
  end
end

require 'mayl/commands/set'
require 'mayl/commands/get'
require 'mayl/commands/edit'
require 'mayl/commands/cd'
require 'mayl/commands/exit'
require 'mayl/commands/ls'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mayl-0.2.1 lib/mayl/commands.rb
mayl-0.2.0 lib/mayl/commands.rb