diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-20 09:59:59 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-20 09:59:59 +0100 |
commit | a0a416e7762fcdcc066617da8083b0372b87155c (patch) | |
tree | 84217b9d1a9496944ddfeee8687cd01f6997cc3e /main/command.go | |
parent | b95e5ddaa1b182dfe58a386bfc107fa7d95c4393 (diff) | |
download | stred-go-a0a416e7762fcdcc066617da8083b0372b87155c.tar |
Remove filters and various commands that are no longer wanted
These have all been made redundant by the incredible substitute command
Diffstat (limited to 'main/command.go')
-rw-r--r-- | main/command.go | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/main/command.go b/main/command.go index e676255..7d44309 100644 --- a/main/command.go +++ b/main/command.go @@ -16,41 +16,6 @@ func (cmd PrintValueCommand) exec(state *ProgramState) { } } -type ToggleTerminalCommand struct {} -func (cmd ToggleTerminalCommand) exec(state *ProgramState) { - toggled := map[walk.TerminalValue]walk.TerminalValue { - walk.ArrayBegin: walk.MapBegin, - walk.ArrayEnd: walk.MapEnd, - walk.MapBegin: walk.ArrayBegin, - walk.MapEnd: walk.ArrayEnd, - } - - for i := range state.value { - terminal, isTerminal := state.value[i].(walk.TerminalValue) - if !isTerminal { - continue - } - state.value[i] = toggled[terminal] - } -} - -type FilteredCommand struct { - filter Filter - command Command -} -func (cmd FilteredCommand) exec(state *ProgramState) { - path := walk.PathFromWalkValues(state.path) - for _, value := range state.value { - if cmd.filter.exec(walk.WalkItem { - Value: value, - Path: path, - }) { - cmd.command.exec(state) - return - } - } -} - type SequenceCommand struct { commands []Command } @@ -60,22 +25,6 @@ func (cmd SequenceCommand) exec(state *ProgramState) { } } -type AppendLiteralCommand struct { - values []walk.WalkValue -} -func (cmd AppendLiteralCommand) exec(state *ProgramState) { - state.value = append(state.value, cmd.values...) -} - -type PrependLiteralCommand struct { - values []walk.WalkValue -} -func (cmd PrependLiteralCommand) exec(state *ProgramState) { - var newItems []walk.WalkValue - newItems = append(newItems, cmd.values...) - state.value = append(newItems, state.value...) -} - type NextCommand struct {} func (cmd NextCommand) exec(state *ProgramState) { nextItem := <- state.in @@ -90,15 +39,6 @@ func (cmd AppendNextCommand) exec(state *ProgramState) { state.path = nextItem.Path.ToWalkValues() } -type PrintLiteralsCommand struct { - items []walk.WalkItem -} -func (cmd PrintLiteralsCommand) exec(state *ProgramState) { - for _, item := range cmd.items { - state.out <- item - } -} - type DeleteAllCommand struct {} func (cmd DeleteAllCommand) exec(state *ProgramState) { state.path = nil |