Skip to content

Commit c3ffe89

Browse files
authored
Merge pull request #284 from rummik/mosh-client-strategy
Add mosh-client default strategy
2 parents b020b24 + e99f197 commit c3ffe89

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

docs/restoring_programs.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- [General instructions](#general-instructions)
33
- [Clarifications](#clarifications)
44
- [Working with NodeJS](#nodejs)
5+
- [Restoring Mosh](#mosh)
56

67
### General instructions <a name="general-instructions"></a>
78
Only a conservative list of programs is restored by default:<br/>
@@ -169,3 +170,10 @@ A work around, for this problem until it's fixed, is:
169170

170171
... node:node /path/to/yarn gulp "test-it"
171172

173+
174+
### Restoring Mosh <a name="#mosh"></a>
175+
Mosh spawns a `mosh-client` process, so we need to specify that as the process to be resurrected.
176+
177+
set -g @resurrect-processes 'mosh-client'
178+
179+
Additionally a mosh-client strategy is provided to handle extracting the original arguments and re-run Mosh.

resurrect.tmux

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ set_restore_bindings() {
2323

2424
set_default_strategies() {
2525
tmux set-option -gq "${restore_process_strategy_option}irb" "default_strategy"
26+
tmux set-option -gq "${restore_process_strategy_option}mosh-client" "default_strategy"
2627
}
2728

2829
set_script_path_options() {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
# "mosh-client default strategy"
4+
#
5+
# Example mosh-client process:
6+
# mosh-client -# charm tmux at | 198.199.104.142 60001
7+
#
8+
# When executed, the above will fail. This strategy handles that.
9+
10+
ORIGINAL_COMMAND="$1"
11+
DIRECTORY="$2"
12+
13+
mosh_command() {
14+
local args="$ORIGINAL_COMMAND"
15+
16+
args="${args#*-#}"
17+
args="${args%|*}"
18+
19+
echo "mosh $args"
20+
}
21+
22+
main() {
23+
echo "$(mosh_command)"
24+
}
25+
main

0 commit comments

Comments
 (0)