Skip to content

Commit

Permalink
Use c as create window operation, instead of n.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasefe committed Jul 31, 2016
1 parent e465a13 commit 39aec4d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
6 changes: 3 additions & 3 deletions examples/.ta
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
uno n echo izquierda solo
uno c echo izquierda solo
uno v echo derecha arriba
uno h echo derecha abajo
dos n echo arriba solo
dos c echo arriba solo
dos h echo abajo izquierda
dos v echo abajo derecha
tres n echo izquierda arriba
tres c echo izquierda arriba
tres v echo derecha arriba
tres h echo derecha abajo
tres 1h echo izquierda abajo
4 changes: 2 additions & 2 deletions examples/.ta2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
uno n echo uno
uno c echo uno
uno v echo 5
#

dos 1n echo new
dos 1c echo new
dos a
2 changes: 1 addition & 1 deletion examples/.ta3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
uno n echo one
uno c echo one
uno v echo right side
# n
uno 1a echo al final
10 changes: 3 additions & 7 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

const (
active = "a"
create = "n"
create = "c"
horizontal = "h"
vertical = "v"
)
Expand All @@ -28,6 +28,7 @@ func Parse(session string, file *os.File) (cmds []Args) {
captures, err := ParseLine(line)

if err != nil {
log.Printf("Skipped: '%v'. Err: %v. Got: %+v", line, err, captures)
continue
}

Expand All @@ -36,11 +37,6 @@ func Parse(session string, file *os.File) (cmds []Args) {
target := captures["target"]
action := captures["action"]

// Skip comments
if string(window[0]) == "#" {
continue
}

if len(operation) > 1 {
target = operation[0:(len(operation) - 1)]
operation = operation[len(operation)-1:]
Expand Down Expand Up @@ -131,7 +127,7 @@ func killCommands(session string) Args {
}

func ParseLine(line string) (map[string]string, error) {
var re = regexp.MustCompile(`(?P<window>[a-z]*)\s(?P<target>\d?)(?P<operation>[nvha])\s(?P<action>.*)`)
var re = regexp.MustCompile(`(?P<window>[a-z]*)\s(?P<target>\d?)(?P<operation>[cvha])(?P<action>.*?)`)
match := re.FindStringSubmatch(line)
captures := make(map[string]string)

Expand Down

0 comments on commit 39aec4d

Please sign in to comment.