@@ -23,10 +23,10 @@ type afterCmd struct {
2323 after string
2424}
2525
26- // pmyOut represents Output of pmy against zsh routine.
26+ // Out represents Output of pmy against zsh routine.
2727// This struct has strings exported to shell, whose embedded
2828// variables are all expanded.
29- type pmyOut struct {
29+ type Out struct {
3030 bufferLeft string
3131 bufferRight string
3232 cmdGroups CmdGroups
@@ -35,10 +35,10 @@ type pmyOut struct {
3535 allEmptyTag bool
3636}
3737
38- // newPmyOutFromRule create new pmyOut from rule
38+ // newOutFromRule create new Out from rule
3939// which matches query and already has paramMap
40- func newPmyOutFromRule (rule * pmyRule ) pmyOut {
41- out := pmyOut {}
40+ func newOutFromRule (rule * Rule ) Out {
41+ out := Out {}
4242 // pass resulting buffer informaiton
4343 out .bufferLeft = rule .BufferLeft
4444 out .bufferRight = rule .BufferRight
@@ -57,7 +57,7 @@ func newPmyOutFromRule(rule *pmyRule) pmyOut {
5757
5858// buildMainCommand builds main command that concatenate
5959// all results of given command groups
60- func (out * pmyOut ) buildMainCommand () string {
60+ func (out * Out ) buildMainCommand () string {
6161 res := ""
6262 pmyDelimiter := os .Getenv ("PMY_TAG_DELIMITER" )
6363 for _ , cg := range out .cmdGroups {
@@ -80,9 +80,9 @@ func (out *pmyOut) buildMainCommand() string {
8080 return res
8181}
8282
83- // toShellVariables create zsh statement where pmyOut 's attributes are
83+ // toShellVariables create zsh statement where Out 's attributes are
8484// passed into shell variables
85- func (out * pmyOut ) toShellVariables () string {
85+ func (out * Out ) toShellVariables () string {
8686 res := ""
8787 res += fmt .Sprintf ("local %v=$'%v';" , shellCommandVariableName , utils .Escape (out .buildMainCommand (), "'" ))
8888 res += fmt .Sprintf ("local %v=$'%v';" , shellBufferLeftVariableName , utils .Escape (out .bufferLeft , "'" ))
@@ -115,15 +115,19 @@ func expand(org string, paramMap map[string]string) string {
115115 return res
116116}
117117
118+ func fetchSnippetJSONPath (snippetRelPath string ) string {
119+ return ""
120+ }
121+
118122// expandAllMagics expands all magic commnad in Stmt
119123// written in `%hoge` format
120- func (out * pmyOut ) expandAllMagics () {
124+ func (out * Out ) expandAllMagics () {
121125 for _ , cg := range out .cmdGroups {
122126 if ! strings .HasPrefix (cg .Stmt , "%" ) {
123127 continue
124128 }
125- snippetBaseName := strings .Replace (cg .Stmt , "%" , "" , - 1 )
126- snippetPath := fmt . Sprintf ( "%v/%v.txt" , PmySnippetRoot , snippetBaseName )
129+ snippetRelPath := strings .Replace (cg .Stmt , "%" , "" , - 1 )
130+ snippetPath := fetchSnippetJSONPath ( snippetRelPath )
127131 cg .Stmt = fmt .Sprintf (
128132 "cat %v | taggo -q '0:yellow' -d ' '" ,
129133 snippetPath ,
@@ -133,7 +137,7 @@ func (out *pmyOut) expandAllMagics() {
133137}
134138
135139// expandAllParams expands all params that refer to regexp parameters
136- func (out * pmyOut ) expandAllParams (paramMap map [string ]string ) {
140+ func (out * Out ) expandAllParams (paramMap map [string ]string ) {
137141 out .bufferLeft = expand (out .bufferLeft , paramMap )
138142 out .bufferRight = expand (out .bufferRight , paramMap )
139143 out .fuzzyFinderCmd = expand (out .fuzzyFinderCmd , paramMap )
@@ -143,12 +147,12 @@ func (out *pmyOut) expandAllParams(paramMap map[string]string) {
143147 return
144148}
145149
146- func (out * pmyOut ) toJSON () string {
150+ func (out * Out ) toJSON () string {
147151 bytes , _ := json .Marshal (out )
148152 str := string (bytes )
149153 return str
150154}
151155
152- // func (out *pmyOut ) serialize() string {
156+ // func (out *Out ) serialize() string {
153157// return out.BufferLeft + delimiter + out.BufferRight + delimiter + out.Command
154158// }
0 commit comments