Sha256: 39e2b4f8b0edefa7f84405ce0733ce1a6fb81335e0f224753558dd8a3bd54628

Contents?: true

Size: 465 Bytes

Versions: 2

Compression:

Stored size: 465 Bytes

Contents

module Omnibar
  #
  # System Commands
  #
  # Interact with your system
  #
  class System < Query
    COMMANDS = {
      'sleep' => 'xset -display :0.0 dpms force off',
      'reboot' => 'reboot',
      'shutdown' => 'shutdown now',
      'power off' => 'shutdown now'
    }.freeze

    def result
      search.find(input)
    end

    def search
      @fz ||= FuzzyMatch.new(COMMANDS.keys)
    end

    def perform!
      puts COMMANDS[result]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omnibar-0.0.6 lib/omnibar/queries/system.rb
omnibar-0.0.5 lib/omnibar/system.rb