Skip to content

Commit

Permalink
env var for /dev in/out
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmota committed May 12, 2018
1 parent 48f0067 commit 6e25a81
Show file tree
Hide file tree
Showing 35 changed files with 27 additions and 14 deletions.
3 changes: 2 additions & 1 deletion com.github.miguelmota.Cointop.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"sources": [
{
"type": "git",
"url": "https://github.com/miguelmota/cointop.git"
"url": "https://github.com/miguelmota/cointop.git",
"commit": "48f0067b8242ea60d5981152977c381a2aa13c6e"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/gocui/attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package gocui

import "github.com/nsf/termbox-go"
import "github.com/miguelmota/cointop/pkg/termbox"

// Attribute represents a terminal attribute, like color, font style, etc. They
// can be combined using bitwise OR (|). Note that it is not possible to
Expand Down
2 changes: 1 addition & 1 deletion pkg/gocui/gocui.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package gocui
import (
"errors"

"github.com/nsf/termbox-go"
"github.com/miguelmota/cointop/pkg/termbox"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/gocui/keybinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package gocui

import "github.com/nsf/termbox-go"
import "github.com/miguelmota/cointop/pkg/termbox"

// Keybidings are used to link a given key-press event with a handler.
type keybinding struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/gocui/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"io"
"strings"

"github.com/nsf/termbox-go"
"github.com/miguelmota/cointop/pkg/termbox"
)

// A View is a window. It maintains its own internal buffer and cursor
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 21 additions & 9 deletions vendor/github.com/nsf/termbox-go/api.go → pkg/termbox/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

package termbox

import "github.com/mattn/go-runewidth"
import "fmt"
import "os"
import "os/signal"
import "syscall"
import "runtime"
import "time"
import (
"fmt"
"os"
"os/signal"
"runtime"
"syscall"
"time"

"github.com/mattn/go-runewidth"
)

// public API

Expand All @@ -24,11 +27,20 @@ import "time"
func Init() error {
var err error

out, err = os.OpenFile("/dev/tty", syscall.O_WRONLY, 0)
devin := os.Getenv("DEV_IN")
if devin == "" {
devin = "/dev/tty"
}
devout := os.Getenv("DEV_OUT")
if devout == "" {
devout = "/dev/tty"
}

out, err = os.OpenFile(devin, syscall.O_WRONLY, 0)
if err != nil {
return err
}
in, err = syscall.Open("/dev/tty", syscall.O_RDONLY, 0)
in, err = syscall.Open(devout, syscall.O_RDONLY, 0)
if err != nil {
return err
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6e25a81

Please sign in to comment.