use io.Writer
This commit is contained in:
parent
9154939d8f
commit
54f1f6b8c9
@ -6,6 +6,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
@ -874,7 +875,7 @@ var stateComputeStateCmd = &cli.Command{
|
|||||||
return c.Code, nil
|
return c.Code, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return ComputeStateHTMLTempl(ts, stout, getCode)
|
return ComputeStateHTMLTempl(os.Stdout, ts, stout, getCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("computed state cid: ", stout.Root)
|
fmt.Println("computed state cid: ", stout.Root)
|
||||||
@ -1081,7 +1082,7 @@ type compStateHTMLIn struct {
|
|||||||
Comp *api.ComputeStateOutput
|
Comp *api.ComputeStateOutput
|
||||||
}
|
}
|
||||||
|
|
||||||
func ComputeStateHTMLTempl(ts *types.TipSet, o *api.ComputeStateOutput, getCode func(addr address.Address) (cid.Cid, error)) error {
|
func ComputeStateHTMLTempl(w io.Writer, ts *types.TipSet, o *api.ComputeStateOutput, getCode func(addr address.Address) (cid.Cid, error)) error {
|
||||||
t, err := template.New("compute_state").Funcs(map[string]interface{}{
|
t, err := template.New("compute_state").Funcs(map[string]interface{}{
|
||||||
"GetCode": getCode,
|
"GetCode": getCode,
|
||||||
"GetMethod": getMethod,
|
"GetMethod": getMethod,
|
||||||
@ -1114,7 +1115,7 @@ func ComputeStateHTMLTempl(ts *types.TipSet, o *api.ComputeStateOutput, getCode
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return t.ExecuteTemplate(os.Stdout, "compute_state", &compStateHTMLIn{
|
return t.ExecuteTemplate(w, "compute_state", &compStateHTMLIn{
|
||||||
TipSet: ts,
|
TipSet: ts,
|
||||||
Comp: o,
|
Comp: o,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user