@@ -15,6 +15,8 @@ const (
1515 shellCommandVariableName = "__pmy_out_command"
1616 shellSourcesVariableName = "__pmy_out_sources"
1717 shellAfterVariableName = "__pmy_out_%s_after"
18+ shellImmCmdVariableName = "__pmy_out_imm_cmd"
19+ shellImmAfterCmdVariableName = "__pmy_out_imm_after_cmd"
1820)
1921
2022type afterCmd struct {
@@ -30,6 +32,8 @@ type pmyOut struct {
3032 bufferRight string
3133 cmdGroups CmdGroups
3234 sources string
35+ immCmd string
36+ immAfterCmd string
3337}
3438
3539// newPmyOutFromRule create new pmyOut from rule
@@ -44,7 +48,13 @@ func newPmyOutFromRule(rule *pmyRule) pmyOut {
4448 // expand all parameters
4549 out .expandAll (rule .paramMap )
4650 // get sources
47- out .sources , _ = out .cmdGroups .GetSources ()
51+ if immCmdGroup , ok := out .cmdGroups .getImmCmdGroup (); ok {
52+ out .immCmd = immCmdGroup .Stmt
53+ out .immAfterCmd = immCmdGroup .After
54+ } else {
55+ out .sources , _ = out .cmdGroups .GetSources ()
56+ }
57+ // get sources
4858 return out
4959}
5060
@@ -65,6 +75,8 @@ func (out *pmyOut) toShellVariables() string {
6575 res += fmt .Sprintf ("%v=$'%v';" , shellBufferLeftVariableName , utils .Escape (out .bufferLeft , "'" ))
6676 res += fmt .Sprintf ("%v=$'%v';" , shellBufferRightVariableName , utils .Escape (out .bufferRight , "'" ))
6777 res += fmt .Sprintf ("%v=$'%v';" , shellSourcesVariableName , utils .Escape (out .sources , "'" ))
78+ res += fmt .Sprintf ("%v=$'%v';" , shellImmCmdVariableName , utils .Escape (out .immCmd , "'" ))
79+ res += fmt .Sprintf ("%v=$'%v';" , shellImmAfterCmdVariableName , utils .Escape (out .immAfterCmd , "'" ))
6880 for _ , cg := range out .cmdGroups {
6981 res += fmt .Sprintf (
7082 "%v=$'%v';" ,
0 commit comments