Create watch file if it doesn't exist yet
This commit is contained in:
parent
30d4acd986
commit
2b43cdf9e2
1 changed files with 8 additions and 0 deletions
|
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
from functions.common import *
|
from functions.common import *
|
||||||
|
|
||||||
|
def create_file(filepath):
|
||||||
|
"""Create file if it doesn't exist."""
|
||||||
|
if not os.path.exists(filepath):
|
||||||
|
with open(filepath, 'w') as f:
|
||||||
|
f.write('')
|
||||||
|
|
||||||
def tmux_kill_all_panes(pane_id=None):
|
def tmux_kill_all_panes(pane_id=None):
|
||||||
"""Kill all tmux panes except the active pane or pane_id if specified."""
|
"""Kill all tmux panes except the active pane or pane_id if specified."""
|
||||||
cmd = ['tmux', 'kill-pane', '-a']
|
cmd = ['tmux', 'kill-pane', '-a']
|
||||||
|
|
@ -72,6 +78,7 @@ def tmux_split_window(
|
||||||
elif text:
|
elif text:
|
||||||
cmd.extend(['echo-and-hold "{}"'.format(text)])
|
cmd.extend(['echo-and-hold "{}"'.format(text)])
|
||||||
elif watch:
|
elif watch:
|
||||||
|
create_file(watch)
|
||||||
cmd.extend([
|
cmd.extend([
|
||||||
'watch', '--color', '--no-title',
|
'watch', '--color', '--no-title',
|
||||||
'--interval', '1',
|
'--interval', '1',
|
||||||
|
|
@ -98,6 +105,7 @@ def tmux_update_pane(
|
||||||
elif text:
|
elif text:
|
||||||
cmd.extend(['echo-and-hold "{}"'.format(text)])
|
cmd.extend(['echo-and-hold "{}"'.format(text)])
|
||||||
elif watch:
|
elif watch:
|
||||||
|
create_file(watch)
|
||||||
cmd.extend([
|
cmd.extend([
|
||||||
'watch', '--color', '--no-title',
|
'watch', '--color', '--no-title',
|
||||||
'--interval', '1',
|
'--interval', '1',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue