shuffle code
This commit is contained in:
16
cmd/dump.go
16
cmd/dump.go
@@ -19,6 +19,17 @@ func _dump(writer io.Writer, filepaths []string, tags []string, search, rootDisp
|
||||
return err
|
||||
}
|
||||
|
||||
for _, x := range []*[]pttodo.Todo{
|
||||
&root.Todo,
|
||||
&root.Scheduled,
|
||||
&root.Done,
|
||||
} {
|
||||
y := pttodo.Todos(*x)
|
||||
y = y.LikeTags(tags)
|
||||
y = y.LikeSearch(search)
|
||||
*x = y
|
||||
}
|
||||
|
||||
var v interface{} = root
|
||||
switch rootDisplay {
|
||||
case DUMP_ALL:
|
||||
@@ -29,11 +40,6 @@ func _dump(writer io.Writer, filepaths []string, tags []string, search, rootDisp
|
||||
case DUMP_DONE:
|
||||
v = root.Done
|
||||
}
|
||||
if todos, ok := v.([]pttodo.Todo); ok {
|
||||
todos = pttodo.Todos(todos).LikeTags(tags)
|
||||
todos = pttodo.Todos(todos).LikeSearch(search)
|
||||
v = todos
|
||||
}
|
||||
|
||||
b2, err := yaml.Marshal(v)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user