Module: ITerm2
- Defined in:
- lib/iterm2.rb,
lib/iterm2/tab.rb,
lib/iterm2/client.rb,
lib/iterm2/window.rb,
lib/iterm2/session.rb,
lib/iterm2/version.rb,
lib/iterm2/connection.rb
Defined Under Namespace
Classes: AuthError, Client, Connection, ConnectionError, Error, NotFoundError, RPCError, Session, SubscriptionError, Tab, Window
Constant Summary collapse
- Proto =
Alias the protoc-generated Iterm2 module for internal use
::Iterm2
- VERSION =
"0.2.0"
Class Method Summary collapse
-
.activate_session(session_id) ⇒ Object
One-shot: activate a session.
-
.connect(app_name: "iterm2_ruby") ⇒ Object
Convenience: open connection, yield client, close.
-
.focus ⇒ Object
One-shot: current focus state.
-
.get_profile_property(session_id, *keys) ⇒ Object
One-shot: get profile properties for a session.
-
.get_prompt(session_id) ⇒ Object
One-shot: prompt state for a session.
-
.get_variable(name, **scope) ⇒ Object
One-shot: get variable.
-
.inject(session_id, data) ⇒ Object
One-shot: inject data into a session.
-
.list_profiles(properties: nil, guids: nil) ⇒ Object
One-shot: list all profiles.
-
.list_sessions ⇒ Object
One-shot: list all sessions.
-
.raise_by_cwd(pattern) ⇒ Object
One-shot: raise by cwd pattern.
-
.raise_by_title(pattern) ⇒ Object
One-shot: raise by title pattern.
-
.read_screen(session_id, trailing_lines: nil) ⇒ Object
One-shot: read screen contents.
-
.send_text(session_id, text) ⇒ Object
One-shot: send text to a session.
-
.session_info(session_id) ⇒ Object
One-shot: session info (tty, pid, cwd, name, job).
-
.topology ⇒ Object
One-shot: flat topology.
-
.topology_enriched ⇒ Object
One-shot: enriched topology (with cwd, pid, tty).
Class Method Details
.activate_session(session_id) ⇒ Object
One-shot: activate a session
58 59 60 |
# File 'lib/iterm2.rb', line 58 def self.activate_session(session_id) connect { |c| c.activate_session(session_id) } end |
.connect(app_name: "iterm2_ruby") ⇒ Object
Convenience: open connection, yield client, close
23 24 25 26 27 28 29 30 |
# File 'lib/iterm2.rb', line 23 def self.connect(app_name: "iterm2_ruby") client = Client.new(app_name: app_name) return client unless block_given? yield client ensure client&.close if block_given? end |
.focus ⇒ Object
One-shot: current focus state
83 84 85 |
# File 'lib/iterm2.rb', line 83 def self.focus connect { |c| c.focus } end |
.get_profile_property(session_id, *keys) ⇒ Object
One-shot: get profile properties for a session
93 94 95 |
# File 'lib/iterm2.rb', line 93 def self.get_profile_property(session_id, *keys) connect { |c| c.get_profile_property(session_id, *keys) } end |
.get_prompt(session_id) ⇒ Object
One-shot: prompt state for a session
88 89 90 |
# File 'lib/iterm2.rb', line 88 def self.get_prompt(session_id) connect { |c| c.get_prompt(session_id) } end |
.get_variable(name, **scope) ⇒ Object
One-shot: get variable
78 79 80 |
# File 'lib/iterm2.rb', line 78 def self.get_variable(name, **scope) connect { |c| c.get_variable(name, **scope) } end |
.inject(session_id, data) ⇒ Object
One-shot: inject data into a session
103 104 105 |
# File 'lib/iterm2.rb', line 103 def self.inject(session_id, data) connect { |c| c.inject(session_id, data) } end |
.list_profiles(properties: nil, guids: nil) ⇒ Object
One-shot: list all profiles
98 99 100 |
# File 'lib/iterm2.rb', line 98 def self.list_profiles(properties: nil, guids: nil) connect { |c| c.list_profiles(properties: properties, guids: guids) } end |
.list_sessions ⇒ Object
One-shot: list all sessions
33 34 35 |
# File 'lib/iterm2.rb', line 33 def self.list_sessions connect { |c| c.list_sessions } end |
.raise_by_cwd(pattern) ⇒ Object
One-shot: raise by cwd pattern
68 69 70 |
# File 'lib/iterm2.rb', line 68 def self.raise_by_cwd(pattern) connect { |c| c.raise_by_cwd(pattern) } end |
.raise_by_title(pattern) ⇒ Object
One-shot: raise by title pattern
53 54 55 |
# File 'lib/iterm2.rb', line 53 def self.raise_by_title(pattern) connect { |c| c.raise_by_title(pattern) } end |
.read_screen(session_id, trailing_lines: nil) ⇒ Object
One-shot: read screen contents
48 49 50 |
# File 'lib/iterm2.rb', line 48 def self.read_screen(session_id, trailing_lines: nil) connect { |c| c.read_screen(session_id, trailing_lines: trailing_lines) } end |
.send_text(session_id, text) ⇒ Object
One-shot: send text to a session
43 44 45 |
# File 'lib/iterm2.rb', line 43 def self.send_text(session_id, text) connect { |c| c.send_text(session_id, text) } end |
.session_info(session_id) ⇒ Object
One-shot: session info (tty, pid, cwd, name, job)
73 74 75 |
# File 'lib/iterm2.rb', line 73 def self.session_info(session_id) connect { |c| c.session_info(session_id) } end |
.topology ⇒ Object
One-shot: flat topology
38 39 40 |
# File 'lib/iterm2.rb', line 38 def self.topology connect { |c| c.topology } end |
.topology_enriched ⇒ Object
One-shot: enriched topology (with cwd, pid, tty)
63 64 65 |
# File 'lib/iterm2.rb', line 63 def self.topology_enriched connect { |c| c.topology_enriched } end |