<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/main/command.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2023-04-20 14:48:50 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2023-04-20 14:48:50 +0100
commit79ac135cee306cbcfa4b73f1b7c0b404712fee7b (patch)
treee3a4d7d69bf8c044827914dbc05a4a473878559b /main/command.go
parent46720adb713a931447f4d899729b83b6171138db (diff)
downloadstred-go-79ac135cee306cbcfa4b73f1b7c0b404712fee7b.tar
Replaces the inflexible delete all with separate DeleteValue and DeletePath commands
Diffstat (limited to 'main/command.go')
-rw-r--r--main/command.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/main/command.go b/main/command.go
index 5e77dd0..9554f9d 100644
--- a/main/command.go
+++ b/main/command.go
@@ -43,12 +43,16 @@ func (cmd AppendNextCommand) exec(state *ProgramState) {
state.path = nextItem.Path.ToWalkValues()
}
-type DeleteAllCommand struct {}
-func (cmd DeleteAllCommand) exec(state *ProgramState) {
- state.path = nil
+type DeleteValueCommand struct {}
+func (cmd DeleteValueCommand) exec(state *ProgramState) {
state.value = nil
}
+type DeletePathCommand struct {}
+func (cmd DeletePathCommand) exec(state *ProgramState) {
+ state.path = nil
+}
+
func runSubex(state subex.SubexState, in []walk.WalkValue) (out []walk.WalkValue, error bool) {
valueStream := make(chan walk.WalkValue)
go func(in []walk.WalkValue, out chan<- walk.WalkValue) {