-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix --here option with window base index
- Loading branch information
Showing
9 changed files
with
83 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Teamocil | ||
module Command | ||
class ListPanes < ClosedStruct.new(:index) | ||
def to_s | ||
"list-panes #{options.join(' ')}" | ||
end | ||
|
||
def options | ||
[].tap do |options| | ||
options << "-t '#{index}'" if index | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Teamocil | ||
module Command | ||
class ListWindows < ClosedStruct.new(:foo) | ||
def to_s | ||
'list-windows' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Teamocil | ||
module Command | ||
class ShowOptions < ClosedStruct.new(:name) | ||
def to_s | ||
"show-options -gv #{name}" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Teamocil | ||
module Command | ||
class ShowWindowOptions < ClosedStruct.new(:name) | ||
def to_s | ||
"show-window-options -gv #{name}" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Teamocil | ||
module Tmux | ||
def self.option(option, default: nil) | ||
command = Teamocil::Command::ShowOptions.new(name: option) | ||
value = Teamocil.query_system(command).chomp | ||
value.empty? ? default : value.to_i | ||
end | ||
|
||
def self.window_option(option, default: nil) | ||
command = Teamocil::Command::ShowWindowOptions.new(name: option) | ||
value = Teamocil.query_system(command).chomp | ||
value.empty? ? default : value.to_i | ||
end | ||
|
||
def self.window_count | ||
command = Teamocil::Command::ListWindows.new | ||
Teamocil.query_system(command).chomp.split("\n").size | ||
end | ||
|
||
def self.pane_count(index: nil) | ||
command = Teamocil::Command::ListPanes.new(index: index) | ||
Teamocil.query_system(command).chomp.split("\n").size | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters