@@ -112,6 +112,32 @@ _get_proc_restore_element() {
112
112
echo " $1 " | sed " s/.*${inline_strategy_token} //"
113
113
}
114
114
115
+ # given full command: 'ruby /Users/john/bin/my_program arg1 arg2'
116
+ # and inline strategy: '~bin/my_program->my_program *'
117
+ # returns: 'arg1 arg2'
118
+ _get_command_arguments () {
119
+ local pane_full_command=" $1 "
120
+ local match=" $2 "
121
+ if _proc_starts_with_tildae " $match " ; then
122
+ match=" $( remove_first_char " $match " ) "
123
+ fi
124
+ echo " $pane_full_command " | sed " s,^.*${match} [^ ]* ,,"
125
+ }
126
+
127
+ _get_proc_restore_command () {
128
+ local pane_full_command=" $1 "
129
+ local proc=" $2 "
130
+ local match=" $3 "
131
+ local restore_element=" $( _get_proc_restore_element " $proc " ) "
132
+ if [[ " $restore_element " =~ " ${inline_strategy_arguments_token} " ]]; then
133
+ # replaces "%" with command arguments
134
+ local command_arguments=" $( _get_command_arguments " $pane_full_command " " $match " ) "
135
+ echo " $restore_element " | sed " s/${inline_strategy_arguments_token} /${command_arguments} /"
136
+ else
137
+ echo " $restore_element "
138
+ fi
139
+ }
140
+
115
141
_restore_list () {
116
142
local user_processes=" $( get_tmux_option " $restore_processes_option " " $restore_processes " ) "
117
143
local default_processes=" $( get_tmux_option " $default_proc_list_option " " $default_proc_list " ) "
@@ -137,7 +163,7 @@ _get_inline_strategy() {
137
163
if [[ " $proc " =~ " $inline_strategy_token " ]]; then
138
164
match=" $( _get_proc_match_element " $proc " ) "
139
165
if _proc_matches_full_command " $pane_full_command " " $match " ; then
140
- echo " $( _get_proc_restore_element " $proc " ) "
166
+ echo " $( _get_proc_restore_command " $pane_full_command " " $ proc" " $match " ) "
141
167
fi
142
168
fi
143
169
done
0 commit comments