module Tmux

@todo Support querying and modifying keymaps

Constants

TMUX_VERSION

The newest version of tmux we officially support

VERSION

The version of this library

Attributes

binary[RW]

Path of the tmux binary. @return [String]

verbose[RW]

Print verbose information on $stderr? @return [Boolean]

verbose?[RW]

Print verbose information on $stderr? @return [Boolean]

Public Class Methods

invoke_command(cmd, unset_tmux = false) click to toggle source

Invokes a tmux command and returns all output.

@param [String] command Command to invoke @param [Boolean] unset_tmux If true, unsets $TMUX before calling

tmux, to allow nesting

@return [String] all output @raise [Exception::UnknownCommand] @api private

# File lib/tmux.rb, line 42
def invoke_command(cmd, unset_tmux = false)
  command = ""
  command << "TMUX='' " if unset_tmux
  command << "#{@binary} #{cmd}"

  $stderr.puts(command) if verbose?
  ret = `#{command} 2>&1`
  if ret.start_with?("unknown command:")
    raise Exception::UnknownCommand, ret.split(":", 2).last.strip
  else
    return ret
  end
end