-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tin Lai <[email protected]>
- Loading branch information
Showing
3 changed files
with
113 additions
and
0 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,49 @@ | ||
{ | ||
"session_name": "if conditions test", | ||
"environment": { | ||
"Foo": "false", | ||
"show_htop": "true" | ||
}, | ||
"windows": [ | ||
{ | ||
"window_name": "window 1 ${ha} $Foo", | ||
"if": { | ||
"shell": "${Foo}" | ||
}, | ||
"panes": [ | ||
{ | ||
"shell_command": [ | ||
"echo \"this shouldn't shows up\"" | ||
] | ||
}, | ||
"echo neither should this $Foo" | ||
] | ||
}, | ||
{ | ||
"window_name": "window 2", | ||
"panes": [ | ||
{ | ||
"if": { | ||
"python": "1+1==3" | ||
}, | ||
"shell_command": [ | ||
"echo the above is a false statement" | ||
] | ||
}, | ||
{ | ||
"shell_command": [ | ||
"echo no condition", | ||
"python -m http.server" | ||
] | ||
}, | ||
{ | ||
"if": "${show_htop}", | ||
"shell_command": [ | ||
"echo the above is a true statement (by default), but can be disabled on-demand", | ||
"htop" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
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,29 @@ | ||
session_name: if conditions test | ||
environment: | ||
Foo: 'false' | ||
show_htop: 'true' | ||
windows: | ||
# the following would not shows up as it evaluates to false | ||
- window_name: window 1 ${ha} $Foo | ||
if: | ||
shell: ${Foo} | ||
panes: | ||
- shell_command: | ||
- echo "this shouldn't shows up" | ||
- echo neither should this $Foo | ||
- window_name: window 2 | ||
panes: | ||
# should not shows up | ||
- if: | ||
python: 1+1==3 | ||
shell_command: | ||
- echo the above is a false statement | ||
# no if conditions | ||
- shell_command: | ||
- echo no condition | ||
- python -m http.server | ||
# display by default, but can be disabled by running `show_htop=false tmuxp load .....` | ||
- if: ${show_htop} | ||
shell_command: | ||
- echo the above is a true statement (by default), but can be disabled on-demand | ||
- htop |