├── LICENSE ├── Makefile ├── README.md ├── build.sh ├── cmd └── jd │ └── main.go ├── editor.go ├── pretty.go └── vendor └── github.com ├── mattn └── go-runewidth │ ├── .travis.yml │ ├── LICENSE │ ├── README.mkd │ ├── runewidth.go │ ├── runewidth_js.go │ ├── runewidth_posix.go │ ├── runewidth_test.go │ └── runewidth_windows.go ├── nsf └── termbox-go │ ├── AUTHORS │ ├── LICENSE │ ├── README.md │ ├── _demos │ ├── editbox.go │ ├── interrupt.go │ ├── keyboard.go │ ├── output.go │ ├── paint.go │ ├── random_output.go │ └── raw_input.go │ ├── api.go │ ├── api_common.go │ ├── api_windows.go │ ├── collect_terminfo.py │ ├── syscalls.go │ ├── syscalls_darwin.go │ ├── syscalls_darwin_amd64.go │ ├── syscalls_dragonfly.go │ ├── syscalls_freebsd.go │ ├── syscalls_linux.go │ ├── syscalls_netbsd.go │ ├── syscalls_openbsd.go │ ├── syscalls_windows.go │ ├── termbox.go │ ├── termbox_common.go │ ├── termbox_windows.go │ ├── terminfo.go │ └── terminfo_builtin.go └── tidwall ├── gjson ├── 123 ├── .travis.yml ├── LICENSE ├── README.md ├── gjson.go ├── gjson_test.go ├── logo.png ├── node_modules │ ├── .bin │ │ └── ttystudio │ └── ttystudio │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bin │ │ └── ttystudio │ │ ├── fonts │ │ ├── AUTHORS │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README │ │ ├── index.js │ │ ├── ter-u12b.bdf │ │ ├── ter-u12n.bdf │ │ ├── ter-u14b.bdf │ │ ├── ter-u14b.json │ │ ├── ter-u14n.bdf │ │ ├── ter-u14n.json │ │ ├── ter-u14v.bdf │ │ ├── ter-u16b.bdf │ │ ├── ter-u16n.bdf │ │ ├── ter-u16v.bdf │ │ ├── ter-u18b.bdf │ │ ├── ter-u18n.bdf │ │ ├── ter-u20b.bdf │ │ ├── ter-u20n.bdf │ │ ├── ter-u22b.bdf │ │ ├── ter-u22n.bdf │ │ ├── ter-u24b.bdf │ │ ├── ter-u24n.bdf │ │ ├── ter-u28b.bdf │ │ ├── ter-u28n.bdf │ │ ├── ter-u32b.bdf │ │ └── ter-u32n.bdf │ │ ├── index.js │ │ ├── lib │ │ ├── buffer.js │ │ ├── compile.js │ │ ├── gif.js │ │ ├── optimize.js │ │ ├── options.js │ │ ├── play.js │ │ ├── png.js │ │ ├── record.js │ │ ├── ttystudio.js │ │ └── writer.js │ │ ├── man │ │ └── ttystudio.1 │ │ ├── node_modules │ │ ├── .bin │ │ │ └── blessed │ │ ├── blessed │ │ │ ├── .npmignore │ │ │ ├── CHANGELOG.md │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── bin │ │ │ │ └── tput.js │ │ │ ├── browser │ │ │ │ ├── Makefile │ │ │ │ └── transform.js │ │ │ ├── example │ │ │ │ ├── ansi-viewer │ │ │ │ │ ├── LICENSE │ │ │ │ │ ├── README.md │ │ │ │ │ ├── ansi-art.list │ │ │ │ │ ├── index.js │ │ │ │ │ ├── package.json │ │ │ │ │ └── singlebyte.js │ │ │ │ ├── blessed-telnet.js │ │ │ │ ├── index.js │ │ │ │ ├── multiplex.js │ │ │ │ ├── ping │ │ │ │ ├── simple-form.js │ │ │ │ ├── time.js │ │ │ │ └── widget.js │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── alias.js │ │ │ │ ├── blessed.js │ │ │ │ ├── colors.js │ │ │ │ ├── events.js │ │ │ │ ├── gpmclient.js │ │ │ │ ├── helpers.js │ │ │ │ ├── keys.js │ │ │ │ ├── program.js │ │ │ │ ├── tput.js │ │ │ │ ├── unicode.js │ │ │ │ ├── widget.js │ │ │ │ └── widgets │ │ │ │ │ ├── ansiimage.js │ │ │ │ │ ├── bigtext.js │ │ │ │ │ ├── box.js │ │ │ │ │ ├── button.js │ │ │ │ │ ├── checkbox.js │ │ │ │ │ ├── element.js │ │ │ │ │ ├── filemanager.js │ │ │ │ │ ├── form.js │ │ │ │ │ ├── image.js │ │ │ │ │ ├── input.js │ │ │ │ │ ├── layout.js │ │ │ │ │ ├── line.js │ │ │ │ │ ├── list.js │ │ │ │ │ ├── listbar.js │ │ │ │ │ ├── listtable.js │ │ │ │ │ ├── loading.js │ │ │ │ │ ├── log.js │ │ │ │ │ ├── message.js │ │ │ │ │ ├── node.js │ │ │ │ │ ├── overlayimage.js │ │ │ │ │ ├── progressbar.js │ │ │ │ │ ├── prompt.js │ │ │ │ │ ├── question.js │ │ │ │ │ ├── radiobutton.js │ │ │ │ │ ├── radioset.js │ │ │ │ │ ├── screen.js │ │ │ │ │ ├── scrollablebox.js │ │ │ │ │ ├── scrollabletext.js │ │ │ │ │ ├── table.js │ │ │ │ │ ├── terminal.js │ │ │ │ │ ├── text.js │ │ │ │ │ ├── textarea.js │ │ │ │ │ ├── textbox.js │ │ │ │ │ └── video.js │ │ │ ├── package.json │ │ │ ├── usr │ │ │ │ ├── fonts │ │ │ │ │ ├── AUTHORS │ │ │ │ │ ├── LICENSE │ │ │ │ │ ├── README │ │ │ │ │ ├── ter-u14b.json │ │ │ │ │ └── ter-u14n.json │ │ │ │ ├── linux │ │ │ │ ├── windows-ansi │ │ │ │ ├── xterm │ │ │ │ ├── xterm-256color │ │ │ │ ├── xterm.termcap │ │ │ │ └── xterm.terminfo │ │ │ └── vendor │ │ │ │ └── tng.js │ │ ├── pty.js │ │ │ ├── .npmignore │ │ │ ├── LICENSE │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── binding.gyp │ │ │ ├── build │ │ │ │ ├── Makefile │ │ │ │ ├── Release │ │ │ │ │ ├── .deps │ │ │ │ │ │ └── Release │ │ │ │ │ │ │ ├── obj.target │ │ │ │ │ │ │ └── pty │ │ │ │ │ │ │ │ └── src │ │ │ │ │ │ │ │ └── unix │ │ │ │ │ │ │ │ └── pty.o.d │ │ │ │ │ │ │ └── pty.node.d │ │ │ │ │ ├── obj.target │ │ │ │ │ │ └── pty │ │ │ │ │ │ │ └── src │ │ │ │ │ │ │ └── unix │ │ │ │ │ │ │ └── pty.o │ │ │ │ │ └── pty.node │ │ │ │ ├── binding.Makefile │ │ │ │ ├── config.gypi │ │ │ │ ├── gyp-mac-tool │ │ │ │ └── pty.target.mk │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── pty.js │ │ │ │ └── pty_win.js │ │ │ ├── node_modules │ │ │ │ ├── extend │ │ │ │ │ ├── .npmignore │ │ │ │ │ ├── .travis.yml │ │ │ │ │ ├── README.md │ │ │ │ │ ├── index.js │ │ │ │ │ └── package.json │ │ │ │ └── nan │ │ │ │ │ ├── CHANGELOG.md │ │ │ │ │ ├── LICENSE.md │ │ │ │ │ ├── README.md │ │ │ │ │ ├── doc │ │ │ │ │ ├── asyncworker.md │ │ │ │ │ ├── buffers.md │ │ │ │ │ ├── callback.md │ │ │ │ │ ├── converters.md │ │ │ │ │ ├── errors.md │ │ │ │ │ ├── maybe_types.md │ │ │ │ │ ├── methods.md │ │ │ │ │ ├── new.md │ │ │ │ │ ├── node_misc.md │ │ │ │ │ ├── object_wrappers.md │ │ │ │ │ ├── persistent.md │ │ │ │ │ ├── scopes.md │ │ │ │ │ ├── script.md │ │ │ │ │ ├── string_bytes.md │ │ │ │ │ ├── v8_internals.md │ │ │ │ │ └── v8_misc.md │ │ │ │ │ ├── include_dirs.js │ │ │ │ │ ├── nan.h │ │ │ │ │ ├── nan_callbacks.h │ │ │ │ │ ├── nan_callbacks_12_inl.h │ │ │ │ │ ├── nan_callbacks_pre_12_inl.h │ │ │ │ │ ├── nan_converters.h │ │ │ │ │ ├── nan_converters_43_inl.h │ │ │ │ │ ├── nan_converters_pre_43_inl.h │ │ │ │ │ ├── nan_implementation_12_inl.h │ │ │ │ │ ├── nan_implementation_pre_12_inl.h │ │ │ │ │ ├── nan_maybe_43_inl.h │ │ │ │ │ ├── nan_maybe_pre_43_inl.h │ │ │ │ │ ├── nan_new.h │ │ │ │ │ ├── nan_object_wrap.h │ │ │ │ │ ├── nan_persistent_12_inl.h │ │ │ │ │ ├── nan_persistent_pre_12_inl.h │ │ │ │ │ ├── nan_string_bytes.h │ │ │ │ │ ├── nan_typedarray_contents.h │ │ │ │ │ ├── nan_weak.h │ │ │ │ │ ├── package.json │ │ │ │ │ └── tools │ │ │ │ │ ├── 1to2.js │ │ │ │ │ ├── README.md │ │ │ │ │ └── package.json │ │ │ ├── package.json │ │ │ ├── src │ │ │ │ ├── unix │ │ │ │ │ └── pty.cc │ │ │ │ └── win │ │ │ │ │ └── pty.cc │ │ │ └── wscript │ │ └── term.js │ │ │ ├── .npmignore │ │ │ ├── LICENSE │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── example │ │ │ ├── index.html │ │ │ └── index.js │ │ │ ├── index.js │ │ │ ├── lib │ │ │ └── index.js │ │ │ ├── package.json │ │ │ └── src │ │ │ └── term.js │ │ ├── package.json │ │ └── vendor │ │ └── pxxl.js ├── unmarshal.go └── unmarshal_test.go ├── match ├── .travis.yml ├── LICENSE ├── README.md ├── match.go └── match_test.go └── sjson ├── .travis.yml ├── LICENSE ├── README.md ├── logo.png ├── sjson.go └── sjson_test.go /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Josh Baker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @./build.sh 3 | clean: 4 | @rm -f jd 5 | install: all 6 | @cp jd /usr/local/bin 7 | uninstall: 8 | @rm -f /usr/local/bin/jd 9 | package: 10 | @NOCOPY=1 ./build.sh package 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JD - Interactive JSON Editor 2 | 3 | It's an experimental tool for querying and editing JSON documents. 4 | It's basically a playground to show off the path syntax of [GJSON](https://github.com/tidwall/gjson). 5 | 6 | ![demo-basic](https://github.com/tidwall/jd/wiki/images/demo-basic.gif) 7 | 8 | It's possible to add, delete, and edit any JSON value type. 9 | 10 | ![demo-elements](https://github.com/tidwall/jd/wiki/images/demo-elements.gif) 11 | 12 | 13 | ## Usage 14 | 15 | ```bash 16 | # Read from Stdin 17 | echo '{"id":9851,"name":{"first":"Tom","last":"Anderson"},"friends":["Sandy","Duke","Sam"]}' | jd 18 | 19 | # Read from cURL 20 | curl -s https://api.github.com/repos/tidwall/tile38/issues/23 | jd 21 | 22 | # Read from a file 23 | jd user.json 24 | ``` 25 | 26 | ## Install 27 | 28 | There're pre-built binaries for Mac, Linux, FreeBSD and Windows on the releases page. 29 | 30 | ### Mac (Homebrew) 31 | 32 | ``` 33 | brew tap tidwall/jd 34 | brew install jd 35 | ``` 36 | 37 | ### Build 38 | 39 | ``` 40 | go get -u github.com/tidwall/jd/cmd/jd 41 | ``` 42 | 43 | 44 | For a very fast JSON stream editor, check out [jsoned](https://github.com/tidwall/jsoned). 45 | 46 | ## Contact 47 | Josh Baker [@tidwall](http://twitter.com/tidwall) 48 | 49 | ## License 50 | 51 | JD source code is available under the MIT [License](/LICENSE). 52 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | VERSION="0.3.1" 5 | PROTECTED_MODE="no" 6 | 7 | export GO15VENDOREXPERIMENT=1 8 | 9 | cd $(dirname "${BASH_SOURCE[0]}") 10 | OD="$(pwd)" 11 | WD=$OD 12 | 13 | # temp directory for storing isolated environment. 14 | TMP="$(mktemp -d -t sdb.XXXX)" 15 | function rmtemp { 16 | rm -rf "$TMP" 17 | } 18 | trap rmtemp EXIT 19 | 20 | if [ "$NOCOPY" != "1" ]; then 21 | # copy all files to an isloated directory. 22 | WD="$TMP/src/github.com/tidwall/jd" 23 | export GOPATH="$TMP" 24 | for file in `find . -type f`; do 25 | # TODO: use .gitignore to ignore, or possibly just use git to determine the file list. 26 | if [[ "$file" != "." && "$file" != ./.git* && "$file" != ./jd ]]; then 27 | mkdir -p "$WD/$(dirname "${file}")" 28 | cp -P "$file" "$WD/$(dirname "${file}")" 29 | fi 30 | done 31 | cd $WD 32 | fi 33 | 34 | package(){ 35 | echo Packaging $1 Binary 36 | bdir=jd-${VERSION}-$2-$3 37 | rm -rf packages/$bdir && mkdir -p packages/$bdir 38 | GOOS=$2 GOARCH=$3 ./build.sh 39 | if [ "$2" == "windows" ]; then 40 | mv jd packages/$bdir/jd.exe 41 | else 42 | mv jd packages/$bdir 43 | fi 44 | cp README.md packages/$bdir 45 | cd packages 46 | if [ "$2" == "linux" ]; then 47 | tar -zcf $bdir.tar.gz $bdir 48 | else 49 | zip -r -q $bdir.zip $bdir 50 | fi 51 | rm -rf $bdir 52 | cd .. 53 | } 54 | 55 | if [ "$1" == "package" ]; then 56 | rm -rf packages/ 57 | package "Windows" "windows" "amd64" 58 | package "Mac" "darwin" "amd64" 59 | package "Linux" "linux" "amd64" 60 | package "FreeBSD" "freebsd" "amd64" 61 | exit 62 | fi 63 | 64 | # build and store objects into original directory. 65 | go build -ldflags "-X main.version=$VERSION" -o "$OD/jd" cmd/jd/*.go 66 | 67 | -------------------------------------------------------------------------------- /cmd/jd/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "os" 7 | "strings" 8 | 9 | "github.com/tidwall/jd" 10 | ) 11 | 12 | var ( 13 | usage = ` 14 | jd - JSON Interactive Editor 15 | usage: jd path 16 | 17 | examples: 18 | jd user.json Open a file named 'user.json' 19 | cat user.json | jd Read from stdin 20 | 21 | for more info: https://github.com/tidwall/jd 22 | ` 23 | ) 24 | 25 | func main() { 26 | var path string 27 | if len(os.Args) == 1 { 28 | path = "-" 29 | } else if len(os.Args) == 2 { 30 | if os.Args[1] == "-h" { 31 | fmt.Fprintf(os.Stdout, "%s\n", strings.TrimSpace(usage)) 32 | return 33 | } 34 | path = os.Args[1] 35 | } 36 | if err := jd.Exec(path); err != nil { 37 | log.Fatal(err) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /pretty.go: -------------------------------------------------------------------------------- 1 | package jd 2 | 3 | import gojson "encoding/json" 4 | 5 | func appendPrettyAny(buf, json []byte, i int, pretty bool, width int, indent string, tabs, nl, max int) ([]byte, int, int, bool) { 6 | for ; i < len(json); i++ { 7 | if json[i] <= ' ' { 8 | continue 9 | } 10 | if json[i] == '"' { 11 | return appendPrettyString(buf, json, i, nl) 12 | } 13 | if (json[i] >= '0' && json[i] <= '9') || json[i] == '-' { 14 | return appendPrettyNumber(buf, json, i, nl) 15 | } 16 | if json[i] == '{' { 17 | return appendPrettyObject(buf, json, i, '{', '}', pretty, width, indent, tabs, nl, max) 18 | } 19 | if json[i] == '[' { 20 | return appendPrettyObject(buf, json, i, '[', ']', pretty, width, indent, tabs, nl, max) 21 | } 22 | switch json[i] { 23 | case 't': 24 | return append(buf, 't', 'r', 'u', 'e'), i + 4, nl, true 25 | case 'f': 26 | return append(buf, 'f', 'a', 'l', 's', 'e'), i + 5, nl, true 27 | case 'n': 28 | return append(buf, 'n', 'u', 'l', 'l'), i + 4, nl, true 29 | } 30 | } 31 | return buf, i, nl, true 32 | } 33 | func appendPrettyObject(buf, json []byte, i int, open, close byte, pretty bool, width int, indent string, tabs, nl, max int) ([]byte, int, int, bool) { 34 | var ok bool 35 | if width > 0 { 36 | if pretty && open == '[' && max == -1 { 37 | // here we try to create a single line array 38 | max := width - (len(buf) - nl) 39 | if max > 3 { 40 | s1, s2 := len(buf), i 41 | buf, i, _, ok = appendPrettyObject(buf, json, i, '[', ']', false, width, "", 0, 0, max) 42 | if ok && len(buf)-s1 <= max { 43 | return buf, i, nl, true 44 | } 45 | buf = buf[:s1] 46 | i = s2 47 | } 48 | } else if max != -1 && open == '{' { 49 | return buf, i, nl, false 50 | } 51 | } 52 | buf = append(buf, open) 53 | i++ 54 | var n int 55 | for ; i < len(json); i++ { 56 | if json[i] <= ' ' { 57 | continue 58 | } 59 | if json[i] == close { 60 | if pretty { 61 | if n > 0 { 62 | nl = len(buf) 63 | buf = append(buf, '\n') 64 | } 65 | buf = appendTabs(buf, indent, tabs) 66 | } 67 | buf = append(buf, close) 68 | return buf, i + 1, nl, open != '{' 69 | } 70 | if open == '[' || json[i] == '"' { 71 | if n > 0 { 72 | buf = append(buf, ',') 73 | if width != -1 { 74 | buf = append(buf, ' ') 75 | } 76 | } 77 | if pretty { 78 | nl = len(buf) 79 | buf = append(buf, '\n') 80 | buf = appendTabs(buf, indent, tabs+1) 81 | } 82 | if open == '{' { 83 | buf, i, nl, _ = appendPrettyString(buf, json, i, nl) 84 | buf = append(buf, ':') 85 | if pretty { 86 | buf = append(buf, ' ') 87 | } 88 | } 89 | buf, i, nl, ok = appendPrettyAny(buf, json, i, pretty, width, indent, tabs+1, nl, max) 90 | if max != -1 && !ok { 91 | return buf, i, nl, false 92 | } 93 | i-- 94 | n++ 95 | } 96 | } 97 | return buf, i, nl, open != '{' 98 | } 99 | func appendPrettyString(buf, json []byte, i, nl int) ([]byte, int, int, bool) { 100 | s := i 101 | i++ 102 | for ; i < len(json); i++ { 103 | if json[i] == '"' { 104 | var sc int 105 | for j := i - 1; j > s; j-- { 106 | if json[j] == '\\' { 107 | sc++ 108 | } else { 109 | break 110 | } 111 | } 112 | if sc%2 == 1 { 113 | continue 114 | } 115 | i++ 116 | break 117 | } 118 | } 119 | return append(buf, json[s:i]...), i, nl, true 120 | } 121 | 122 | func appendPrettyNumber(buf, json []byte, i, nl int) ([]byte, int, int, bool) { 123 | s := i 124 | i++ 125 | for ; i < len(json); i++ { 126 | if json[i] <= ' ' || json[i] == ',' || json[i] == ':' || json[i] == ']' || json[i] == '}' { 127 | break 128 | } 129 | } 130 | return append(buf, json[s:i]...), i, nl, true 131 | } 132 | 133 | func appendTabs(buf []byte, indent string, tabs int) []byte { 134 | for i := 0; i < tabs; i++ { 135 | buf = append(buf, ' ', ' ') //indent...) 136 | } 137 | return buf 138 | } 139 | 140 | func pretty(json []byte, width int) []byte { 141 | buf, _, _, _ := appendPrettyAny(nil, json, 0, true, width, " ", 0, 0, -1) 142 | return buf 143 | } 144 | 145 | func ugly(json []byte) []byte { 146 | buf, _, _, _ := appendPrettyAny(nil, json, 0, false, 0, "", 0, 0, -1) 147 | return buf 148 | } 149 | 150 | func valid(json string) bool { 151 | var junk interface{} 152 | return gojson.Unmarshal([]byte(json), &junk) == nil 153 | } 154 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - tip 4 | before_install: 5 | - go get github.com/mattn/goveralls 6 | - go get golang.org/x/tools/cmd/cover 7 | script: 8 | - $HOME/gopath/bin/goveralls -repotoken lAKAWPzcGsD3A8yBX3BGGtRUdJ6CaGERL 9 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Yasuhiro Matsumoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/README.mkd: -------------------------------------------------------------------------------- 1 | go-runewidth 2 | ============ 3 | 4 | [![Build Status](https://travis-ci.org/mattn/go-runewidth.png?branch=master)](https://travis-ci.org/mattn/go-runewidth) 5 | [![Coverage Status](https://coveralls.io/repos/mattn/go-runewidth/badge.png?branch=HEAD)](https://coveralls.io/r/mattn/go-runewidth?branch=HEAD) 6 | [![GoDoc](https://godoc.org/github.com/mattn/go-runewidth?status.svg)](http://godoc.org/github.com/mattn/go-runewidth) 7 | [![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-runewidth)](https://goreportcard.com/report/github.com/mattn/go-runewidth) 8 | 9 | Provides functions to get fixed width of the character or string. 10 | 11 | Usage 12 | ----- 13 | 14 | ```go 15 | runewidth.StringWidth("つのだ☆HIRO") == 12 16 | ``` 17 | 18 | 19 | Author 20 | ------ 21 | 22 | Yasuhiro Matsumoto 23 | 24 | License 25 | ------- 26 | 27 | under the MIT License: http://mattn.mit-license.org/2013 28 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/runewidth_js.go: -------------------------------------------------------------------------------- 1 | // +build js 2 | 3 | package runewidth 4 | 5 | func IsEastAsian() bool { 6 | // TODO: Implement this for the web. Detect east asian in a compatible way, and return true. 7 | return false 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/runewidth_posix.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!js 2 | 3 | package runewidth 4 | 5 | import ( 6 | "os" 7 | "regexp" 8 | "strings" 9 | ) 10 | 11 | var reLoc = regexp.MustCompile(`^[a-z][a-z][a-z]?(?:_[A-Z][A-Z])?\.(.+)`) 12 | 13 | var mblenTable = map[string]int{ 14 | "utf-8": 6, 15 | "utf8": 6, 16 | "jis": 8, 17 | "eucjp": 3, 18 | "euckr": 2, 19 | "euccn": 2, 20 | "sjis": 2, 21 | "cp932": 2, 22 | "cp51932": 2, 23 | "cp936": 2, 24 | "cp949": 2, 25 | "cp950": 2, 26 | "big5": 2, 27 | "gbk": 2, 28 | "gb2312": 2, 29 | } 30 | 31 | func isEastAsian(locale string) bool { 32 | charset := strings.ToLower(locale) 33 | r := reLoc.FindStringSubmatch(locale) 34 | if len(r) == 2 { 35 | charset = strings.ToLower(r[1]) 36 | } 37 | 38 | if strings.HasSuffix(charset, "@cjk_narrow") { 39 | return false 40 | } 41 | 42 | for pos, b := range []byte(charset) { 43 | if b == '@' { 44 | charset = charset[:pos] 45 | break 46 | } 47 | } 48 | max := 1 49 | if m, ok := mblenTable[charset]; ok { 50 | max = m 51 | } 52 | if max > 1 && (charset[0] != 'u' || 53 | strings.HasPrefix(locale, "ja") || 54 | strings.HasPrefix(locale, "ko") || 55 | strings.HasPrefix(locale, "zh")) { 56 | return true 57 | } 58 | return false 59 | } 60 | 61 | // IsEastAsian return true if the current locale is CJK 62 | func IsEastAsian() bool { 63 | locale := os.Getenv("LC_CTYPE") 64 | if locale == "" { 65 | locale = os.Getenv("LANG") 66 | } 67 | 68 | // ignore C locale 69 | if locale == "POSIX" || locale == "C" { 70 | return false 71 | } 72 | if len(locale) > 1 && locale[0] == 'C' && (locale[1] == '.' || locale[1] == '-') { 73 | return false 74 | } 75 | 76 | return isEastAsian(locale) 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/runewidth_windows.go: -------------------------------------------------------------------------------- 1 | package runewidth 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | var ( 8 | kernel32 = syscall.NewLazyDLL("kernel32") 9 | procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP") 10 | ) 11 | 12 | // IsEastAsian return true if the current locale is CJK 13 | func IsEastAsian() bool { 14 | r1, _, _ := procGetConsoleOutputCP.Call() 15 | if r1 == 0 { 16 | return false 17 | } 18 | 19 | switch int(r1) { 20 | case 932, 51932, 936, 949, 950: 21 | return true 22 | } 23 | 24 | return false 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/AUTHORS: -------------------------------------------------------------------------------- 1 | # Please keep this file sorted. 2 | 3 | Georg Reinke 4 | nsf 5 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 termbox-go authors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/README.md: -------------------------------------------------------------------------------- 1 | ## Termbox 2 | Termbox is a library that provides a minimalistic API which allows the programmer to write text-based user interfaces. The library is crossplatform and has both terminal-based implementations on *nix operating systems and a winapi console based implementation for windows operating systems. The basic idea is an abstraction of the greatest common subset of features available on all major terminals and other terminal-like APIs in a minimalistic fashion. Small API means it is easy to implement, test, maintain and learn it, that's what makes the termbox a distinct library in its area. 3 | 4 | ### Installation 5 | Install and update this go package with `go get -u github.com/nsf/termbox-go` 6 | 7 | ### Examples 8 | For examples of what can be done take a look at demos in the _demos directory. You can try them with go run: `go run _demos/keyboard.go` 9 | 10 | There are also some interesting projects using termbox-go: 11 | - [godit](https://github.com/nsf/godit) is an emacsish lightweight text editor written using termbox. 12 | - [gomatrix](https://github.com/GeertJohan/gomatrix) connects to The Matrix and displays its data streams in your terminal. 13 | - [gotetris](https://github.com/jjinux/gotetris) is an implementation of Tetris. 14 | - [sokoban-go](https://github.com/rn2dy/sokoban-go) is an implementation of sokoban game. 15 | - [hecate](https://github.com/evanmiller/hecate) is a hex editor designed by Satan. 16 | - [httopd](https://github.com/verdverm/httopd) is top for httpd logs. 17 | - [mop](https://github.com/michaeldv/mop) is stock market tracker for hackers. 18 | - [termui](https://github.com/gizak/termui) is a terminal dashboard. 19 | - [termloop](https://github.com/JoelOtter/termloop) is a terminal game engine. 20 | - [xterm-color-chart](https://github.com/kutuluk/xterm-color-chart) is a XTerm 256 color chart. 21 | - [gocui](https://github.com/jroimartin/gocui) is a minimalist Go library aimed at creating console user interfaces. 22 | - [dry](https://github.com/moncho/dry) is an interactive cli to manage Docker containers. 23 | - [pxl](https://github.com/ichinaski/pxl) displays images in the terminal. 24 | - [snake-game](https://github.com/DyegoCosta/snake-game) is an implementation of the Snake game. 25 | - [gone](https://github.com/guillaumebreton/gone) is a CLI pomodoro® timer. 26 | - [Spoof.go](https://github.com/sabey/spoofgo) controllable movement spoofing from the cli 27 | - [lf](https://github.com/gokcehan/lf) is a terminal file manager 28 | 29 | ### API reference 30 | [godoc.org/github.com/nsf/termbox-go](http://godoc.org/github.com/nsf/termbox-go) 31 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/_demos/interrupt.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/nsf/termbox-go" 6 | "time" 7 | ) 8 | 9 | func tbPrint(x, y int, fg, bg termbox.Attribute, msg string) { 10 | for _, c := range msg { 11 | termbox.SetCell(x, y, c, fg, bg) 12 | x++ 13 | } 14 | } 15 | 16 | func draw(i int) { 17 | termbox.Clear(termbox.ColorDefault, termbox.ColorDefault) 18 | defer termbox.Flush() 19 | 20 | w, h := termbox.Size() 21 | s := fmt.Sprintf("count = %d", i) 22 | 23 | tbPrint((w/2)-(len(s)/2), h/2, termbox.ColorRed, termbox.ColorDefault, s) 24 | } 25 | 26 | func main() { 27 | err := termbox.Init() 28 | if err != nil { 29 | panic(err) 30 | } 31 | termbox.SetInputMode(termbox.InputEsc) 32 | 33 | go func() { 34 | time.Sleep(5 * time.Second) 35 | termbox.Interrupt() 36 | 37 | // This should never run - the Interrupt(), above, should cause the event 38 | // loop below to exit, which then exits the process. If something goes 39 | // wrong, this panic will trigger and show what happened. 40 | time.Sleep(1 * time.Second) 41 | panic("this should never run") 42 | }() 43 | 44 | var count int 45 | 46 | draw(count) 47 | mainloop: 48 | for { 49 | switch ev := termbox.PollEvent(); ev.Type { 50 | case termbox.EventKey: 51 | if ev.Ch == '+' { 52 | count++ 53 | } else if ev.Ch == '-' { 54 | count-- 55 | } 56 | 57 | case termbox.EventError: 58 | panic(ev.Err) 59 | 60 | case termbox.EventInterrupt: 61 | break mainloop 62 | } 63 | 64 | draw(count) 65 | } 66 | termbox.Close() 67 | 68 | fmt.Println("Finished") 69 | } 70 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/_demos/paint.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/nsf/termbox-go" 5 | ) 6 | 7 | var curCol = 0 8 | var curRune = 0 9 | var backbuf []termbox.Cell 10 | var bbw, bbh int 11 | 12 | var runes = []rune{' ', '░', '▒', '▓', '█'} 13 | var colors = []termbox.Attribute{ 14 | termbox.ColorBlack, 15 | termbox.ColorRed, 16 | termbox.ColorGreen, 17 | termbox.ColorYellow, 18 | termbox.ColorBlue, 19 | termbox.ColorMagenta, 20 | termbox.ColorCyan, 21 | termbox.ColorWhite, 22 | } 23 | 24 | type attrFunc func(int) (rune, termbox.Attribute, termbox.Attribute) 25 | 26 | func updateAndDrawButtons(current *int, x, y int, mx, my int, n int, attrf attrFunc) { 27 | lx, ly := x, y 28 | for i := 0; i < n; i++ { 29 | if lx <= mx && mx <= lx+3 && ly <= my && my <= ly+1 { 30 | *current = i 31 | } 32 | r, fg, bg := attrf(i) 33 | termbox.SetCell(lx+0, ly+0, r, fg, bg) 34 | termbox.SetCell(lx+1, ly+0, r, fg, bg) 35 | termbox.SetCell(lx+2, ly+0, r, fg, bg) 36 | termbox.SetCell(lx+3, ly+0, r, fg, bg) 37 | termbox.SetCell(lx+0, ly+1, r, fg, bg) 38 | termbox.SetCell(lx+1, ly+1, r, fg, bg) 39 | termbox.SetCell(lx+2, ly+1, r, fg, bg) 40 | termbox.SetCell(lx+3, ly+1, r, fg, bg) 41 | lx += 4 42 | } 43 | lx, ly = x, y 44 | for i := 0; i < n; i++ { 45 | if *current == i { 46 | fg := termbox.ColorRed | termbox.AttrBold 47 | bg := termbox.ColorDefault 48 | termbox.SetCell(lx+0, ly+2, '^', fg, bg) 49 | termbox.SetCell(lx+1, ly+2, '^', fg, bg) 50 | termbox.SetCell(lx+2, ly+2, '^', fg, bg) 51 | termbox.SetCell(lx+3, ly+2, '^', fg, bg) 52 | } 53 | lx += 4 54 | } 55 | } 56 | 57 | func update_and_redraw_all(mx, my int) { 58 | termbox.Clear(termbox.ColorDefault, termbox.ColorDefault) 59 | if mx != -1 && my != -1 { 60 | backbuf[bbw*my+mx] = termbox.Cell{Ch: runes[curRune], Fg: colors[curCol]} 61 | } 62 | copy(termbox.CellBuffer(), backbuf) 63 | _, h := termbox.Size() 64 | updateAndDrawButtons(&curRune, 0, 0, mx, my, len(runes), func(i int) (rune, termbox.Attribute, termbox.Attribute) { 65 | return runes[i], termbox.ColorDefault, termbox.ColorDefault 66 | }) 67 | updateAndDrawButtons(&curCol, 0, h-3, mx, my, len(colors), func(i int) (rune, termbox.Attribute, termbox.Attribute) { 68 | return ' ', termbox.ColorDefault, colors[i] 69 | }) 70 | termbox.Flush() 71 | } 72 | 73 | func reallocBackBuffer(w, h int) { 74 | bbw, bbh = w, h 75 | backbuf = make([]termbox.Cell, w*h) 76 | } 77 | 78 | func main() { 79 | err := termbox.Init() 80 | if err != nil { 81 | panic(err) 82 | } 83 | defer termbox.Close() 84 | termbox.SetInputMode(termbox.InputEsc | termbox.InputMouse) 85 | reallocBackBuffer(termbox.Size()) 86 | update_and_redraw_all(-1, -1) 87 | 88 | mainloop: 89 | for { 90 | mx, my := -1, -1 91 | switch ev := termbox.PollEvent(); ev.Type { 92 | case termbox.EventKey: 93 | if ev.Key == termbox.KeyEsc { 94 | break mainloop 95 | } 96 | case termbox.EventMouse: 97 | if ev.Key == termbox.MouseLeft { 98 | mx, my = ev.MouseX, ev.MouseY 99 | } 100 | case termbox.EventResize: 101 | reallocBackBuffer(ev.Width, ev.Height) 102 | } 103 | update_and_redraw_all(mx, my) 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/_demos/random_output.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/nsf/termbox-go" 4 | import "math/rand" 5 | import "time" 6 | 7 | func draw() { 8 | w, h := termbox.Size() 9 | termbox.Clear(termbox.ColorDefault, termbox.ColorDefault) 10 | for y := 0; y < h; y++ { 11 | for x := 0; x < w; x++ { 12 | termbox.SetCell(x, y, ' ', termbox.ColorDefault, 13 | termbox.Attribute(rand.Int()%8)+1) 14 | } 15 | } 16 | termbox.Flush() 17 | } 18 | 19 | func main() { 20 | err := termbox.Init() 21 | if err != nil { 22 | panic(err) 23 | } 24 | defer termbox.Close() 25 | 26 | event_queue := make(chan termbox.Event) 27 | go func() { 28 | for { 29 | event_queue <- termbox.PollEvent() 30 | } 31 | }() 32 | 33 | draw() 34 | loop: 35 | for { 36 | select { 37 | case ev := <-event_queue: 38 | if ev.Type == termbox.EventKey && ev.Key == termbox.KeyEsc { 39 | break loop 40 | } 41 | default: 42 | draw() 43 | time.Sleep(10 * time.Millisecond) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/_demos/raw_input.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/nsf/termbox-go" 6 | "strings" 7 | ) 8 | 9 | func tbprint(x, y int, fg, bg termbox.Attribute, msg string) { 10 | for _, c := range msg { 11 | termbox.SetCell(x, y, c, fg, bg) 12 | x++ 13 | } 14 | } 15 | 16 | var current string 17 | var curev termbox.Event 18 | 19 | func mouse_button_str(k termbox.Key) string { 20 | switch k { 21 | case termbox.MouseLeft: 22 | return "MouseLeft" 23 | case termbox.MouseMiddle: 24 | return "MouseMiddle" 25 | case termbox.MouseRight: 26 | return "MouseRight" 27 | case termbox.MouseRelease: 28 | return "MouseRelease" 29 | case termbox.MouseWheelUp: 30 | return "MouseWheelUp" 31 | case termbox.MouseWheelDown: 32 | return "MouseWheelDown" 33 | } 34 | return "Key" 35 | } 36 | 37 | func mod_str(m termbox.Modifier) string { 38 | var out []string 39 | if m&termbox.ModAlt != 0 { 40 | out = append(out, "ModAlt") 41 | } 42 | if m&termbox.ModMotion != 0 { 43 | out = append(out, "ModMotion") 44 | } 45 | return strings.Join(out, " | ") 46 | } 47 | 48 | func redraw_all() { 49 | const coldef = termbox.ColorDefault 50 | termbox.Clear(coldef, coldef) 51 | tbprint(0, 0, termbox.ColorMagenta, coldef, "Press 'q' to quit") 52 | tbprint(0, 1, coldef, coldef, current) 53 | switch curev.Type { 54 | case termbox.EventKey: 55 | tbprint(0, 2, coldef, coldef, 56 | fmt.Sprintf("EventKey: k: %d, c: %c, mod: %s", curev.Key, curev.Ch, mod_str(curev.Mod))) 57 | case termbox.EventMouse: 58 | tbprint(0, 2, coldef, coldef, 59 | fmt.Sprintf("EventMouse: x: %d, y: %d, b: %s, mod: %s", 60 | curev.MouseX, curev.MouseY, mouse_button_str(curev.Key), mod_str(curev.Mod))) 61 | case termbox.EventNone: 62 | tbprint(0, 2, coldef, coldef, "EventNone") 63 | } 64 | tbprint(0, 3, coldef, coldef, fmt.Sprintf("%d", curev.N)) 65 | termbox.Flush() 66 | } 67 | 68 | func main() { 69 | err := termbox.Init() 70 | if err != nil { 71 | panic(err) 72 | } 73 | defer termbox.Close() 74 | termbox.SetInputMode(termbox.InputAlt | termbox.InputMouse) 75 | redraw_all() 76 | 77 | data := make([]byte, 0, 64) 78 | mainloop: 79 | for { 80 | if cap(data)-len(data) < 32 { 81 | newdata := make([]byte, len(data), len(data)+32) 82 | copy(newdata, data) 83 | data = newdata 84 | } 85 | beg := len(data) 86 | d := data[beg : beg+32] 87 | switch ev := termbox.PollRawEvent(d); ev.Type { 88 | case termbox.EventRaw: 89 | data = data[:beg+ev.N] 90 | current = fmt.Sprintf("%q", data) 91 | if current == `"q"` { 92 | break mainloop 93 | } 94 | 95 | for { 96 | ev := termbox.ParseEvent(data) 97 | if ev.N == 0 { 98 | break 99 | } 100 | curev = ev 101 | copy(data, data[curev.N:]) 102 | data = data[:len(data)-curev.N] 103 | } 104 | case termbox.EventError: 105 | panic(ev.Err) 106 | } 107 | redraw_all() 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/collect_terminfo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys, os, subprocess 4 | 5 | def escaped(s): 6 | return repr(s)[1:-1] 7 | 8 | def tput(term, name): 9 | try: 10 | return subprocess.check_output(['tput', '-T%s' % term, name]).decode() 11 | except subprocess.CalledProcessError as e: 12 | return e.output.decode() 13 | 14 | 15 | def w(s): 16 | if s == None: 17 | return 18 | sys.stdout.write(s) 19 | 20 | terminals = { 21 | 'xterm' : 'xterm', 22 | 'rxvt-256color' : 'rxvt_256color', 23 | 'rxvt-unicode' : 'rxvt_unicode', 24 | 'linux' : 'linux', 25 | 'Eterm' : 'eterm', 26 | 'screen' : 'screen' 27 | } 28 | 29 | keys = [ 30 | "F1", "kf1", 31 | "F2", "kf2", 32 | "F3", "kf3", 33 | "F4", "kf4", 34 | "F5", "kf5", 35 | "F6", "kf6", 36 | "F7", "kf7", 37 | "F8", "kf8", 38 | "F9", "kf9", 39 | "F10", "kf10", 40 | "F11", "kf11", 41 | "F12", "kf12", 42 | "INSERT", "kich1", 43 | "DELETE", "kdch1", 44 | "HOME", "khome", 45 | "END", "kend", 46 | "PGUP", "kpp", 47 | "PGDN", "knp", 48 | "KEY_UP", "kcuu1", 49 | "KEY_DOWN", "kcud1", 50 | "KEY_LEFT", "kcub1", 51 | "KEY_RIGHT", "kcuf1" 52 | ] 53 | 54 | funcs = [ 55 | "T_ENTER_CA", "smcup", 56 | "T_EXIT_CA", "rmcup", 57 | "T_SHOW_CURSOR", "cnorm", 58 | "T_HIDE_CURSOR", "civis", 59 | "T_CLEAR_SCREEN", "clear", 60 | "T_SGR0", "sgr0", 61 | "T_UNDERLINE", "smul", 62 | "T_BOLD", "bold", 63 | "T_BLINK", "blink", 64 | "T_REVERSE", "rev", 65 | "T_ENTER_KEYPAD", "smkx", 66 | "T_EXIT_KEYPAD", "rmkx" 67 | ] 68 | 69 | def iter_pairs(iterable): 70 | iterable = iter(iterable) 71 | while True: 72 | yield (next(iterable), next(iterable)) 73 | 74 | def do_term(term, nick): 75 | w("// %s\n" % term) 76 | w("var %s_keys = []string{\n\t" % nick) 77 | for k, v in iter_pairs(keys): 78 | w('"') 79 | w(escaped(tput(term, v))) 80 | w('",') 81 | w("\n}\n") 82 | w("var %s_funcs = []string{\n\t" % nick) 83 | for k,v in iter_pairs(funcs): 84 | w('"') 85 | if v == "sgr": 86 | w("\\033[3%d;4%dm") 87 | elif v == "cup": 88 | w("\\033[%d;%dH") 89 | else: 90 | w(escaped(tput(term, v))) 91 | w('", ') 92 | w("\n}\n\n") 93 | 94 | def do_terms(d): 95 | w("var terms = []struct {\n") 96 | w("\tname string\n") 97 | w("\tkeys []string\n") 98 | w("\tfuncs []string\n") 99 | w("}{\n") 100 | for k, v in d.items(): 101 | w('\t{"%s", %s_keys, %s_funcs},\n' % (k, v, v)) 102 | w("}\n\n") 103 | 104 | w("// +build !windows\n\npackage termbox\n\n") 105 | 106 | for k,v in terminals.items(): 107 | do_term(k, v) 108 | 109 | do_terms(terminals) 110 | 111 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/syscalls.go: -------------------------------------------------------------------------------- 1 | // +build ignore 2 | 3 | package termbox 4 | 5 | /* 6 | #include 7 | #include 8 | */ 9 | import "C" 10 | 11 | type syscall_Termios C.struct_termios 12 | 13 | const ( 14 | syscall_IGNBRK = C.IGNBRK 15 | syscall_BRKINT = C.BRKINT 16 | syscall_PARMRK = C.PARMRK 17 | syscall_ISTRIP = C.ISTRIP 18 | syscall_INLCR = C.INLCR 19 | syscall_IGNCR = C.IGNCR 20 | syscall_ICRNL = C.ICRNL 21 | syscall_IXON = C.IXON 22 | syscall_OPOST = C.OPOST 23 | syscall_ECHO = C.ECHO 24 | syscall_ECHONL = C.ECHONL 25 | syscall_ICANON = C.ICANON 26 | syscall_ISIG = C.ISIG 27 | syscall_IEXTEN = C.IEXTEN 28 | syscall_CSIZE = C.CSIZE 29 | syscall_PARENB = C.PARENB 30 | syscall_CS8 = C.CS8 31 | syscall_VMIN = C.VMIN 32 | syscall_VTIME = C.VTIME 33 | 34 | // on darwin change these to (on *bsd too?): 35 | // C.TIOCGETA 36 | // C.TIOCSETA 37 | syscall_TCGETS = C.TCGETS 38 | syscall_TCSETS = C.TCSETS 39 | ) 40 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/syscalls_darwin.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | // +build !amd64 5 | 6 | package termbox 7 | 8 | type syscall_Termios struct { 9 | Iflag uint32 10 | Oflag uint32 11 | Cflag uint32 12 | Lflag uint32 13 | Cc [20]uint8 14 | Ispeed uint32 15 | Ospeed uint32 16 | } 17 | 18 | const ( 19 | syscall_IGNBRK = 0x1 20 | syscall_BRKINT = 0x2 21 | syscall_PARMRK = 0x8 22 | syscall_ISTRIP = 0x20 23 | syscall_INLCR = 0x40 24 | syscall_IGNCR = 0x80 25 | syscall_ICRNL = 0x100 26 | syscall_IXON = 0x200 27 | syscall_OPOST = 0x1 28 | syscall_ECHO = 0x8 29 | syscall_ECHONL = 0x10 30 | syscall_ICANON = 0x100 31 | syscall_ISIG = 0x80 32 | syscall_IEXTEN = 0x400 33 | syscall_CSIZE = 0x300 34 | syscall_PARENB = 0x1000 35 | syscall_CS8 = 0x300 36 | syscall_VMIN = 0x10 37 | syscall_VTIME = 0x11 38 | 39 | syscall_TCGETS = 0x402c7413 40 | syscall_TCSETS = 0x802c7414 41 | ) 42 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/syscalls_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | type syscall_Termios struct { 7 | Iflag uint64 8 | Oflag uint64 9 | Cflag uint64 10 | Lflag uint64 11 | Cc [20]uint8 12 | Pad_cgo_0 [4]byte 13 | Ispeed uint64 14 | Ospeed uint64 15 | } 16 | 17 | const ( 18 | syscall_IGNBRK = 0x1 19 | syscall_BRKINT = 0x2 20 | syscall_PARMRK = 0x8 21 | syscall_ISTRIP = 0x20 22 | syscall_INLCR = 0x40 23 | syscall_IGNCR = 0x80 24 | syscall_ICRNL = 0x100 25 | syscall_IXON = 0x200 26 | syscall_OPOST = 0x1 27 | syscall_ECHO = 0x8 28 | syscall_ECHONL = 0x10 29 | syscall_ICANON = 0x100 30 | syscall_ISIG = 0x80 31 | syscall_IEXTEN = 0x400 32 | syscall_CSIZE = 0x300 33 | syscall_PARENB = 0x1000 34 | syscall_CS8 = 0x300 35 | syscall_VMIN = 0x10 36 | syscall_VTIME = 0x11 37 | 38 | syscall_TCGETS = 0x40487413 39 | syscall_TCSETS = 0x80487414 40 | ) 41 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/syscalls_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | type syscall_Termios struct { 7 | Iflag uint32 8 | Oflag uint32 9 | Cflag uint32 10 | Lflag uint32 11 | Cc [20]uint8 12 | Ispeed uint32 13 | Ospeed uint32 14 | } 15 | 16 | const ( 17 | syscall_IGNBRK = 0x1 18 | syscall_BRKINT = 0x2 19 | syscall_PARMRK = 0x8 20 | syscall_ISTRIP = 0x20 21 | syscall_INLCR = 0x40 22 | syscall_IGNCR = 0x80 23 | syscall_ICRNL = 0x100 24 | syscall_IXON = 0x200 25 | syscall_OPOST = 0x1 26 | syscall_ECHO = 0x8 27 | syscall_ECHONL = 0x10 28 | syscall_ICANON = 0x100 29 | syscall_ISIG = 0x80 30 | syscall_IEXTEN = 0x400 31 | syscall_CSIZE = 0x300 32 | syscall_PARENB = 0x1000 33 | syscall_CS8 = 0x300 34 | syscall_VMIN = 0x10 35 | syscall_VTIME = 0x11 36 | 37 | syscall_TCGETS = 0x402c7413 38 | syscall_TCSETS = 0x802c7414 39 | ) 40 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/syscalls_freebsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | type syscall_Termios struct { 7 | Iflag uint32 8 | Oflag uint32 9 | Cflag uint32 10 | Lflag uint32 11 | Cc [20]uint8 12 | Ispeed uint32 13 | Ospeed uint32 14 | } 15 | 16 | const ( 17 | syscall_IGNBRK = 0x1 18 | syscall_BRKINT = 0x2 19 | syscall_PARMRK = 0x8 20 | syscall_ISTRIP = 0x20 21 | syscall_INLCR = 0x40 22 | syscall_IGNCR = 0x80 23 | syscall_ICRNL = 0x100 24 | syscall_IXON = 0x200 25 | syscall_OPOST = 0x1 26 | syscall_ECHO = 0x8 27 | syscall_ECHONL = 0x10 28 | syscall_ICANON = 0x100 29 | syscall_ISIG = 0x80 30 | syscall_IEXTEN = 0x400 31 | syscall_CSIZE = 0x300 32 | syscall_PARENB = 0x1000 33 | syscall_CS8 = 0x300 34 | syscall_VMIN = 0x10 35 | syscall_VTIME = 0x11 36 | 37 | syscall_TCGETS = 0x402c7413 38 | syscall_TCSETS = 0x802c7414 39 | ) 40 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/syscalls_linux.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | import "syscall" 7 | 8 | type syscall_Termios syscall.Termios 9 | 10 | const ( 11 | syscall_IGNBRK = syscall.IGNBRK 12 | syscall_BRKINT = syscall.BRKINT 13 | syscall_PARMRK = syscall.PARMRK 14 | syscall_ISTRIP = syscall.ISTRIP 15 | syscall_INLCR = syscall.INLCR 16 | syscall_IGNCR = syscall.IGNCR 17 | syscall_ICRNL = syscall.ICRNL 18 | syscall_IXON = syscall.IXON 19 | syscall_OPOST = syscall.OPOST 20 | syscall_ECHO = syscall.ECHO 21 | syscall_ECHONL = syscall.ECHONL 22 | syscall_ICANON = syscall.ICANON 23 | syscall_ISIG = syscall.ISIG 24 | syscall_IEXTEN = syscall.IEXTEN 25 | syscall_CSIZE = syscall.CSIZE 26 | syscall_PARENB = syscall.PARENB 27 | syscall_CS8 = syscall.CS8 28 | syscall_VMIN = syscall.VMIN 29 | syscall_VTIME = syscall.VTIME 30 | 31 | syscall_TCGETS = syscall.TCGETS 32 | syscall_TCSETS = syscall.TCSETS 33 | ) 34 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/syscalls_netbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | type syscall_Termios struct { 7 | Iflag uint32 8 | Oflag uint32 9 | Cflag uint32 10 | Lflag uint32 11 | Cc [20]uint8 12 | Ispeed int32 13 | Ospeed int32 14 | } 15 | 16 | const ( 17 | syscall_IGNBRK = 0x1 18 | syscall_BRKINT = 0x2 19 | syscall_PARMRK = 0x8 20 | syscall_ISTRIP = 0x20 21 | syscall_INLCR = 0x40 22 | syscall_IGNCR = 0x80 23 | syscall_ICRNL = 0x100 24 | syscall_IXON = 0x200 25 | syscall_OPOST = 0x1 26 | syscall_ECHO = 0x8 27 | syscall_ECHONL = 0x10 28 | syscall_ICANON = 0x100 29 | syscall_ISIG = 0x80 30 | syscall_IEXTEN = 0x400 31 | syscall_CSIZE = 0x300 32 | syscall_PARENB = 0x1000 33 | syscall_CS8 = 0x300 34 | syscall_VMIN = 0x10 35 | syscall_VTIME = 0x11 36 | 37 | syscall_TCGETS = 0x402c7413 38 | syscall_TCSETS = 0x802c7414 39 | ) 40 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/syscalls_openbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | type syscall_Termios struct { 7 | Iflag uint32 8 | Oflag uint32 9 | Cflag uint32 10 | Lflag uint32 11 | Cc [20]uint8 12 | Ispeed int32 13 | Ospeed int32 14 | } 15 | 16 | const ( 17 | syscall_IGNBRK = 0x1 18 | syscall_BRKINT = 0x2 19 | syscall_PARMRK = 0x8 20 | syscall_ISTRIP = 0x20 21 | syscall_INLCR = 0x40 22 | syscall_IGNCR = 0x80 23 | syscall_ICRNL = 0x100 24 | syscall_IXON = 0x200 25 | syscall_OPOST = 0x1 26 | syscall_ECHO = 0x8 27 | syscall_ECHONL = 0x10 28 | syscall_ICANON = 0x100 29 | syscall_ISIG = 0x80 30 | syscall_IEXTEN = 0x400 31 | syscall_CSIZE = 0x300 32 | syscall_PARENB = 0x1000 33 | syscall_CS8 = 0x300 34 | syscall_VMIN = 0x10 35 | syscall_VTIME = 0x11 36 | 37 | syscall_TCGETS = 0x402c7413 38 | syscall_TCSETS = 0x802c7414 39 | ) 40 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/syscalls_windows.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs -- -DUNICODE syscalls.go 3 | 4 | package termbox 5 | 6 | const ( 7 | foreground_blue = 0x1 8 | foreground_green = 0x2 9 | foreground_red = 0x4 10 | foreground_intensity = 0x8 11 | background_blue = 0x10 12 | background_green = 0x20 13 | background_red = 0x40 14 | background_intensity = 0x80 15 | std_input_handle = -0xa 16 | std_output_handle = -0xb 17 | key_event = 0x1 18 | mouse_event = 0x2 19 | window_buffer_size_event = 0x4 20 | enable_window_input = 0x8 21 | enable_mouse_input = 0x10 22 | enable_extended_flags = 0x80 23 | 24 | vk_f1 = 0x70 25 | vk_f2 = 0x71 26 | vk_f3 = 0x72 27 | vk_f4 = 0x73 28 | vk_f5 = 0x74 29 | vk_f6 = 0x75 30 | vk_f7 = 0x76 31 | vk_f8 = 0x77 32 | vk_f9 = 0x78 33 | vk_f10 = 0x79 34 | vk_f11 = 0x7a 35 | vk_f12 = 0x7b 36 | vk_insert = 0x2d 37 | vk_delete = 0x2e 38 | vk_home = 0x24 39 | vk_end = 0x23 40 | vk_pgup = 0x21 41 | vk_pgdn = 0x22 42 | vk_arrow_up = 0x26 43 | vk_arrow_down = 0x28 44 | vk_arrow_left = 0x25 45 | vk_arrow_right = 0x27 46 | vk_backspace = 0x8 47 | vk_tab = 0x9 48 | vk_enter = 0xd 49 | vk_esc = 0x1b 50 | vk_space = 0x20 51 | 52 | left_alt_pressed = 0x2 53 | left_ctrl_pressed = 0x8 54 | right_alt_pressed = 0x1 55 | right_ctrl_pressed = 0x4 56 | shift_pressed = 0x10 57 | 58 | generic_read = 0x80000000 59 | generic_write = 0x40000000 60 | console_textmode_buffer = 0x1 61 | ) 62 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/termbox_common.go: -------------------------------------------------------------------------------- 1 | package termbox 2 | 3 | // private API, common OS agnostic part 4 | 5 | type cellbuf struct { 6 | width int 7 | height int 8 | cells []Cell 9 | } 10 | 11 | func (this *cellbuf) init(width, height int) { 12 | this.width = width 13 | this.height = height 14 | this.cells = make([]Cell, width*height) 15 | } 16 | 17 | func (this *cellbuf) resize(width, height int) { 18 | if this.width == width && this.height == height { 19 | return 20 | } 21 | 22 | oldw := this.width 23 | oldh := this.height 24 | oldcells := this.cells 25 | 26 | this.init(width, height) 27 | this.clear() 28 | 29 | minw, minh := oldw, oldh 30 | 31 | if width < minw { 32 | minw = width 33 | } 34 | if height < minh { 35 | minh = height 36 | } 37 | 38 | for i := 0; i < minh; i++ { 39 | srco, dsto := i*oldw, i*width 40 | src := oldcells[srco : srco+minw] 41 | dst := this.cells[dsto : dsto+minw] 42 | copy(dst, src) 43 | } 44 | } 45 | 46 | func (this *cellbuf) clear() { 47 | for i := range this.cells { 48 | c := &this.cells[i] 49 | c.Ch = ' ' 50 | c.Fg = foreground 51 | c.Bg = background 52 | } 53 | } 54 | 55 | const cursor_hidden = -1 56 | 57 | func is_cursor_hidden(x, y int) bool { 58 | return x == cursor_hidden || y == cursor_hidden 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/nsf/termbox-go/terminfo_builtin.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package termbox 4 | 5 | // Eterm 6 | var eterm_keys = []string{ 7 | "\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C", 8 | } 9 | var eterm_funcs = []string{ 10 | "\x1b7\x1b[?47h", "\x1b[2J\x1b[?47l\x1b8", "\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b[m\x0f", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "", "", "", "", 11 | } 12 | 13 | // screen 14 | var screen_keys = []string{ 15 | "\x1bOP", "\x1bOQ", "\x1bOR", "\x1bOS", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[1~", "\x1b[4~", "\x1b[5~", "\x1b[6~", "\x1bOA", "\x1bOB", "\x1bOD", "\x1bOC", 16 | } 17 | var screen_funcs = []string{ 18 | "\x1b[?1049h", "\x1b[?1049l", "\x1b[34h\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[J", "\x1b[m\x0f", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b[?1h\x1b=", "\x1b[?1l\x1b>", ti_mouse_enter, ti_mouse_leave, 19 | } 20 | 21 | // xterm 22 | var xterm_keys = []string{ 23 | "\x1bOP", "\x1bOQ", "\x1bOR", "\x1bOS", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1bOH", "\x1bOF", "\x1b[5~", "\x1b[6~", "\x1bOA", "\x1bOB", "\x1bOD", "\x1bOC", 24 | } 25 | var xterm_funcs = []string{ 26 | "\x1b[?1049h", "\x1b[?1049l", "\x1b[?12l\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b(B\x1b[m", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b[?1h\x1b=", "\x1b[?1l\x1b>", ti_mouse_enter, ti_mouse_leave, 27 | } 28 | 29 | // rxvt-unicode 30 | var rxvt_unicode_keys = []string{ 31 | "\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C", 32 | } 33 | var rxvt_unicode_funcs = []string{ 34 | "\x1b[?1049h", "\x1b[r\x1b[?1049l", "\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b[m\x1b(B", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b=", "\x1b>", ti_mouse_enter, ti_mouse_leave, 35 | } 36 | 37 | // linux 38 | var linux_keys = []string{ 39 | "\x1b[[A", "\x1b[[B", "\x1b[[C", "\x1b[[D", "\x1b[[E", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[1~", "\x1b[4~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C", 40 | } 41 | var linux_funcs = []string{ 42 | "", "", "\x1b[?25h\x1b[?0c", "\x1b[?25l\x1b[?1c", "\x1b[H\x1b[J", "\x1b[0;10m", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "", "", "", "", 43 | } 44 | 45 | // rxvt-256color 46 | var rxvt_256color_keys = []string{ 47 | "\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C", 48 | } 49 | var rxvt_256color_funcs = []string{ 50 | "\x1b7\x1b[?47h", "\x1b[2J\x1b[?47l\x1b8", "\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b[m\x0f", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b=", "\x1b>", ti_mouse_enter, ti_mouse_leave, 51 | } 52 | 53 | var terms = []struct { 54 | name string 55 | keys []string 56 | funcs []string 57 | }{ 58 | {"Eterm", eterm_keys, eterm_funcs}, 59 | {"screen", screen_keys, screen_funcs}, 60 | {"xterm", xterm_keys, xterm_funcs}, 61 | {"rxvt-unicode", rxvt_unicode_keys, rxvt_unicode_funcs}, 62 | {"linux", linux_keys, linux_funcs}, 63 | {"rxvt-256color", rxvt_256color_keys, rxvt_256color_funcs}, 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/123: -------------------------------------------------------------------------------- 1 | asdf 2 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Josh Baker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tidwall/jd/42fe71a941b1caca2811a7c7ca52b498a13bbee0/vendor/github.com/tidwall/gjson/logo.png -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/.bin/ttystudio: -------------------------------------------------------------------------------- 1 | ../ttystudio/bin/ttystudio -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/.npmignore: -------------------------------------------------------------------------------- 1 | .git* 2 | test/ 3 | img/ 4 | node_modules/ 5 | *.gif 6 | *.png 7 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Christopher Jeffrey 2 | https://github.com/chjj/ttystudio 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/bin/ttystudio: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * ttystudio - recorder and compiler for ttystudio 5 | * Copyright (c) 2015, Christopher Jeffrey (MIT License). 6 | * https://github.com/chjj/ttystudio 7 | */ 8 | 9 | var fs = require('fs') 10 | , options = require('../lib/options'); 11 | 12 | /** 13 | * Title 14 | */ 15 | 16 | process.title = 'ttystudio'; 17 | 18 | /** 19 | * Compile 20 | */ 21 | 22 | function compile(options) { 23 | var compiler = require('../lib/compile'); 24 | return compiler(options, function(err) { 25 | if (err) return fail(err); 26 | }); 27 | } 28 | 29 | /** 30 | * Record 31 | */ 32 | 33 | function record(options) { 34 | var recorder = require('../lib/record') 35 | , compiler = require('../lib/compile'); 36 | 37 | return recorder(options, function(err, frames) { 38 | if (err) return fail(err); 39 | 40 | var output = options.files[0] || options.o || options.output 41 | , json = JSON.stringify(frames); 42 | 43 | if (!output) { 44 | return fail('Error: No output file specified.'); 45 | } 46 | 47 | if (~output.indexOf('.json')) { 48 | log('wrote frames to %s', output); 49 | fs.writeFileSync(output, json); 50 | return process.exit(0); 51 | } 52 | 53 | fs.writeFileSync(output.replace(/\.\w+$/, '') + '.frames.json', json); 54 | 55 | if (options.screenshot) { 56 | var pending = frames.length; 57 | return frames.forEach(function(frame, i) { 58 | options.files = [[frame], i + '-' + output]; 59 | return compiler(options, function(err) { 60 | if (err) return fail(err); 61 | if (!--pending) { 62 | return process.stdin.end(); 63 | } 64 | }); 65 | }); 66 | } 67 | 68 | options.files = [frames, output]; 69 | 70 | return compiler(options, function(err) { 71 | if (err) return fail(err); 72 | }); 73 | }); 74 | } 75 | 76 | /** 77 | * Play 78 | */ 79 | 80 | function play(options) { 81 | var player = require('../lib/play'); 82 | 83 | return player(options, function(err) { 84 | if (err) return fail(err); 85 | }); 86 | } 87 | 88 | /** 89 | * Main 90 | */ 91 | 92 | function main(options) { 93 | if (options.compile || (options.files.length === 2)) { 94 | return compile(options); 95 | } 96 | if (options.record) { 97 | return record(options); 98 | } 99 | if (options.play) { 100 | return play(options); 101 | } 102 | return record(options); 103 | } 104 | 105 | /** 106 | * Helpers 107 | */ 108 | 109 | function log() { 110 | if (!options.log) return; 111 | return console.error.apply(console, arguments); 112 | } 113 | 114 | function fail(err) { 115 | console.error(err.message || err); 116 | return process.exit(1); 117 | } 118 | 119 | /** 120 | * Expose 121 | */ 122 | 123 | if (!module.parent) { 124 | main(options); 125 | } else { 126 | exports = main; 127 | exports.main = main; 128 | exports.compile = compile; 129 | exports.record = record; 130 | exports.play = play; 131 | exports.studio = require('../'); 132 | module.exports = exports; 133 | } 134 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/fonts/AUTHORS: -------------------------------------------------------------------------------- 1 | Dimitar Zhekov 2 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/fonts/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @node . --silent *.bdf 3 | 4 | clean: 5 | @rm ter-*.json 6 | 7 | .PHONY: clean all 8 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/fonts/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * font.js - font compilation for ttystudio 3 | * Copyright (c) 2015, Christopher Jeffrey (MIT License). 4 | * https://github.com/chjj/ttystudio 5 | */ 6 | 7 | var fs = require('fs') 8 | , path = require('path') 9 | , util = require('util'); 10 | 11 | var pxxl = require('../vendor/pxxl'); 12 | 13 | var files = process.argv.slice(2); 14 | 15 | var silent = false; 16 | if (files[0] === '--silent') { 17 | silent = true; 18 | files.shift(); 19 | } 20 | 21 | function compileFont(file) { 22 | var file = file || __dirname + '/../fonts/ter-u14n.bdf' 23 | , jsonFile = __dirname + '/../fonts/' + path.basename(file, '.bdf') + '.json' 24 | , data = fs.readFileSync(file, 'utf8'); 25 | 26 | var result = pxxl.sync(data, 'ab') 27 | , pixels = result[0] 28 | , font = result[1]; 29 | 30 | var width = 0 31 | , height = 0; 32 | 33 | if (!silent) { 34 | console.log(util.inspect(font, { 35 | depth: 20, 36 | colors: true 37 | })); 38 | console.log(''); 39 | } 40 | 41 | var glyphs = Object.keys(font.glyphs).reduce(function(glyphs, code) { 42 | var ch = String.fromCharCode(+code); 43 | var result = pxxl.sync(data, ch); 44 | var pixels = result[0]; 45 | glyphs[ch] = { 46 | code: +code, 47 | ch: ch, 48 | pixels: pixels 49 | }; 50 | return glyphs; 51 | }, {}); 52 | 53 | Object.keys(glyphs).forEach(function(ch) { 54 | for (var p = 0; p < glyphs[ch].pixels.length; p++) { 55 | var pixel = glyphs[ch].pixels[p] 56 | , x = pixel.x 57 | , y = pixel.y; 58 | 59 | for (var yi = y; yi < y + 1; yi++) { 60 | for (var xi = x; xi < x + 1; xi++) { 61 | width = Math.max(width, x + 1); 62 | height = Math.max(height, y + 1); 63 | } 64 | } 65 | } 66 | }); 67 | 68 | Object.keys(glyphs).forEach(function(ch) { 69 | var lines = []; 70 | for (var y = 0; y < height; y++) { 71 | var line = []; 72 | for (var x = 0; x < width; x++) { 73 | line.push(' '); 74 | } 75 | lines.push(line); 76 | } 77 | 78 | for (var p = 0; p < glyphs[ch].pixels.length; p++) { 79 | var pixel = glyphs[ch].pixels[p] 80 | , x = pixel.x 81 | , y = pixel.y; 82 | 83 | for (var yi = y; yi < y + 1; yi++) { 84 | for (var xi = x; xi < x + 1; xi++) { 85 | if (!lines[yi][xi]) { 86 | throw new Error; 87 | } 88 | lines[yi][xi] = '-'; 89 | } 90 | } 91 | } 92 | 93 | glyphs[ch].map = lines.map(function(line) { 94 | return line.join(''); 95 | }); 96 | 97 | lines = lines.reduce(function(out, line) { 98 | return out + line.join('') + '\n'; 99 | }, ''); 100 | 101 | if (ch === 'M') { 102 | if (!silent) { 103 | console.log(lines); 104 | console.log([width, height]); 105 | } 106 | } 107 | }); 108 | 109 | var minGlyphs = Object.keys(glyphs).reduce(function(out, ch) { 110 | var glyph = glyphs[ch]; 111 | out[ch] = { 112 | ch: glyph.ch, 113 | code: glyph.code, 114 | map: glyph.map 115 | }; 116 | return out; 117 | }, {}); 118 | 119 | var out = { 120 | // font: { 121 | // info: font, 122 | // glyphs: glpyhs 123 | // }, 124 | width: width, 125 | height: height, 126 | glyphs: minGlyphs 127 | }; 128 | 129 | fs.writeFileSync(jsonFile, JSON.stringify(out, null, 2)); 130 | } 131 | 132 | for (var i = 0; i < files.length; i++) { 133 | compileFont(files[i]); 134 | } 135 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/ttystudio'); 2 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/lib/buffer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * buffer.js - expanding buffer for ttystudio 3 | * Copyright (c) 2015, Christopher Jeffrey (MIT License). 4 | * https://github.com/chjj/ttystudio 5 | */ 6 | 7 | /** 8 | * ExpandingBuffer 9 | */ 10 | 11 | function ExpandingBuffer() { 12 | var self = this; 13 | if (!(self instanceof ExpandingBuffer)) { 14 | self = Object.create(ExpandingBuffer.prototype); 15 | } 16 | if (Buffer.isBuffer(arguments[0])) { 17 | self.buffer = arguments[0]; 18 | } else { 19 | self.buffer = Buffer.apply(null, arguments); 20 | } 21 | return self; 22 | } 23 | 24 | Object.keys(Buffer.prototype).forEach(function(method) { 25 | ExpandingBuffer.prototype[method] = function() { 26 | try { 27 | return this.buffer[method].apply(this.buffer, arguments); 28 | } catch (e) { 29 | if (~e.message.indexOf('out of range')) { 30 | var buf = new Buffer(this.buffer.length * 2); 31 | this.buffer.copy(buf); 32 | this.buffer = buf; 33 | return this[method].apply(this, arguments); 34 | } 35 | throw e; 36 | } 37 | }; 38 | }); 39 | 40 | /** 41 | * Expose 42 | */ 43 | 44 | module.exports = ExpandingBuffer; 45 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/lib/compile.js: -------------------------------------------------------------------------------- 1 | /** 2 | * compile.js - terminal compiler for ttystudio 3 | * Copyright (c) 2015, Christopher Jeffrey (MIT License). 4 | * https://github.com/chjj/ttystudio 5 | */ 6 | 7 | var fs = require('fs') 8 | , SGRWriter = require('./writer') 9 | , options = require('./options'); 10 | 11 | /** 12 | * Compile 13 | */ 14 | 15 | function compile(options, callback) { 16 | var input = options.files[0] 17 | , output = options.o || options.output || options.files[1] 18 | , stream 19 | , frames 20 | , writer; 21 | 22 | if (output) { 23 | if (output === '-') { 24 | stream = process.stdout; 25 | output = '[stdout]'; 26 | } else { 27 | stream = fs.createWriteStream(output); 28 | } 29 | } 30 | 31 | options.stream = stream; 32 | options.delay = options.delay || 100; 33 | options.png = options.png || /\.png$/i.test(output); 34 | 35 | if (Array.isArray(input)) { 36 | frames = input; 37 | } else if (typeof input === 'string') { 38 | if (~input.indexOf('.json')) { 39 | log('parsing json'); 40 | frames = JSON.parse(fs.readFileSync(input, 'utf8')); 41 | } else { 42 | log('reading file'); 43 | frames = [fs.readFileSync(input, 'utf8')]; 44 | } 45 | } else { 46 | return callback(new Error('No input file specified.')); 47 | } 48 | 49 | if (options.range) { 50 | frames = frames.slice(options.range[0], options.range[1]); 51 | } 52 | 53 | log('initializing writer'); 54 | writer = new SGRWriter(frames, options); 55 | 56 | writer.on('done', function(event) { 57 | log('stream: ' + event); 58 | log('wrote image to %s', output); 59 | return callback(); 60 | }); 61 | 62 | log('writing image'); 63 | writer.write(); 64 | 65 | return writer; 66 | } 67 | 68 | /** 69 | * Helpers 70 | */ 71 | 72 | function log() { 73 | if (!options.log) return; 74 | return console.error.apply(console, arguments); 75 | } 76 | 77 | /** 78 | * Expose 79 | */ 80 | 81 | module.exports = compile; 82 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/lib/optimize.js: -------------------------------------------------------------------------------- 1 | /** 2 | * optimize.js - frame optimizer for ttystudio 3 | * Copyright (c) 2015, Christopher Jeffrey (MIT License). 4 | * https://github.com/chjj/ttystudio 5 | */ 6 | 7 | /** 8 | * Optimizer 9 | */ 10 | 11 | function Optimizer(options) { 12 | this.options = options || {}; 13 | } 14 | 15 | Optimizer.prototype.reset = function(frame) { 16 | delete this.damage; 17 | }; 18 | 19 | Optimizer.prototype.offset = function(frame) { 20 | var bmp = frame.data || frame 21 | , left = null 22 | , top = null 23 | , right = null 24 | , bottom = null 25 | , x 26 | , y 27 | , cell 28 | , hash; 29 | 30 | if (!this.damage) { 31 | this.damage = []; 32 | for (y = 0; y < bmp.length; y++) { 33 | bline = []; 34 | for (x = 0; x < bmp[y].length; x++) { 35 | bline.push(null); 36 | } 37 | this.damage.push(bline); 38 | } 39 | } 40 | 41 | for (y = 0; y < bmp.length; y++) { 42 | cline = bmp[y]; 43 | for (x = 0; x < cline.length; x++) { 44 | cell = cline[x]; 45 | hash = (cell.r << 24) | (cell.g << 16) | (cell.b << 8) | (cell.a << 0); 46 | if (this.damage[y][x] !== hash) { 47 | if (left === null) left = x; 48 | else if (x < left) left = x; 49 | if (top === null) top = y; 50 | } 51 | } 52 | } 53 | 54 | for (y = bmp.length - 1; y >= 0; y--) { 55 | cline = bmp[y]; 56 | for (x = cline.length - 1; x >= 0; x--) { 57 | cell = cline[x]; 58 | hash = (cell.r << 24) | (cell.g << 16) | (cell.b << 8) | (cell.a << 0); 59 | if (this.damage[y][x] !== hash) { 60 | if (right === null) right = x + 1; 61 | else if (x + 1 > right) right = x + 1; 62 | if (bottom === null) bottom = y + 1; 63 | } 64 | this.damage[y][x] = hash; 65 | } 66 | } 67 | 68 | if (left === null) left = 0; 69 | if (right === null) right = 1; 70 | 71 | if (top === null) top = 0; 72 | if (bottom === null) bottom = 1; 73 | 74 | if (left > right) { 75 | throw new Error('optimizer failed: left > right'); 76 | } 77 | 78 | if (top > bottom) { 79 | throw new Error('optimizer failed: top > bottom'); 80 | } 81 | 82 | bmp = bmp.slice(top, bottom); 83 | for (y = 0; y < bmp.length; y++) { 84 | bmp[y] = bmp[y].slice(left, right); 85 | } 86 | 87 | this.log('frame dimensions: %dx%d', bmp[0].length, bmp.length); 88 | 89 | return { 90 | left: left, 91 | top: top, 92 | data: bmp, 93 | optimized: true 94 | }; 95 | }; 96 | 97 | Optimizer.prototype.log = function() { 98 | if (!this.options.log) return; 99 | return console.error.apply(console, arguments); 100 | }; 101 | 102 | /** 103 | * Expose 104 | */ 105 | 106 | module.exports = Optimizer; 107 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/lib/play.js: -------------------------------------------------------------------------------- 1 | /** 2 | * play.js - terminal player for ttystudio 3 | * Copyright (c) 2015, Christopher Jeffrey (MIT License). 4 | * https://github.com/chjj/ttystudio 5 | */ 6 | 7 | var fs = require('fs') 8 | , blessed = require('blessed'); 9 | 10 | /** 11 | * Play 12 | */ 13 | 14 | function play(options, callback) { 15 | var frames = JSON.parse(fs.readFileSync(options.files[0], 'utf8')); 16 | 17 | var screen = blessed.screen({ 18 | smartCSR: true 19 | }); 20 | 21 | screen.on('C-c', function() { 22 | process.exit(0); 23 | }); 24 | 25 | var timer = setInterval(function() { 26 | if (!frames.length) { 27 | clearInterval(timer); 28 | screen.destroy(); 29 | return callback(); 30 | } 31 | screen.lines = frames.shift(); 32 | screen.lines.forEach(function(line) { 33 | line.dirty = true; 34 | }); 35 | screen.render(); 36 | }, options.delay || 100); 37 | } 38 | 39 | /** 40 | * Expose 41 | */ 42 | 43 | module.exports = play; 44 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/lib/record.js: -------------------------------------------------------------------------------- 1 | /** 2 | * record.js - terminal recorder for ttystudio 3 | * Copyright (c) 2015, Christopher Jeffrey (MIT License). 4 | * https://github.com/chjj/ttystudio 5 | */ 6 | 7 | var EventEmitter = require('events').EventEmitter 8 | , fs = require('fs') 9 | , cp = require('child_process') 10 | , blessed = require('blessed'); 11 | 12 | /** 13 | * Record 14 | */ 15 | 16 | function record(options, callback) { 17 | var frames = [] 18 | , out 19 | , termName = 'xterm' 20 | , screen 21 | , tty 22 | , timeout; 23 | 24 | try { 25 | out = cp.execSync('tput -Txterm-256color longname', { encoding: 'utf8' }); 26 | if (~out.indexOf('256 colors')) { 27 | termName = 'xterm-256color'; 28 | } 29 | } catch (e) { 30 | ; 31 | } 32 | 33 | screen = blessed.screen({ 34 | smartCSR: true 35 | }); 36 | 37 | tty = blessed.terminal({ 38 | parent: screen, 39 | cursorBlink: false, 40 | screenKeys: false, 41 | left: 0, 42 | top: 0, 43 | term: options.term || termName, 44 | width: screen.width, 45 | height: screen.height 46 | }); 47 | 48 | function screenshot() { 49 | var lines = [] 50 | , y 51 | , line 52 | , cx 53 | , x 54 | , cell 55 | , attr 56 | , ch; 57 | 58 | for (y = 0; y < screen.lines.length; y++) { 59 | line = []; 60 | if (y === tty.term.y 61 | && tty.term.cursorState 62 | && (tty.term.ydisp === tty.term.ybase || tty.term.selectMode) 63 | && !tty.term.cursorHidden) { 64 | cx = tty.term.x; 65 | } else { 66 | cx = -1; 67 | } 68 | for (x = 0; x < screen.lines[y].length; x++) { 69 | cell = screen.lines[y][x]; 70 | attr = cell[0]; 71 | ch = cell[1]; 72 | if (x === cx) attr = (0x1ff << 9) | 15; 73 | line.push([attr, ch]); 74 | } 75 | lines.push(line); 76 | } 77 | frames.push(lines); 78 | } 79 | 80 | if (!options.screenshot) { 81 | timeout = setInterval(screenshot, options.interval || 100); 82 | if (timeout.unref) timeout.unref(); 83 | } else { 84 | screen.key(options.screenshotKey || 'C-p', screenshot); 85 | } 86 | 87 | function done() { 88 | if (!done.called) { 89 | done.called = true; 90 | 91 | if (timeout) { 92 | clearTimeout(timeout); 93 | timeout = null; 94 | } 95 | 96 | screen.destroy(); 97 | 98 | callback(null, frames); 99 | } 100 | } 101 | 102 | screen.key(options.key || 'C-q', done); 103 | 104 | process.on('exit', done); 105 | } 106 | 107 | /** 108 | * Expose 109 | */ 110 | 111 | module.exports = record; 112 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/lib/ttystudio.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ttystudio.js - a terminal-to-gif recorder minus the headaches 3 | * Copyright (c) 2015, Christopher Jeffrey (MIT License). 4 | * https://github.com/chjj/ttystudio 5 | */ 6 | 7 | /** 8 | * ttystudio 9 | */ 10 | 11 | exports = require('./writer'); 12 | exports.buffer = require('./buffer'); 13 | exports.compile = require('./compile'); 14 | exports.gif = require('./gif'); 15 | exports.optimize = require('./optimize'); 16 | exports.options = require('./options'); 17 | exports.play = require('./play'); 18 | exports.png = require('./png'); 19 | exports.record = require('./record'); 20 | exports.writer = require('./writer'); 21 | 22 | /** 23 | * Expose 24 | */ 25 | 26 | module.exports = exports; 27 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/man/ttystudio.1: -------------------------------------------------------------------------------- 1 | .ds q \N'34' 2 | .TH ttystudio 1 3 | 4 | .SH NAME 5 | ttystudio \- a terminal to GIF/APNG recorder 6 | 7 | .SH SYNOPSIS 8 | .nf 9 | .B ttystudio [options] [input] [output] 10 | .fi 11 | 12 | .SH DESCRIPTION 13 | .B ttystudio 14 | is a terminal recorder that can write to GIFs or APNGs without any external 15 | dependencies or GUI playback. 16 | 17 | .SH OPTIONS 18 | 19 | .TP 20 | .BI \-l,\ \-\-log 21 | Log status to stderr (default now). 22 | 23 | .TP 24 | .BI \-q,\ \-\-quiet 25 | Do not log status to stderr. 26 | 27 | .TP 28 | .BI \-f,\ \-\-font\ [font-file] 29 | Choose a BDF font in ttystudio's JSON format. 30 | 31 | .TP 32 | .BI \-b,\ \-\-font-bold\ [font-file] 33 | Choose a bold BDF font in ttystudio's JSON format. 34 | 35 | .TP 36 | .BI \-d,\ \-\-delay\ [delay-ms] 37 | Specify frame delay in ms (default: 100). 38 | 39 | .TP 40 | .BI \-i,\ \-\-interval\ [interval-ms] 41 | Specify frame snapshot interval in ms (default: 100). 42 | 43 | .TP 44 | .BI \-k,\ \-\-key\ [quit-key] 45 | Choose a key combination to quit recording (default: C-q). 46 | 47 | .TP 48 | .BI \-n,\ \-\-num-plays\ [num-plays] 49 | Specify a number of plays for the animation (default: 0 - infinite). 50 | 51 | .TP 52 | .BI \-r,\ \-\-range\ [frame-range] 53 | Choose a range of frames to compile. e.g. 5-200. 54 | 55 | .TP 56 | .BI \-x,\ \-\-ratio\ [pixel-cell-ratio] 57 | Choose pixel to cell ratio. This option is useless right now since it is 58 | overwritten by the font (default: 8x14). 59 | 60 | .TP 61 | .BI \-t,\ \-\-term\ [term-name] 62 | Choose the terminal name for terminfo. 63 | 64 | .TP 65 | .BI \-\-palette 66 | Use a global palette for APNGs instead of RGBA. 67 | 68 | .TP 69 | .BI \-\-no-palette,\ \-\-rgba,\ \-\-lct 70 | Use RGBA for APNGs instead of a global palette. This will also avoid building a 71 | global palette for GIFs and only use a local color table for each frame. 72 | 73 | .TP 74 | .BI \-\-border\ [width,r,g,b,a] 75 | Add a border around the animation using the specified parameters. 76 | 77 | .TP 78 | .BI play,\ \-\-play 79 | Replay a frames file in the terminal. 80 | 81 | .TP 82 | .BI record,\ \-\-record 83 | Explicitly choose to record (not very useful). 84 | 85 | .TP 86 | .BI compile,\ \-\-compile 87 | Explicitly choose to compile (not very useful). 88 | 89 | .TP 90 | .BI screenshot,\ \-\-screenshot 91 | Start ttystudio in screenshot mode. It will take a screenshot on `C-p` unless 92 | specified otherwise by `--screenshot-key`. 93 | 94 | .TP 95 | .BI \-\-screenshot\-key 96 | Set the screenshot key when in screenshot mode. Default is `C-p`. 97 | 98 | .TP 99 | .BI \-\-version 100 | Display ttystudio version. 101 | 102 | .TP 103 | .BI \-h,\ \-\-help 104 | Display help information. 105 | 106 | .SH LIBRARY 107 | For running programmatically. 108 | 109 | .B Example 110 | 111 | var ttystudio = require('ttystudio') 112 | , ANSIWriter = ttystudio.writer 113 | , GIFWriter = ttystudio.gif 114 | , PNGWriter = ttystudio.png 115 | , compiler = ttystudio.compile 116 | , recorder = ttystudio.record 117 | , player = ttystudio.play; 118 | 119 | .SH EXAMPLES 120 | 121 | $ ttystudio output.gif --log # record and compile 122 | $ ttystudio frames.json --log # record 123 | $ ttystudio frames.json output.gif --range=0-50 # compile 124 | 125 | .SH BUGS 126 | Please report any bugs to https://github.com/chjj/ttystudio. 127 | 128 | .SH LICENSE 129 | Copyright (c) 2015, Christopher Jeffrey (MIT License) 130 | 131 | .SH "SEE ALSO" 132 | .BR ttyrec(1), 133 | .BR ttyplay(1), 134 | .BR ttygif(1) 135 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/.bin/blessed: -------------------------------------------------------------------------------- 1 | ../blessed/bin/tput.js -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/.npmignore: -------------------------------------------------------------------------------- 1 | .git* 2 | test/ 3 | img/ 4 | node_modules/ 5 | .jshintrc 6 | .jscsrc 7 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Blessed v0.1.0 - new terminal goodies for node.js 2 | 3 | ![blessed](https://raw.githubusercontent.com/chjj/blessed/master/img/v0.1.0-3.gif) 4 | 5 | The features demonstrated in the above gif __element transparency/shadow__ and 6 | __border docking__. 7 | 8 | ## New useful options for your typewriter application: 9 | 10 | - __`transparent` option__ - Lower element opacity to 50%. This will display 11 | dimmed elements and content behind the foreground element using a naive color 12 | blending function (good enough for a terminal's limited amount of colors). 13 | works best with 256color terminals. (see widget-shadow.js) 14 | 15 | - __`shadow` option__ - Give the element a translucent shadow. Automatically 16 | darkens the background behind it. (see widget-shadow.js) 17 | 18 | - __`dockBorders` option__ - Element borders will automatically "dock" to each 19 | other. Instead of overlapping the borders end up connecting. (see 20 | widget-dock.js) 21 | 22 | - __`autoPadding` default__ - Auto padding is now enabled by default, meaning 23 | blessed will automatically position elements inside their parent's border. 24 | 25 | - __`rleft` property__ - Relative offsets are now default element properties 26 | (`left` instead of `rleft`). 27 | 28 | - __`draggable` property__ - Make any element draggable with the mouse. (see 29 | widget-shadow.js or widget-dock.js) 30 | 31 | - __`Table` and `ListTable` elements__ - Tables with a high quality rendering. 32 | (see widget-table.js and widget-listtable.js) 33 | 34 | - __`Log` element__ - A top to bottom logger box with scrollback and other 35 | features. (see widget-log.js) 36 | 37 | - __Obscurable borders__ - In addition to docking borders, it's possible to 38 | obscure borders by sliding them off the screen with negative offsets. (see 39 | widget-dock.js) 40 | 41 | - __Percentage expressions__ - Like CSS, arithmetic can now be performed on 42 | percentages. e.g. `width: '50%-1'`. This is useful for overlapping borders on 43 | elements with a percentage width. (see widget-dock.js) 44 | 45 | ## Other features that weren't mentioned before: 46 | 47 | - __`setHover` option__ - Set a hover text box to follow cursor on mouseover, 48 | similar to how a web browser handles the "title" attribute. (see widget.js) 49 | 50 | - __`Terminal` element__ - Spin up a pseudo terminal as a blessed element. 51 | useful for writing a terminal multiplexer. (requires term.js and pty.js as 52 | optional dependencies). (see example/multiplex.js) 53 | 54 | - __`Image` element__ - Uses `w3mimgdisplay` to draw real images your terminal. 55 | this is much easier than calling w3mimgdisplay by hand. Image elements behave 56 | like any other element, although it is wise to use `width: 'shrink', height: 57 | 'shrink'`. (see widget-image.js) 58 | 59 | --- 60 | 61 | The major things that justified the 0.1.0 release were fixes and stabilization 62 | of api (`autoPadding`/`rleft`/`left`). Scrolling boxes were almost completely 63 | revamped to work a bit smarter. 64 | 65 | --- 66 | 67 | ## Things yet to come: 68 | 69 | - __@secrettriangle's [improvements](https://github.com/slap-editor/slap) for 70 | textareas__ - This allows for real text navigation. 71 | 72 | - __Gravity and margin layouts__ 73 | 74 | This is something that's been in the idea bin for a while. Every element could 75 | potentially have properties like: 76 | 77 | ``` 78 | gravity: 'bottomleft', 79 | margin: 5, 80 | `` 81 | 82 | In other words, just a more complex `float` system than what the CSSOM is used 83 | to. 84 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2015, Christopher Jeffrey and contributors 2 | https://github.com/chjj/ 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/bin/tput.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var blessed = require('../') 4 | , argv = process.argv.slice(2) 5 | , cmd = argv.shift() 6 | , tput; 7 | 8 | tput = blessed.tput({ 9 | terminal: process.env.TERM, 10 | termcap: !!process.env.USE_TERMCAP, 11 | extended: true 12 | }); 13 | 14 | if (tput[cmd]) { 15 | process.stdout.write(tput[cmd].apply(tput, argv)); 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/browser/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @cd .. && browserify -e index.js -o browser/blessed.js 3 | 4 | clean: 5 | @rm -f blessed.js 6 | 7 | .PHONY: clean all 8 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/browser/transform.js: -------------------------------------------------------------------------------- 1 | /** 2 | * transform.js - browserify workaround for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | var Transform = require('stream').Transform 8 | , path = require('path') 9 | , fs = require('fs'); 10 | 11 | /** 12 | * Transformer 13 | */ 14 | 15 | function transformer(code) { 16 | var stream = new Transform; 17 | stream._transform = function(chunk, encoding, callback) { 18 | return callback(null, chunk); 19 | }; 20 | stream._flush = function(callback) { 21 | if (code) { 22 | stream.push(code); 23 | } 24 | return callback(); 25 | }; 26 | return stream; 27 | } 28 | 29 | /** 30 | * Explicitly require all widgets in widget.js 31 | */ 32 | 33 | var widgets = fs.readdirSync(__dirname + '/../lib/widgets'); 34 | 35 | var requireWidgets = widgets.reduce(function(out, name) { 36 | name = path.basename(name, '.js'); 37 | out += '\nrequire(\'./widgets/' + name + '\');'; 38 | return out; 39 | }, ''); 40 | 41 | /** 42 | * Do not make filesystem calls in tput.js for 43 | * terminfo or termcap, just use xterm terminfo/cap. 44 | */ 45 | 46 | var infoPath = path.resolve(__dirname, '..', 'usr', 'xterm-256color') 47 | , capPath = path.resolve(__dirname, '..', 'usr', 'xterm.termcap'); 48 | 49 | var infoPathFake = path.resolve( 50 | path.sep, 'usr', 'share', 'terminfo', 51 | path.basename(infoPath)[0], 52 | path.basename(infoPath) 53 | ); 54 | 55 | function readMethods() { 56 | Tput._infoBuffer = new Buffer(TERMINFO, 'base64'); 57 | 58 | Tput.prototype.readTerminfo = function() { 59 | this.terminal = TERMINFO_NAME; 60 | return this.parseTerminfo(Tput._infoBuffer, TERMINFO_PATH); 61 | }; 62 | 63 | Tput.cpaths = []; 64 | Tput.termcap = TERMCAP; 65 | 66 | Tput.prototype._readTermcap = Tput.prototype.readTermcap; 67 | Tput.prototype.readTermcap = function() { 68 | this.terminal = TERMCAP_NAME; 69 | return this._readTermcap(this.terminal); 70 | }; 71 | 72 | Tput.prototype.detectUnicode = function() { 73 | return true; 74 | }; 75 | } 76 | 77 | readMethods = readMethods.toString().slice(24, -2) 78 | .replace(/^ /gm, '') 79 | .replace('TERMINFO', JSON.stringify(fs.readFileSync(infoPath, 'base64'))) 80 | .replace('TERMINFO_NAME', JSON.stringify(path.basename(infoPath))) 81 | .replace('TERMINFO_PATH', JSON.stringify(infoPathFake)) 82 | .replace('TERMCAP', JSON.stringify(fs.readFileSync(capPath, 'utf8'))) 83 | .replace('TERMCAP_NAME', JSON.stringify(path.basename(capPath, '.termcap'))); 84 | 85 | /** 86 | * Helpers 87 | */ 88 | 89 | function end(file, offset) { 90 | return file.split(path.sep).slice(-offset).join('/'); 91 | } 92 | 93 | /** 94 | * Expose 95 | */ 96 | 97 | module.exports = function(file) { 98 | if (end(file, 2) === 'lib/widget.js') { 99 | return transformer(requireWidgets); 100 | } 101 | if (end(file, 2) === 'lib/tput.js') { 102 | return transformer(readMethods); 103 | } 104 | return transformer(); 105 | }; 106 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/example/ansi-viewer/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Christopher Jeffrey 2 | https://github.com/chjj/ 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/example/ansi-viewer/README.md: -------------------------------------------------------------------------------- 1 | # ansi-viewer 2 | 3 | A terminal app to view ANSI art from http://artscene.textfiles.com/ansi/. 4 | 5 | ![ansi-viewer](https://raw.githubusercontent.com/chjj/blessed/master/img/ansi-viewer.png) 6 | 7 | ## Contribution and License Agreement 8 | 9 | If you contribute code to this project, you are implicitly allowing your code 10 | to be distributed under the MIT license. You are also implicitly verifying that 11 | all code is your original work. `` 12 | 13 | ## License 14 | 15 | Copyright (c) 2015, Christopher Jeffrey. (MIT License) 16 | 17 | See LICENSE for more info. 18 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/example/ansi-viewer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ansi-viewer", 3 | "description": "ANSI art viewer for node", 4 | "author": "Christopher Jeffrey", 5 | "version": "0.0.1", 6 | "main": "./index.js", 7 | "bin": "./index.js", 8 | "preferGlobal": false, 9 | "repository": "git://github.com/chjj/blessed.git", 10 | "homepage": "https://github.com/chjj/blessed", 11 | "bugs": { "url": "http://github.com/chjj/blessed/issues" }, 12 | "keywords": ["ansi", "art"], 13 | "tags": ["ansi", "art"], 14 | "dependencies": { 15 | "blessed": ">=0.1.5", 16 | "term.js": "0.0.4", 17 | "request": "2.55.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/example/blessed-telnet.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * blessed-telnet.js 5 | * https://github.com/chjj/blessed 6 | * Copyright (c) 2013-2015, Christopher Jeffrey (MIT License) 7 | * A blessed telnet server. 8 | * See: https://github.com/TooTallNate/node-telnet 9 | */ 10 | 11 | process.title = 'blessed-telnet'; 12 | 13 | var fs = require('fs'); 14 | var path = require('path'); 15 | var blessed = require('blessed'); 16 | var telnet = require('telnet'); 17 | 18 | var server = telnet.createServer(function(client) { 19 | client.do.transmit_binary(); 20 | client.do.terminal_type(); 21 | client.do.window_size(); 22 | client.do.environment_variables(); 23 | 24 | client.on('debug', function(msg) { 25 | console.error(msg); 26 | }); 27 | 28 | client.on('environment variables', function(data) { 29 | if (data.command === 'sb') { 30 | if (data.name === 'TERM') { 31 | screen.terminal = data.value; 32 | } else { 33 | // Clear the screen since they may have used `env send [var]`. 34 | screen.realloc(); 35 | } 36 | screen.render(); 37 | } 38 | }); 39 | 40 | client.on('terminal type', function(data) { 41 | if (data.command === 'sb' && data.name) { 42 | screen.terminal = data.name; 43 | screen.render(); 44 | } 45 | }); 46 | 47 | client.on('window size', function(data) { 48 | if (data.command === 'sb') { 49 | client.columns = data.columns; 50 | client.rows = data.rows; 51 | client.emit('resize'); 52 | } 53 | }); 54 | 55 | // Make the client look like a tty: 56 | client.setRawMode = function(mode) { 57 | client.isRaw = mode; 58 | if (!client.writable) return; 59 | if (mode) { 60 | client.do.suppress_go_ahead(); 61 | client.will.suppress_go_ahead(); 62 | client.will.echo(); 63 | } else { 64 | client.dont.suppress_go_ahead(); 65 | client.wont.suppress_go_ahead(); 66 | client.wont.echo(); 67 | } 68 | }; 69 | client.isTTY = true; 70 | client.isRaw = false; 71 | client.columns = 80; 72 | client.rows = 24; 73 | 74 | var screen = blessed.screen({ 75 | smartCSR: true, 76 | input: client, 77 | output: client, 78 | terminal: 'xterm-256color', 79 | fullUnicode: true 80 | }); 81 | 82 | client.on('close', function() { 83 | if (!screen.destroyed) { 84 | screen.destroy(); 85 | } 86 | }); 87 | 88 | screen.on('destroy', function() { 89 | if (client.writable) { 90 | client.destroy(); 91 | } 92 | }); 93 | 94 | if (test === 'widget-simple') { 95 | return simpleTest(screen); 96 | } 97 | 98 | loadTest(screen, test); 99 | }); 100 | 101 | function simpleTest(screen) { 102 | screen.data.main = blessed.box({ 103 | parent: screen, 104 | width: '80%', 105 | height: '90%', 106 | border: 'line', 107 | content: 'Welcome to my server. Here is your own private session.', 108 | style: { 109 | bg: 'red' 110 | } 111 | }); 112 | 113 | screen.key('i', function() { 114 | screen.data.main.style.bg = 'blue'; 115 | screen.render(); 116 | }); 117 | 118 | screen.key(['C-c', 'q'], function(ch, key) { 119 | screen.destroy(); 120 | }); 121 | 122 | screen.render(); 123 | } 124 | 125 | var test = process.argv[2] || path.resolve(__dirname, '../test/widget-shadow.js'); 126 | if (~test.indexOf('widget-png.js')) process.argv.length = 2; 127 | test = path.resolve(process.cwd(), test); 128 | 129 | function loadTest(screen, name) { 130 | var Screen = blessed.screen; 131 | blessed.screen = function() { return screen; }; 132 | var path = require.resolve(name); 133 | delete require.cache[path]; 134 | require(name); 135 | blessed.screen = Screen; 136 | } 137 | 138 | server.listen(2300); 139 | console.log('Listening on 2300...'); 140 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/example/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Example Program for Blessed 3 | * Copyright (c) 2013, Christopher Jeffrey (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | var blessed = require('../') 8 | , program = blessed.program(); 9 | 10 | process.title = 'blessed'; 11 | 12 | program.on('keypress', function(ch, key) { 13 | if (key.name === 'q') { 14 | program.clear(); 15 | program.disableMouse(); 16 | program.showCursor(); 17 | program.normalBuffer(); 18 | process.exit(0); 19 | } 20 | }); 21 | 22 | program.on('mouse', function(data) { 23 | if (data.action === 'mouseup') return; 24 | program.move(1, program.rows); 25 | program.eraseInLine('right'); 26 | if (data.action === 'wheelup') { 27 | program.write('Mouse wheel up at: ' + data.x + ', ' + data.y); 28 | } else if (data.action === 'wheeldown') { 29 | program.write('Mouse wheel down at: ' + data.x + ', ' + data.y); 30 | } else if (data.action === 'mousedown' && data.button === 'left') { 31 | program.write('Left button down at: ' + data.x + ', ' + data.y); 32 | } else if (data.action === 'mousedown' && data.button === 'right') { 33 | program.write('Right button down at: ' + data.x + ', ' + data.y); 34 | } else { 35 | program.write('Mouse at: ' + data.x + ', ' + data.y); 36 | } 37 | program.move(data.x, data.y); 38 | program.bg('red'); 39 | program.write(' '); 40 | program.bg('!red'); 41 | }); 42 | 43 | program.on('focus', function() { 44 | program.move(1, program.rows); 45 | program.write('Gained focus.'); 46 | }); 47 | 48 | program.on('blur', function() { 49 | program.move(1, program.rows); 50 | program.write('Lost focus.'); 51 | }); 52 | 53 | program.alternateBuffer(); 54 | program.enableMouse(); 55 | program.hideCursor(); 56 | program.clear(); 57 | 58 | program.move(1, 1); 59 | program.bg('black'); 60 | program.write('Hello world', 'blue fg'); 61 | program.setx((program.cols / 2 | 0) - 4); 62 | program.down(5); 63 | program.write('Hi again!'); 64 | program.bg('!black'); 65 | program.feed(); 66 | 67 | program.getCursor(function(err, data) { 68 | if (!err) { 69 | program.write('Cursor is at: ' + data.x + ', ' + data.y + '.'); 70 | program.feed(); 71 | } 72 | 73 | program.charset('SCLD'); 74 | program.write('abcdefghijklmnopqrstuvwxyz0123456789'); 75 | program.charset('US'); 76 | program.setx(1); 77 | }); 78 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/example/multiplex.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * multiplex.js 5 | * https://github.com/chjj/blessed 6 | * Copyright (c) 2013-2015, Christopher Jeffrey (MIT License) 7 | * A terminal multiplexer created by blessed. 8 | */ 9 | 10 | process.title = 'multiplex.js'; 11 | 12 | var blessed = require('blessed') 13 | , screen; 14 | 15 | screen = blessed.screen({ 16 | smartCSR: true, 17 | log: process.env.HOME + '/blessed-terminal.log', 18 | fullUnicode: true, 19 | dockBorders: true, 20 | ignoreDockContrast: true 21 | }); 22 | 23 | var topleft = blessed.terminal({ 24 | parent: screen, 25 | cursor: 'line', 26 | cursorBlink: true, 27 | screenKeys: false, 28 | label: ' multiplex.js ', 29 | left: 0, 30 | top: 0, 31 | width: '50%', 32 | height: '50%', 33 | border: 'line', 34 | style: { 35 | fg: 'default', 36 | bg: 'default', 37 | focus: { 38 | border: { 39 | fg: 'green' 40 | } 41 | } 42 | } 43 | }); 44 | 45 | topleft.pty.on('data', function(data) { 46 | screen.log(JSON.stringify(data)); 47 | }); 48 | 49 | var topright = blessed.terminal({ 50 | parent: screen, 51 | cursor: 'block', 52 | cursorBlink: true, 53 | screenKeys: false, 54 | label: ' multiplex.js ', 55 | left: '50%-1', 56 | top: 0, 57 | width: '50%+1', 58 | height: '50%', 59 | border: 'line', 60 | style: { 61 | fg: 'red', 62 | bg: 'black', 63 | focus: { 64 | border: { 65 | fg: 'green' 66 | } 67 | } 68 | } 69 | }); 70 | 71 | var bottomleft = blessed.terminal({ 72 | parent: screen, 73 | cursor: 'block', 74 | cursorBlink: true, 75 | screenKeys: false, 76 | label: ' multiplex.js ', 77 | left: 0, 78 | top: '50%-1', 79 | width: '50%', 80 | height: '50%+1', 81 | border: 'line', 82 | style: { 83 | fg: 'default', 84 | bg: 'default', 85 | focus: { 86 | border: { 87 | fg: 'green' 88 | } 89 | } 90 | } 91 | }); 92 | 93 | var bottomright = blessed.terminal({ 94 | parent: screen, 95 | cursor: 'block', 96 | cursorBlink: true, 97 | screenKeys: false, 98 | label: ' multiplex.js ', 99 | left: '50%-1', 100 | top: '50%-1', 101 | width: '50%+1', 102 | height: '50%+1', 103 | border: 'line', 104 | style: { 105 | fg: 'default', 106 | bg: 'default', 107 | focus: { 108 | border: { 109 | fg: 'green' 110 | } 111 | } 112 | } 113 | }); 114 | 115 | [topleft, topright, bottomleft, bottomright].forEach(function(term) { 116 | term.enableDrag(function(mouse) { 117 | return !!mouse.ctrl; 118 | }); 119 | term.on('title', function(title) { 120 | screen.title = title; 121 | term.setLabel(' ' + title + ' '); 122 | screen.render(); 123 | }); 124 | term.on('click', term.focus.bind(term)); 125 | }); 126 | 127 | topleft.focus(); 128 | 129 | screen.key('C-q', function() { 130 | topleft.kill(); 131 | topright.kill(); 132 | bottomleft.kill(); 133 | bottomright.kill(); 134 | return screen.destroy(); 135 | }); 136 | 137 | screen.program.key('S-tab', function() { 138 | screen.focusNext(); 139 | screen.render(); 140 | }); 141 | 142 | screen.render(); 143 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/example/simple-form.js: -------------------------------------------------------------------------------- 1 | var blessed = require('blessed') 2 | , screen = blessed.screen(); 3 | 4 | var form = blessed.form({ 5 | parent: screen, 6 | keys: true, 7 | left: 0, 8 | top: 0, 9 | width: 30, 10 | height: 4, 11 | bg: 'green', 12 | content: 'Submit or cancel?' 13 | }); 14 | 15 | var submit = blessed.button({ 16 | parent: form, 17 | mouse: true, 18 | keys: true, 19 | shrink: true, 20 | padding: { 21 | left: 1, 22 | right: 1 23 | }, 24 | left: 10, 25 | top: 2, 26 | shrink: true, 27 | name: 'submit', 28 | content: 'submit', 29 | style: { 30 | bg: 'blue', 31 | focus: { 32 | bg: 'red' 33 | }, 34 | hover: { 35 | bg: 'red' 36 | } 37 | } 38 | }); 39 | 40 | var cancel = blessed.button({ 41 | parent: form, 42 | mouse: true, 43 | keys: true, 44 | shrink: true, 45 | padding: { 46 | left: 1, 47 | right: 1 48 | }, 49 | left: 20, 50 | top: 2, 51 | shrink: true, 52 | name: 'cancel', 53 | content: 'cancel', 54 | style: { 55 | bg: 'blue', 56 | focus: { 57 | bg: 'red' 58 | }, 59 | hover: { 60 | bg: 'red' 61 | } 62 | } 63 | }); 64 | 65 | submit.on('press', function() { 66 | form.submit(); 67 | }); 68 | 69 | cancel.on('press', function() { 70 | form.reset(); 71 | }); 72 | 73 | form.on('submit', function(data) { 74 | form.setContent('Submitted.'); 75 | screen.render(); 76 | }); 77 | 78 | form.on('reset', function(data) { 79 | form.setContent('Canceled.'); 80 | screen.render(); 81 | }); 82 | 83 | screen.key('q', function() { 84 | process.exit(0); 85 | }); 86 | 87 | screen.render(); 88 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/example/widget.js: -------------------------------------------------------------------------------- 1 | var blessed = require('../'); 2 | 3 | // Create a screen object. 4 | var screen = blessed.screen(); 5 | 6 | // Create a box perfectly centered horizontally and vertically. 7 | var box = blessed.box({ 8 | top: 'center', 9 | left: 'center', 10 | width: '50%', 11 | height: '50%', 12 | content: 'Hello {bold}world{/bold}!', 13 | tags: true, 14 | border: { 15 | type: 'line' 16 | }, 17 | style: { 18 | fg: 'white', 19 | bg: 'magenta', 20 | border: { 21 | fg: '#ffffff' 22 | }, 23 | hover: { 24 | bg: 'green' 25 | } 26 | } 27 | }); 28 | 29 | // Append our box to the screen. 30 | screen.append(box); 31 | 32 | // If our box is clicked, change the content. 33 | box.on('click', function(data) { 34 | box.setContent('{center}Some different {red-fg}content{/red-fg}.{/center}'); 35 | screen.render(); 36 | }); 37 | 38 | // If box is focused, handle `enter` and give us some more content. 39 | box.key('enter', function() { 40 | box.setContent('{right}Even different {black-fg}content{/black-fg}.{/right}\n'); 41 | box.setLine(1, 'bar'); 42 | box.insertLine(1, 'foo'); 43 | screen.render(); 44 | }); 45 | 46 | // Quit on Escape, q, or Control-C. 47 | screen.key(['escape', 'q', 'C-c'], function(ch, key) { 48 | return process.exit(0); 49 | }); 50 | 51 | // Focus our element. 52 | box.focus(); 53 | 54 | // Render the screen. 55 | screen.render(); 56 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/blessed'); 2 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/blessed.js: -------------------------------------------------------------------------------- 1 | /** 2 | * blessed - a high-level terminal interface library for node.js 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Blessed 9 | */ 10 | 11 | function blessed() { 12 | return blessed.program.apply(null, arguments); 13 | } 14 | 15 | blessed.program = blessed.Program = require('./program'); 16 | blessed.tput = blessed.Tput = require('./tput'); 17 | blessed.widget = require('./widget'); 18 | blessed.colors = require('./colors'); 19 | blessed.unicode = require('./unicode'); 20 | blessed.helpers = require('./helpers'); 21 | 22 | blessed.helpers.sprintf = blessed.tput.sprintf; 23 | blessed.helpers.tryRead = blessed.tput.tryRead; 24 | blessed.helpers.merge(blessed, blessed.helpers); 25 | 26 | blessed.helpers.merge(blessed, blessed.widget); 27 | 28 | /** 29 | * Expose 30 | */ 31 | 32 | module.exports = blessed; 33 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widget.js: -------------------------------------------------------------------------------- 1 | /** 2 | * widget.js - high-level interface for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | var widget = exports; 8 | 9 | widget.classes = [ 10 | 'Node', 11 | 'Screen', 12 | 'Element', 13 | 'Box', 14 | 'Text', 15 | 'Line', 16 | 'ScrollableBox', 17 | 'ScrollableText', 18 | 'BigText', 19 | 'List', 20 | 'Form', 21 | 'Input', 22 | 'Textarea', 23 | 'Textbox', 24 | 'Button', 25 | 'ProgressBar', 26 | 'FileManager', 27 | 'Checkbox', 28 | 'RadioSet', 29 | 'RadioButton', 30 | 'Prompt', 31 | 'Question', 32 | 'Message', 33 | 'Loading', 34 | 'Listbar', 35 | 'Log', 36 | 'Table', 37 | 'ListTable', 38 | 'Terminal', 39 | 'Image', 40 | 'ANSIImage', 41 | 'OverlayImage', 42 | 'Video', 43 | 'Layout' 44 | ]; 45 | 46 | widget.classes.forEach(function(name) { 47 | var file = name.toLowerCase(); 48 | widget[name] = widget[file] = require('./widgets/' + file); 49 | }); 50 | 51 | widget.aliases = { 52 | 'ListBar': 'Listbar', 53 | 'PNG': 'ANSIImage' 54 | }; 55 | 56 | Object.keys(widget.aliases).forEach(function(key) { 57 | var name = widget.aliases[key]; 58 | widget[key] = widget[name]; 59 | widget[key.toLowerCase()] = widget[name]; 60 | }); 61 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/ansiimage.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ansiimage.js - render PNGS/GIFS as ANSI 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var cp = require('child_process'); 12 | 13 | var colors = require('../colors'); 14 | 15 | var Node = require('./node'); 16 | var Box = require('./box'); 17 | 18 | var tng = require('../../vendor/tng'); 19 | 20 | /** 21 | * ANSIImage 22 | */ 23 | 24 | function ANSIImage(options) { 25 | var self = this; 26 | 27 | if (!(this instanceof Node)) { 28 | return new ANSIImage(options); 29 | } 30 | 31 | options = options || {}; 32 | options.shrink = true; 33 | 34 | Box.call(this, options); 35 | 36 | this.scale = this.options.scale || 1.0; 37 | this.options.animate = this.options.animate !== false; 38 | this._noFill = true; 39 | 40 | if (this.options.file) { 41 | this.setImage(this.options.file); 42 | } 43 | 44 | this.screen.on('prerender', function() { 45 | var lpos = self.lpos; 46 | if (!lpos) return; 47 | // prevent image from blending with itself if there are alpha channels 48 | self.screen.clearRegion(lpos.xi, lpos.xl, lpos.yi, lpos.yl); 49 | }); 50 | 51 | this.on('destroy', function() { 52 | self.stop(); 53 | }); 54 | } 55 | 56 | ANSIImage.prototype.__proto__ = Box.prototype; 57 | 58 | ANSIImage.prototype.type = 'ansiimage'; 59 | 60 | ANSIImage.curl = function(url) { 61 | try { 62 | return cp.execFileSync('curl', 63 | ['-s', '-A', '', url], 64 | { stdio: ['ignore', 'pipe', 'ignore'] }); 65 | } catch (e) { 66 | ; 67 | } 68 | try { 69 | return cp.execFileSync('wget', 70 | ['-U', '', '-O', '-', url], 71 | { stdio: ['ignore', 'pipe', 'ignore'] }); 72 | } catch (e) { 73 | ; 74 | } 75 | throw new Error('curl or wget failed.'); 76 | }; 77 | 78 | ANSIImage.prototype.setImage = function(file) { 79 | this.file = typeof file === 'string' ? file : null; 80 | 81 | if (/^https?:/.test(file)) { 82 | file = ANSIImage.curl(file); 83 | } 84 | 85 | var width = this.position.width; 86 | var height = this.position.height; 87 | 88 | if (width != null) { 89 | width = this.width; 90 | } 91 | 92 | if (height != null) { 93 | height = this.height; 94 | } 95 | 96 | try { 97 | this.setContent(''); 98 | 99 | this.img = tng(file, { 100 | colors: colors, 101 | width: width, 102 | height: height, 103 | scale: this.scale, 104 | ascii: this.options.ascii, 105 | speed: this.options.speed, 106 | filename: this.file 107 | }); 108 | 109 | if (width == null || height == null) { 110 | this.width = this.img.cellmap[0].length; 111 | this.height = this.img.cellmap.length; 112 | } 113 | 114 | if (this.img.frames && this.options.animate) { 115 | this.play(); 116 | } else { 117 | this.cellmap = this.img.cellmap; 118 | } 119 | } catch (e) { 120 | this.setContent('Image Error: ' + e.message); 121 | this.img = null; 122 | this.cellmap = null; 123 | } 124 | }; 125 | 126 | ANSIImage.prototype.play = function() { 127 | var self = this; 128 | if (!this.img) return; 129 | return this.img.play(function(bmp, cellmap) { 130 | self.cellmap = cellmap; 131 | self.screen.render(); 132 | }); 133 | }; 134 | 135 | ANSIImage.prototype.pause = function() { 136 | if (!this.img) return; 137 | return this.img.pause(); 138 | }; 139 | 140 | ANSIImage.prototype.stop = function() { 141 | if (!this.img) return; 142 | return this.img.stop(); 143 | }; 144 | 145 | ANSIImage.prototype.clearImage = function() { 146 | this.stop(); 147 | this.setContent(''); 148 | this.img = null; 149 | this.cellmap = null; 150 | }; 151 | 152 | ANSIImage.prototype.render = function() { 153 | var coords = this._render(); 154 | if (!coords) return; 155 | 156 | if (this.img && this.cellmap) { 157 | this.img.renderElement(this.cellmap, this); 158 | } 159 | 160 | return coords; 161 | }; 162 | 163 | /** 164 | * Expose 165 | */ 166 | 167 | module.exports = ANSIImage; 168 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/box.js: -------------------------------------------------------------------------------- 1 | /** 2 | * box.js - box element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Element = require('./element'); 13 | 14 | /** 15 | * Box 16 | */ 17 | 18 | function Box(options) { 19 | if (!(this instanceof Node)) { 20 | return new Box(options); 21 | } 22 | options = options || {}; 23 | Element.call(this, options); 24 | } 25 | 26 | Box.prototype.__proto__ = Element.prototype; 27 | 28 | Box.prototype.type = 'box'; 29 | 30 | /** 31 | * Expose 32 | */ 33 | 34 | module.exports = Box; 35 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/button.js: -------------------------------------------------------------------------------- 1 | /** 2 | * button.js - button element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Input = require('./input'); 13 | 14 | /** 15 | * Button 16 | */ 17 | 18 | function Button(options) { 19 | var self = this; 20 | 21 | if (!(this instanceof Node)) { 22 | return new Button(options); 23 | } 24 | 25 | options = options || {}; 26 | 27 | if (options.autoFocus == null) { 28 | options.autoFocus = false; 29 | } 30 | 31 | Input.call(this, options); 32 | 33 | this.on('keypress', function(ch, key) { 34 | if (key.name === 'enter' || key.name === 'space') { 35 | return self.press(); 36 | } 37 | }); 38 | 39 | if (this.options.mouse) { 40 | this.on('click', function() { 41 | return self.press(); 42 | }); 43 | } 44 | } 45 | 46 | Button.prototype.__proto__ = Input.prototype; 47 | 48 | Button.prototype.type = 'button'; 49 | 50 | Button.prototype.press = function() { 51 | this.focus(); 52 | this.value = true; 53 | var result = this.emit('press'); 54 | delete this.value; 55 | return result; 56 | }; 57 | 58 | /** 59 | * Expose 60 | */ 61 | 62 | module.exports = Button; 63 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/checkbox.js: -------------------------------------------------------------------------------- 1 | /** 2 | * checkbox.js - checkbox element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Input = require('./input'); 13 | 14 | /** 15 | * Checkbox 16 | */ 17 | 18 | function Checkbox(options) { 19 | var self = this; 20 | 21 | if (!(this instanceof Node)) { 22 | return new Checkbox(options); 23 | } 24 | 25 | options = options || {}; 26 | 27 | Input.call(this, options); 28 | 29 | this.text = options.content || options.text || ''; 30 | this.checked = this.value = options.checked || false; 31 | 32 | this.on('keypress', function(ch, key) { 33 | if (key.name === 'enter' || key.name === 'space') { 34 | self.toggle(); 35 | self.screen.render(); 36 | } 37 | }); 38 | 39 | if (options.mouse) { 40 | this.on('click', function() { 41 | self.toggle(); 42 | self.screen.render(); 43 | }); 44 | } 45 | 46 | this.on('focus', function() { 47 | var lpos = self.lpos; 48 | if (!lpos) return; 49 | self.screen.program.lsaveCursor('checkbox'); 50 | self.screen.program.cup(lpos.yi, lpos.xi + 1); 51 | self.screen.program.showCursor(); 52 | }); 53 | 54 | this.on('blur', function() { 55 | self.screen.program.lrestoreCursor('checkbox', true); 56 | }); 57 | } 58 | 59 | Checkbox.prototype.__proto__ = Input.prototype; 60 | 61 | Checkbox.prototype.type = 'checkbox'; 62 | 63 | Checkbox.prototype.render = function() { 64 | this.clearPos(true); 65 | this.setContent('[' + (this.checked ? 'x' : ' ') + '] ' + this.text, true); 66 | return this._render(); 67 | }; 68 | 69 | Checkbox.prototype.check = function() { 70 | if (this.checked) return; 71 | this.checked = this.value = true; 72 | this.emit('check'); 73 | }; 74 | 75 | Checkbox.prototype.uncheck = function() { 76 | if (!this.checked) return; 77 | this.checked = this.value = false; 78 | this.emit('uncheck'); 79 | }; 80 | 81 | Checkbox.prototype.toggle = function() { 82 | return this.checked 83 | ? this.uncheck() 84 | : this.check(); 85 | }; 86 | 87 | /** 88 | * Expose 89 | */ 90 | 91 | module.exports = Checkbox; 92 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/image.js: -------------------------------------------------------------------------------- 1 | /** 2 | * image.js - image element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Box = require('./box'); 13 | 14 | /** 15 | * Image 16 | */ 17 | 18 | function Image(options) { 19 | if (!(this instanceof Node)) { 20 | return new Image(options); 21 | } 22 | 23 | options = options || {}; 24 | options.type = options.itype || options.type || 'ansi'; 25 | 26 | Box.call(this, options); 27 | 28 | if (options.type === 'ansi' && this.type !== 'ansiimage') { 29 | var ANSIImage = require('./ansiimage'); 30 | Object.getOwnPropertyNames(ANSIImage.prototype).forEach(function(key) { 31 | if (key === 'type') return; 32 | Object.defineProperty(this, key, 33 | Object.getOwnPropertyDescriptor(ANSIImage.prototype, key)); 34 | }, this); 35 | ANSIImage.call(this, options); 36 | return this; 37 | } 38 | 39 | if (options.type === 'overlay' && this.type !== 'overlayimage') { 40 | var OverlayImage = require('./overlayimage'); 41 | Object.getOwnPropertyNames(OverlayImage.prototype).forEach(function(key) { 42 | if (key === 'type') return; 43 | Object.defineProperty(this, key, 44 | Object.getOwnPropertyDescriptor(OverlayImage.prototype, key)); 45 | }, this); 46 | OverlayImage.call(this, options); 47 | return this; 48 | } 49 | 50 | throw new Error('`type` must either be `ansi` or `overlay`.'); 51 | } 52 | 53 | Image.prototype.__proto__ = Box.prototype; 54 | 55 | Image.prototype.type = 'image'; 56 | 57 | /** 58 | * Expose 59 | */ 60 | 61 | module.exports = Image; 62 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/input.js: -------------------------------------------------------------------------------- 1 | /** 2 | * input.js - abstract input element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Box = require('./box'); 13 | 14 | /** 15 | * Input 16 | */ 17 | 18 | function Input(options) { 19 | if (!(this instanceof Node)) { 20 | return new Input(options); 21 | } 22 | options = options || {}; 23 | Box.call(this, options); 24 | } 25 | 26 | Input.prototype.__proto__ = Box.prototype; 27 | 28 | Input.prototype.type = 'input'; 29 | 30 | /** 31 | * Expose 32 | */ 33 | 34 | module.exports = Input; 35 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/line.js: -------------------------------------------------------------------------------- 1 | /** 2 | * line.js - line element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Box = require('./box'); 13 | 14 | /** 15 | * Line 16 | */ 17 | 18 | function Line(options) { 19 | if (!(this instanceof Node)) { 20 | return new Line(options); 21 | } 22 | 23 | options = options || {}; 24 | 25 | var orientation = options.orientation || 'vertical'; 26 | delete options.orientation; 27 | 28 | if (orientation === 'vertical') { 29 | options.width = 1; 30 | } else { 31 | options.height = 1; 32 | } 33 | 34 | Box.call(this, options); 35 | 36 | this.ch = !options.type || options.type === 'line' 37 | ? orientation === 'horizontal' ? '─' : '│' 38 | : options.ch || ' '; 39 | 40 | this.border = { 41 | type: 'bg', 42 | __proto__: this 43 | }; 44 | 45 | this.style.border = this.style; 46 | } 47 | 48 | Line.prototype.__proto__ = Box.prototype; 49 | 50 | Line.prototype.type = 'line'; 51 | 52 | /** 53 | * Expose 54 | */ 55 | 56 | module.exports = Line; 57 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/loading.js: -------------------------------------------------------------------------------- 1 | /** 2 | * loading.js - loading element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Box = require('./box'); 13 | var Text = require('./text'); 14 | 15 | /** 16 | * Loading 17 | */ 18 | 19 | function Loading(options) { 20 | if (!(this instanceof Node)) { 21 | return new Loading(options); 22 | } 23 | 24 | options = options || {}; 25 | 26 | Box.call(this, options); 27 | 28 | this._.icon = new Text({ 29 | parent: this, 30 | align: 'center', 31 | top: 2, 32 | left: 1, 33 | right: 1, 34 | height: 1, 35 | content: '|' 36 | }); 37 | } 38 | 39 | Loading.prototype.__proto__ = Box.prototype; 40 | 41 | Loading.prototype.type = 'loading'; 42 | 43 | Loading.prototype.load = function(text) { 44 | var self = this; 45 | 46 | // XXX Keep above: 47 | // var parent = this.parent; 48 | // this.detach(); 49 | // parent.append(this); 50 | 51 | this.show(); 52 | this.setContent(text); 53 | 54 | if (this._.timer) { 55 | this.stop(); 56 | } 57 | 58 | this.screen.lockKeys = true; 59 | 60 | this._.timer = setInterval(function() { 61 | if (self._.icon.content === '|') { 62 | self._.icon.setContent('/'); 63 | } else if (self._.icon.content === '/') { 64 | self._.icon.setContent('-'); 65 | } else if (self._.icon.content === '-') { 66 | self._.icon.setContent('\\'); 67 | } else if (self._.icon.content === '\\') { 68 | self._.icon.setContent('|'); 69 | } 70 | self.screen.render(); 71 | }, 200); 72 | }; 73 | 74 | Loading.prototype.stop = function() { 75 | this.screen.lockKeys = false; 76 | this.hide(); 77 | if (this._.timer) { 78 | clearInterval(this._.timer); 79 | delete this._.timer; 80 | } 81 | this.screen.render(); 82 | }; 83 | 84 | /** 85 | * Expose 86 | */ 87 | 88 | module.exports = Loading; 89 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/log.js: -------------------------------------------------------------------------------- 1 | /** 2 | * log.js - log element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var util = require('util'); 12 | 13 | var nextTick = global.setImmediate || process.nextTick.bind(process); 14 | 15 | var Node = require('./node'); 16 | var ScrollableText = require('./scrollabletext'); 17 | 18 | /** 19 | * Log 20 | */ 21 | 22 | function Log(options) { 23 | var self = this; 24 | 25 | if (!(this instanceof Node)) { 26 | return new Log(options); 27 | } 28 | 29 | options = options || {}; 30 | 31 | ScrollableText.call(this, options); 32 | 33 | this.scrollback = options.scrollback != null 34 | ? options.scrollback 35 | : Infinity; 36 | this.scrollOnInput = options.scrollOnInput; 37 | 38 | this.on('set content', function() { 39 | if (!self._userScrolled || self.scrollOnInput) { 40 | nextTick(function() { 41 | self.setScrollPerc(100); 42 | self._userScrolled = false; 43 | self.screen.render(); 44 | }); 45 | } 46 | }); 47 | } 48 | 49 | Log.prototype.__proto__ = ScrollableText.prototype; 50 | 51 | Log.prototype.type = 'log'; 52 | 53 | Log.prototype.log = 54 | Log.prototype.add = function() { 55 | var args = Array.prototype.slice.call(arguments); 56 | if (typeof args[0] === 'object') { 57 | args[0] = util.inspect(args[0], true, 20, true); 58 | } 59 | var text = util.format.apply(util, args); 60 | this.emit('log', text); 61 | var ret = this.pushLine(text); 62 | if (this._clines.fake.length > this.scrollback) { 63 | this.shiftLine(0, (this.scrollback / 3) | 0); 64 | } 65 | return ret; 66 | }; 67 | 68 | Log.prototype._scroll = Log.prototype.scroll; 69 | Log.prototype.scroll = function(offset, always) { 70 | if (offset === 0) return this._scroll(offset, always); 71 | this._userScrolled = true; 72 | var ret = this._scroll(offset, always); 73 | if (this.getScrollPerc() === 100) { 74 | this._userScrolled = false; 75 | } 76 | return ret; 77 | }; 78 | 79 | /** 80 | * Expose 81 | */ 82 | 83 | module.exports = Log; 84 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/message.js: -------------------------------------------------------------------------------- 1 | /** 2 | * message.js - message element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Box = require('./box'); 13 | 14 | /** 15 | * Message / Error 16 | */ 17 | 18 | function Message(options) { 19 | if (!(this instanceof Node)) { 20 | return new Message(options); 21 | } 22 | 23 | options = options || {}; 24 | options.tags = true; 25 | 26 | Box.call(this, options); 27 | } 28 | 29 | Message.prototype.__proto__ = Box.prototype; 30 | 31 | Message.prototype.type = 'message'; 32 | 33 | Message.prototype.log = 34 | Message.prototype.display = function(text, time, callback) { 35 | var self = this; 36 | 37 | if (typeof time === 'function') { 38 | callback = time; 39 | time = null; 40 | } 41 | 42 | if (time == null) time = 3; 43 | 44 | // Keep above: 45 | // var parent = this.parent; 46 | // this.detach(); 47 | // parent.append(this); 48 | 49 | if (this.scrollable) { 50 | this.screen.saveFocus(); 51 | this.focus(); 52 | this.scrollTo(0); 53 | } 54 | 55 | this.show(); 56 | this.setContent(text); 57 | this.screen.render(); 58 | 59 | if (time === Infinity || time === -1 || time === 0) { 60 | var end = function() { 61 | if (end.done) return; 62 | end.done = true; 63 | if (self.scrollable) { 64 | try { 65 | self.screen.restoreFocus(); 66 | } catch (e) { 67 | ; 68 | } 69 | } 70 | self.hide(); 71 | self.screen.render(); 72 | if (callback) callback(); 73 | }; 74 | 75 | setTimeout(function() { 76 | self.onScreenEvent('keypress', function fn(ch, key) { 77 | if (key.name === 'mouse') return; 78 | if (self.scrollable) { 79 | if ((key.name === 'up' || (self.options.vi && key.name === 'k')) 80 | || (key.name === 'down' || (self.options.vi && key.name === 'j')) 81 | || (self.options.vi && key.name === 'u' && key.ctrl) 82 | || (self.options.vi && key.name === 'd' && key.ctrl) 83 | || (self.options.vi && key.name === 'b' && key.ctrl) 84 | || (self.options.vi && key.name === 'f' && key.ctrl) 85 | || (self.options.vi && key.name === 'g' && !key.shift) 86 | || (self.options.vi && key.name === 'g' && key.shift)) { 87 | return; 88 | } 89 | } 90 | if (self.options.ignoreKeys && ~self.options.ignoreKeys.indexOf(key.name)) { 91 | return; 92 | } 93 | self.removeScreenEvent('keypress', fn); 94 | end(); 95 | }); 96 | // XXX May be affected by new element.options.mouse option. 97 | if (!self.options.mouse) return; 98 | self.onScreenEvent('mouse', function fn(data) { 99 | if (data.action === 'mousemove') return; 100 | self.removeScreenEvent('mouse', fn); 101 | end(); 102 | }); 103 | }, 10); 104 | 105 | return; 106 | } 107 | 108 | setTimeout(function() { 109 | self.hide(); 110 | self.screen.render(); 111 | if (callback) callback(); 112 | }, time * 1000); 113 | }; 114 | 115 | Message.prototype.error = function(text, time, callback) { 116 | return this.display('{red-fg}Error: ' + text + '{/red-fg}', time, callback); 117 | }; 118 | 119 | /** 120 | * Expose 121 | */ 122 | 123 | module.exports = Message; 124 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/prompt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * prompt.js - prompt element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Box = require('./box'); 13 | var Button = require('./button'); 14 | var Textbox = require('./textbox'); 15 | 16 | /** 17 | * Prompt 18 | */ 19 | 20 | function Prompt(options) { 21 | if (!(this instanceof Node)) { 22 | return new Prompt(options); 23 | } 24 | 25 | options = options || {}; 26 | 27 | options.hidden = true; 28 | 29 | Box.call(this, options); 30 | 31 | this._.input = new Textbox({ 32 | parent: this, 33 | top: 3, 34 | height: 1, 35 | left: 2, 36 | right: 2, 37 | bg: 'black' 38 | }); 39 | 40 | this._.okay = new Button({ 41 | parent: this, 42 | top: 5, 43 | height: 1, 44 | left: 2, 45 | width: 6, 46 | content: 'Okay', 47 | align: 'center', 48 | bg: 'black', 49 | hoverBg: 'blue', 50 | autoFocus: false, 51 | mouse: true 52 | }); 53 | 54 | this._.cancel = new Button({ 55 | parent: this, 56 | top: 5, 57 | height: 1, 58 | shrink: true, 59 | left: 10, 60 | width: 8, 61 | content: 'Cancel', 62 | align: 'center', 63 | bg: 'black', 64 | hoverBg: 'blue', 65 | autoFocus: false, 66 | mouse: true 67 | }); 68 | } 69 | 70 | Prompt.prototype.__proto__ = Box.prototype; 71 | 72 | Prompt.prototype.type = 'prompt'; 73 | 74 | Prompt.prototype.input = 75 | Prompt.prototype.setInput = 76 | Prompt.prototype.readInput = function(text, value, callback) { 77 | var self = this; 78 | var okay, cancel; 79 | 80 | if (!callback) { 81 | callback = value; 82 | value = ''; 83 | } 84 | 85 | // Keep above: 86 | // var parent = this.parent; 87 | // this.detach(); 88 | // parent.append(this); 89 | 90 | this.show(); 91 | this.setContent(' ' + text); 92 | 93 | this._.input.value = value; 94 | 95 | this.screen.saveFocus(); 96 | 97 | this._.okay.on('press', okay = function() { 98 | self._.input.submit(); 99 | }); 100 | 101 | this._.cancel.on('press', cancel = function() { 102 | self._.input.cancel(); 103 | }); 104 | 105 | this._.input.readInput(function(err, data) { 106 | self.hide(); 107 | self.screen.restoreFocus(); 108 | self._.okay.removeListener('press', okay); 109 | self._.cancel.removeListener('press', cancel); 110 | return callback(err, data); 111 | }); 112 | 113 | this.screen.render(); 114 | }; 115 | 116 | /** 117 | * Expose 118 | */ 119 | 120 | module.exports = Prompt; 121 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/question.js: -------------------------------------------------------------------------------- 1 | /** 2 | * question.js - question element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Box = require('./box'); 13 | var Button = require('./button'); 14 | 15 | /** 16 | * Question 17 | */ 18 | 19 | function Question(options) { 20 | if (!(this instanceof Node)) { 21 | return new Question(options); 22 | } 23 | 24 | options = options || {}; 25 | options.hidden = true; 26 | 27 | Box.call(this, options); 28 | 29 | this._.okay = new Button({ 30 | screen: this.screen, 31 | parent: this, 32 | top: 2, 33 | height: 1, 34 | left: 2, 35 | width: 6, 36 | content: 'Okay', 37 | align: 'center', 38 | bg: 'black', 39 | hoverBg: 'blue', 40 | autoFocus: false, 41 | mouse: true 42 | }); 43 | 44 | this._.cancel = new Button({ 45 | screen: this.screen, 46 | parent: this, 47 | top: 2, 48 | height: 1, 49 | shrink: true, 50 | left: 10, 51 | width: 8, 52 | content: 'Cancel', 53 | align: 'center', 54 | bg: 'black', 55 | hoverBg: 'blue', 56 | autoFocus: false, 57 | mouse: true 58 | }); 59 | } 60 | 61 | Question.prototype.__proto__ = Box.prototype; 62 | 63 | Question.prototype.type = 'question'; 64 | 65 | Question.prototype.ask = function(text, callback) { 66 | var self = this; 67 | var press, okay, cancel; 68 | 69 | // Keep above: 70 | // var parent = this.parent; 71 | // this.detach(); 72 | // parent.append(this); 73 | 74 | this.show(); 75 | this.setContent(' ' + text); 76 | 77 | this.onScreenEvent('keypress', press = function(ch, key) { 78 | if (key.name === 'mouse') return; 79 | if (key.name !== 'enter' 80 | && key.name !== 'escape' 81 | && key.name !== 'q' 82 | && key.name !== 'y' 83 | && key.name !== 'n') { 84 | return; 85 | } 86 | done(null, key.name === 'enter' || key.name === 'y'); 87 | }); 88 | 89 | this._.okay.on('press', okay = function() { 90 | done(null, true); 91 | }); 92 | 93 | this._.cancel.on('press', cancel = function() { 94 | done(null, false); 95 | }); 96 | 97 | this.screen.saveFocus(); 98 | this.focus(); 99 | 100 | function done(err, data) { 101 | self.hide(); 102 | self.screen.restoreFocus(); 103 | self.removeScreenEvent('keypress', press); 104 | self._.okay.removeListener('press', okay); 105 | self._.cancel.removeListener('press', cancel); 106 | return callback(err, data); 107 | } 108 | 109 | this.screen.render(); 110 | }; 111 | 112 | /** 113 | * Expose 114 | */ 115 | 116 | module.exports = Question; 117 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/radiobutton.js: -------------------------------------------------------------------------------- 1 | /** 2 | * radiobutton.js - radio button element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Checkbox = require('./checkbox'); 13 | 14 | /** 15 | * RadioButton 16 | */ 17 | 18 | function RadioButton(options) { 19 | var self = this; 20 | 21 | if (!(this instanceof Node)) { 22 | return new RadioButton(options); 23 | } 24 | 25 | options = options || {}; 26 | 27 | Checkbox.call(this, options); 28 | 29 | this.on('check', function() { 30 | var el = self; 31 | while (el = el.parent) { 32 | if (el.type === 'radio-set' 33 | || el.type === 'form') break; 34 | } 35 | el = el || self.parent; 36 | el.forDescendants(function(el) { 37 | if (el.type !== 'radio-button' || el === self) { 38 | return; 39 | } 40 | el.uncheck(); 41 | }); 42 | }); 43 | } 44 | 45 | RadioButton.prototype.__proto__ = Checkbox.prototype; 46 | 47 | RadioButton.prototype.type = 'radio-button'; 48 | 49 | RadioButton.prototype.render = function() { 50 | this.clearPos(true); 51 | this.setContent('(' + (this.checked ? '*' : ' ') + ') ' + this.text, true); 52 | return this._render(); 53 | }; 54 | 55 | RadioButton.prototype.toggle = RadioButton.prototype.check; 56 | 57 | /** 58 | * Expose 59 | */ 60 | 61 | module.exports = RadioButton; 62 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/radioset.js: -------------------------------------------------------------------------------- 1 | /** 2 | * radioset.js - radio set element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Box = require('./box'); 13 | 14 | /** 15 | * RadioSet 16 | */ 17 | 18 | function RadioSet(options) { 19 | if (!(this instanceof Node)) { 20 | return new RadioSet(options); 21 | } 22 | options = options || {}; 23 | // Possibly inherit parent's style. 24 | // options.style = this.parent.style; 25 | Box.call(this, options); 26 | } 27 | 28 | RadioSet.prototype.__proto__ = Box.prototype; 29 | 30 | RadioSet.prototype.type = 'radio-set'; 31 | 32 | /** 33 | * Expose 34 | */ 35 | 36 | module.exports = RadioSet; 37 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/scrollabletext.js: -------------------------------------------------------------------------------- 1 | /** 2 | * scrollabletext.js - scrollable text element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var ScrollableBox = require('./scrollablebox'); 13 | 14 | /** 15 | * ScrollableText 16 | */ 17 | 18 | function ScrollableText(options) { 19 | if (!(this instanceof Node)) { 20 | return new ScrollableText(options); 21 | } 22 | options = options || {}; 23 | options.alwaysScroll = true; 24 | ScrollableBox.call(this, options); 25 | } 26 | 27 | ScrollableText.prototype.__proto__ = ScrollableBox.prototype; 28 | 29 | ScrollableText.prototype.type = 'scrollable-text'; 30 | 31 | /** 32 | * Expose 33 | */ 34 | 35 | module.exports = ScrollableText; 36 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/text.js: -------------------------------------------------------------------------------- 1 | /** 2 | * text.js - text element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Element = require('./element'); 13 | 14 | /** 15 | * Text 16 | */ 17 | 18 | function Text(options) { 19 | if (!(this instanceof Node)) { 20 | return new Text(options); 21 | } 22 | options = options || {}; 23 | options.shrink = true; 24 | Element.call(this, options); 25 | } 26 | 27 | Text.prototype.__proto__ = Element.prototype; 28 | 29 | Text.prototype.type = 'text'; 30 | 31 | /** 32 | * Expose 33 | */ 34 | 35 | module.exports = Text; 36 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/textbox.js: -------------------------------------------------------------------------------- 1 | /** 2 | * textbox.js - textbox element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var Node = require('./node'); 12 | var Textarea = require('./textarea'); 13 | 14 | /** 15 | * Textbox 16 | */ 17 | 18 | function Textbox(options) { 19 | if (!(this instanceof Node)) { 20 | return new Textbox(options); 21 | } 22 | 23 | options = options || {}; 24 | 25 | options.scrollable = false; 26 | 27 | Textarea.call(this, options); 28 | 29 | this.secret = options.secret; 30 | this.censor = options.censor; 31 | } 32 | 33 | Textbox.prototype.__proto__ = Textarea.prototype; 34 | 35 | Textbox.prototype.type = 'textbox'; 36 | 37 | Textbox.prototype.__olistener = Textbox.prototype._listener; 38 | Textbox.prototype._listener = function(ch, key) { 39 | if (key.name === 'enter') { 40 | this._done(null, this.value); 41 | return; 42 | } 43 | return this.__olistener(ch, key); 44 | }; 45 | 46 | Textbox.prototype.setValue = function(value) { 47 | var visible, val; 48 | if (value == null) { 49 | value = this.value; 50 | } 51 | if (this._value !== value) { 52 | value = value.replace(/\n/g, ''); 53 | this.value = value; 54 | this._value = value; 55 | if (this.secret) { 56 | this.setContent(''); 57 | } else if (this.censor) { 58 | this.setContent(Array(this.value.length + 1).join('*')); 59 | } else { 60 | visible = -(this.width - this.iwidth - 1); 61 | val = this.value.replace(/\t/g, this.screen.tabc); 62 | this.setContent(val.slice(visible)); 63 | } 64 | this._updateCursor(); 65 | } 66 | }; 67 | 68 | Textbox.prototype.submit = function() { 69 | if (!this.__listener) return; 70 | return this.__listener('\r', { name: 'enter' }); 71 | }; 72 | 73 | /** 74 | * Expose 75 | */ 76 | 77 | module.exports = Textbox; 78 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/lib/widgets/video.js: -------------------------------------------------------------------------------- 1 | /** 2 | * video.js - video element for blessed 3 | * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). 4 | * https://github.com/chjj/blessed 5 | */ 6 | 7 | /** 8 | * Modules 9 | */ 10 | 11 | var cp = require('child_process'); 12 | 13 | var Node = require('./node'); 14 | var Box = require('./box'); 15 | var Terminal = require('./terminal'); 16 | 17 | /** 18 | * Video 19 | */ 20 | 21 | function Video(options) { 22 | var self = this 23 | , shell 24 | , args; 25 | 26 | if (!(this instanceof Node)) { 27 | return new Video(options); 28 | } 29 | 30 | options = options || {}; 31 | 32 | Box.call(this, options); 33 | 34 | if (this.exists('mplayer')) { 35 | shell = 'mplayer'; 36 | args = ['-vo', 'caca', '-quiet', options.file]; 37 | } else if (this.exists('mpv')) { 38 | shell = 'mpv'; 39 | args = ['--vo', 'caca', '--really-quiet', options.file]; 40 | } else { 41 | this.parseTags = true; 42 | this.setContent('{red-fg}{bold}Error:{/bold}' 43 | + ' mplayer or mpv not installed.{/red-fg}'); 44 | return this; 45 | } 46 | 47 | var opts = { 48 | parent: this, 49 | left: 0, 50 | top: 0, 51 | width: this.width - this.iwidth, 52 | height: this.height - this.iheight, 53 | shell: shell, 54 | args: args.slice() 55 | }; 56 | 57 | this.now = Date.now() / 1000 | 0; 58 | this.start = opts.start || 0; 59 | if (this.start) { 60 | if (shell === 'mplayer') { 61 | opts.args.unshift('-ss', this.start + ''); 62 | } else if (shell === 'mpv') { 63 | opts.args.unshift('--start', this.start + ''); 64 | } 65 | } 66 | 67 | var DISPLAY = process.env.DISPLAY; 68 | delete process.env.DISPLAY; 69 | this.tty = new Terminal(opts); 70 | process.env.DISPLAY = DISPLAY; 71 | 72 | this.on('click', function() { 73 | self.tty.pty.write('p'); 74 | }); 75 | 76 | // mplayer/mpv cannot resize itself in the terminal, so we have 77 | // to restart it at the correct start time. 78 | this.on('resize', function() { 79 | self.tty.destroy(); 80 | 81 | var opts = { 82 | parent: self, 83 | left: 0, 84 | top: 0, 85 | width: self.width - self.iwidth, 86 | height: self.height - self.iheight, 87 | shell: shell, 88 | args: args.slice() 89 | }; 90 | 91 | var watched = (Date.now() / 1000 | 0) - self.now; 92 | self.now = Date.now() / 1000 | 0; 93 | self.start += watched; 94 | if (shell === 'mplayer') { 95 | opts.args.unshift('-ss', self.start + ''); 96 | } else if (shell === 'mpv') { 97 | opts.args.unshift('--start', self.start + ''); 98 | } 99 | 100 | var DISPLAY = process.env.DISPLAY; 101 | delete process.env.DISPLAY; 102 | self.tty = new Terminal(opts); 103 | process.env.DISPLAY = DISPLAY; 104 | self.screen.render(); 105 | }); 106 | } 107 | 108 | Video.prototype.__proto__ = Box.prototype; 109 | 110 | Video.prototype.type = 'video'; 111 | 112 | Video.prototype.exists = function(program) { 113 | try { 114 | return !!+cp.execSync('type ' 115 | + program + ' > /dev/null 2> /dev/null' 116 | + ' && echo 1', { encoding: 'utf8' }).trim(); 117 | } catch (e) { 118 | return false; 119 | } 120 | }; 121 | 122 | /** 123 | * Expose 124 | */ 125 | 126 | module.exports = Video; 127 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "blessed", 3 | "description": "A high-level terminal interface library for node.js.", 4 | "author": { 5 | "name": "Christopher Jeffrey" 6 | }, 7 | "version": "0.1.81", 8 | "license": "MIT", 9 | "main": "./lib/blessed.js", 10 | "bin": { 11 | "blessed": "./bin/tput.js" 12 | }, 13 | "preferGlobal": false, 14 | "repository": { 15 | "type": "git", 16 | "url": "git://github.com/chjj/blessed.git" 17 | }, 18 | "homepage": "https://github.com/chjj/blessed", 19 | "bugs": { 20 | "url": "http://github.com/chjj/blessed/issues" 21 | }, 22 | "keywords": [ 23 | "curses", 24 | "tui", 25 | "tput", 26 | "terminfo", 27 | "termcap" 28 | ], 29 | "tags": [ 30 | "curses", 31 | "tui", 32 | "tput", 33 | "terminfo", 34 | "termcap" 35 | ], 36 | "engines": { 37 | "node": ">= 0.8.0" 38 | }, 39 | "browserify": { 40 | "transform": [ 41 | "./browser/transform.js" 42 | ] 43 | }, 44 | "gitHead": "a45575fee63fac158fd467087ec172f657bfec6b", 45 | "_id": "blessed@0.1.81", 46 | "scripts": {}, 47 | "_shasum": "f962d687ec2c369570ae71af843256e6d0ca1129", 48 | "_from": "blessed@>=0.1.80", 49 | "_npmVersion": "2.14.1", 50 | "_nodeVersion": "0.12.7", 51 | "_npmUser": { 52 | "name": "chjj", 53 | "email": "chjjeffrey@gmail.com" 54 | }, 55 | "maintainers": [ 56 | { 57 | "name": "chjj", 58 | "email": "chjjeffrey@gmail.com" 59 | } 60 | ], 61 | "dist": { 62 | "shasum": "f962d687ec2c369570ae71af843256e6d0ca1129", 63 | "tarball": "https://registry.npmjs.org/blessed/-/blessed-0.1.81.tgz" 64 | }, 65 | "directories": {}, 66 | "_resolved": "https://registry.npmjs.org/blessed/-/blessed-0.1.81.tgz" 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/usr/fonts/AUTHORS: -------------------------------------------------------------------------------- 1 | Dimitar Zhekov 2 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/usr/linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tidwall/jd/42fe71a941b1caca2811a7c7ca52b498a13bbee0/vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/usr/linux -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/usr/windows-ansi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tidwall/jd/42fe71a941b1caca2811a7c7ca52b498a13bbee0/vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/usr/windows-ansi -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/usr/xterm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tidwall/jd/42fe71a941b1caca2811a7c7ca52b498a13bbee0/vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/usr/xterm -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/usr/xterm-256color: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tidwall/jd/42fe71a941b1caca2811a7c7ca52b498a13bbee0/vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/blessed/usr/xterm-256color -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/.npmignore: -------------------------------------------------------------------------------- 1 | .git* 2 | build/ 3 | .lock-wscript 4 | out/ 5 | Makefile.gyp 6 | *.Makefile 7 | *.target.gyp.mk 8 | node_modules/ 9 | test/ 10 | *.node 11 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2015, Christopher Jeffrey (https://github.com/chjj/) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @type node-gyp > /dev/null 2>&1 && make gyp || make waf 3 | 4 | waf: 5 | node-waf configure build 6 | 7 | gyp: 8 | node-gyp configure 9 | node-gyp build 10 | 11 | clean: 12 | @type node-gyp > /dev/null 2>&1 && make clean-gyp || make clean-waf 13 | 14 | clean-waf: 15 | @rm -rf ./build .lock-wscript 16 | 17 | clean-gyp: 18 | @node-gyp clean 2>/dev/null 19 | 20 | .PHONY: all waf gyp clean clean-waf clean-gyp 21 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/README.md: -------------------------------------------------------------------------------- 1 | # pty.js 2 | 3 | `forkpty(3)` bindings for node.js. This allows you to fork processes with pseudo 4 | terminal file descriptors. It returns a terminal object which allows reads 5 | and writes. 6 | 7 | This is useful for: 8 | 9 | - Writing a terminal emulator. 10 | - Getting certain programs to *think* you're a terminal. This is useful if 11 | you need a program to send you control sequences. 12 | 13 | ## Example Usage 14 | 15 | ``` js 16 | var pty = require('pty.js'); 17 | 18 | var term = pty.spawn('bash', [], { 19 | name: 'xterm-color', 20 | cols: 80, 21 | rows: 30, 22 | cwd: process.env.HOME, 23 | env: process.env 24 | }); 25 | 26 | term.on('data', function(data) { 27 | console.log(data); 28 | }); 29 | 30 | term.write('ls\r'); 31 | term.resize(100, 40); 32 | term.write('ls /\r'); 33 | 34 | console.log(term.process); 35 | ``` 36 | 37 | ## Todo 38 | 39 | - Add tcsetattr(3), tcgetattr(3). 40 | - Add a way of determining the current foreground job for platforms other 41 | than Linux and OSX/Darwin. 42 | 43 | ## Contribution and License Agreement 44 | 45 | If you contribute code to this project, you are implicitly allowing your code 46 | to be distributed under the MIT license. You are also implicitly verifying that 47 | all code is your original work. `` 48 | 49 | ## License 50 | 51 | Copyright (c) 2012-2015, Christopher Jeffrey (MIT License). 52 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'targets': [{ 3 | 'target_name': 'pty', 4 | 'include_dirs' : [ 5 | '[![Version Badge][8]][3] 4 | 5 | `node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true. 6 | 7 | ## Installation 8 | 9 | This package is available on [npm][3] as: `extend` 10 | 11 | ``` sh 12 | npm install extend 13 | ``` 14 | 15 | ## Usage 16 | 17 | **Syntax:** extend **(** [`deep`], `target`, `object1`, [`objectN`] **)** 18 | 19 | *Extend one object with one or more others, returning the modified object.* 20 | 21 | Keep in mind that the target object will be modified, and will be returned from extend(). 22 | 23 | If a boolean true is specified as the first argument, extend performs a deep copy, recursively copying any objects it finds. Otherwise, the copy will share structure with the original object(s). 24 | Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over. 25 | 26 | ### Arguments 27 | 28 | * `deep` *Boolean* (optional) 29 | If set, the merge becomes recursive (i.e. deep copy). 30 | * `target` *Object* 31 | The object to extend. 32 | * `object1` *Object* 33 | The object that will be merged into the first. 34 | * `objectN` *Object* (Optional) 35 | More objects to merge into the first. 36 | 37 | ## License 38 | 39 | `node-extend` is licensed under the [MIT License][4]. 40 | 41 | ## Acknowledgements 42 | 43 | All credit to the jQuery authors for perfecting this amazing utility. 44 | 45 | Ported to Node.js by [Stefan Thomas][5] with contributions by [Jonathan Buchanan][6] and [Jordan Harband][7]. 46 | 47 | [1]: https://travis-ci.org/justmoon/node-extend.png 48 | [2]: https://travis-ci.org/justmoon/node-extend 49 | [3]: https://npmjs.org/package/extend 50 | [4]: http://opensource.org/licenses/MIT 51 | [5]: https://github.com/justmoon 52 | [6]: https://github.com/insin 53 | [7]: https://github.com/ljharb 54 | [8]: http://vb.teelaun.ch/justmoon/node-extend.svg 55 | [9]: https://david-dm.org/justmoon/node-extend.png 56 | [10]: https://david-dm.org/justmoon/node-extend 57 | [11]: https://david-dm.org/justmoon/node-extend/dev-status.png 58 | [12]: https://david-dm.org/justmoon/node-extend#info=devDependencies 59 | 60 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/extend/index.js: -------------------------------------------------------------------------------- 1 | var hasOwn = Object.prototype.hasOwnProperty; 2 | var toString = Object.prototype.toString; 3 | 4 | function isPlainObject(obj) { 5 | if (!obj || toString.call(obj) !== '[object Object]' || obj.nodeType || obj.setInterval) 6 | return false; 7 | 8 | var has_own_constructor = hasOwn.call(obj, 'constructor'); 9 | var has_is_property_of_method = hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); 10 | // Not own constructor property must be Object 11 | if (obj.constructor && !has_own_constructor && !has_is_property_of_method) 12 | return false; 13 | 14 | // Own properties are enumerated firstly, so to speed up, 15 | // if last one is own, then all properties are own. 16 | var key; 17 | for ( key in obj ) {} 18 | 19 | return key === undefined || hasOwn.call( obj, key ); 20 | }; 21 | 22 | module.exports = function extend() { 23 | var options, name, src, copy, copyIsArray, clone, 24 | target = arguments[0] || {}, 25 | i = 1, 26 | length = arguments.length, 27 | deep = false; 28 | 29 | // Handle a deep copy situation 30 | if ( typeof target === "boolean" ) { 31 | deep = target; 32 | target = arguments[1] || {}; 33 | // skip the boolean and the target 34 | i = 2; 35 | } 36 | 37 | // Handle case when target is a string or something (possible in deep copy) 38 | if ( typeof target !== "object" && typeof target !== "function") { 39 | target = {}; 40 | } 41 | 42 | for ( ; i < length; i++ ) { 43 | // Only deal with non-null/undefined values 44 | if ( (options = arguments[ i ]) != null ) { 45 | // Extend the base object 46 | for ( name in options ) { 47 | src = target[ name ]; 48 | copy = options[ name ]; 49 | 50 | // Prevent never-ending loop 51 | if ( target === copy ) { 52 | continue; 53 | } 54 | 55 | // Recurse if we're merging plain objects or arrays 56 | if ( deep && copy && ( isPlainObject(copy) || (copyIsArray = Array.isArray(copy)) ) ) { 57 | if ( copyIsArray ) { 58 | copyIsArray = false; 59 | clone = src && Array.isArray(src) ? src : []; 60 | 61 | } else { 62 | clone = src && isPlainObject(src) ? src : {}; 63 | } 64 | 65 | // Never move original objects, clone them 66 | target[ name ] = extend( deep, clone, copy ); 67 | 68 | // Don't bring in undefined values 69 | } else if ( copy !== undefined ) { 70 | target[ name ] = copy; 71 | } 72 | } 73 | } 74 | } 75 | 76 | // Return the modified object 77 | return target; 78 | }; 79 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/extend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "extend", 3 | "author": { 4 | "name": "Stefan Thomas", 5 | "email": "justmoon@members.fsf.org", 6 | "url": "http://www.justmoon.net" 7 | }, 8 | "version": "1.2.1", 9 | "description": "Port of jQuery.extend for Node.js", 10 | "main": "index", 11 | "scripts": { 12 | "test": "node test/index.js" 13 | }, 14 | "contributors": [ 15 | { 16 | "name": "Jordan Harband", 17 | "url": "https://github.com/ljharb" 18 | } 19 | ], 20 | "keywords": [ 21 | "extend", 22 | "clone", 23 | "merge" 24 | ], 25 | "repository": { 26 | "type": "git", 27 | "url": "https://github.com/justmoon/node-extend.git" 28 | }, 29 | "dependencies": {}, 30 | "devDependencies": { 31 | "tape": "~1.1.0" 32 | }, 33 | "bugs": { 34 | "url": "https://github.com/justmoon/node-extend/issues" 35 | }, 36 | "_id": "extend@1.2.1", 37 | "dist": { 38 | "shasum": "a0f5fd6cfc83a5fe49ef698d60ec8a624dd4576c", 39 | "tarball": "https://registry.npmjs.org/extend/-/extend-1.2.1.tgz" 40 | }, 41 | "_from": "extend@>=1.2.1 <1.3.0", 42 | "_npmVersion": "1.3.8", 43 | "_npmUser": { 44 | "name": "ljharb", 45 | "email": "ljharb@gmail.com" 46 | }, 47 | "maintainers": [ 48 | { 49 | "name": "justmoon", 50 | "email": "justmoon@members.fsf.org" 51 | }, 52 | { 53 | "name": "ljharb", 54 | "email": "ljharb@gmail.com" 55 | } 56 | ], 57 | "directories": {}, 58 | "_shasum": "a0f5fd6cfc83a5fe49ef698d60ec8a624dd4576c", 59 | "_resolved": "https://registry.npmjs.org/extend/-/extend-1.2.1.tgz" 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright (c) 2016 NAN contributors 5 | ----------------------------------- 6 | 7 | *NAN contributors listed at * 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/doc/asyncworker.md: -------------------------------------------------------------------------------- 1 | ## Asynchronous work helpers 2 | 3 | `Nan::AsyncWorker` and `Nan::AsyncProgressWorker` are helper classes that make working with asynchronous code easier. 4 | 5 | - Nan::AsyncWorker 6 | - Nan::AsyncProgressWorker 7 | - Nan::AsyncQueueWorker 8 | 9 | 10 | ### Nan::AsyncWorker 11 | 12 | `Nan::AsyncWorker` is an _abstract_ class that you can subclass to have much of the annoying asynchronous queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the asynchronous work is in progress. 13 | 14 | Definition: 15 | 16 | ```c++ 17 | class AsyncWorker { 18 | public: 19 | explicit AsyncWorker(Callback *callback_); 20 | 21 | virtual ~AsyncWorker(); 22 | 23 | virtual void WorkComplete(); 24 | 25 | void SaveToPersistent(const char *key, const v8::Local &value); 26 | 27 | void SaveToPersistent(const v8::Local &key, 28 | const v8::Local &value); 29 | 30 | void SaveToPersistent(uint32_t index, 31 | const v8::Local &value); 32 | 33 | v8::Local GetFromPersistent(const char *key) const; 34 | 35 | v8::Local GetFromPersistent(const v8::Local &key) const; 36 | 37 | v8::Local GetFromPersistent(uint32_t index) const; 38 | 39 | virtual void Execute() = 0; 40 | 41 | uv_work_t request; 42 | 43 | virtual void Destroy(); 44 | 45 | protected: 46 | Persistent persistentHandle; 47 | 48 | Callback *callback; 49 | 50 | virtual void HandleOKCallback(); 51 | 52 | virtual void HandleErrorCallback(); 53 | 54 | void SetErrorMessage(const char *msg); 55 | 56 | const char* ErrorMessage(); 57 | }; 58 | ``` 59 | 60 | 61 | ### Nan::AsyncProgressWorker 62 | 63 | `Nan::AsyncProgressWorker` is an _abstract_ class that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. 64 | 65 | Definition: 66 | 67 | ```c++ 68 | class AsyncProgressWorker : public AsyncWorker { 69 | public: 70 | explicit AsyncProgressWorker(Callback *callback_); 71 | 72 | virtual ~AsyncProgressWorker(); 73 | 74 | void WorkProgress(); 75 | 76 | class ExecutionProgress { 77 | public: 78 | void Signal() const; 79 | void Send(const char* data, size_t size) const; 80 | }; 81 | 82 | virtual void Execute(const ExecutionProgress& progress) = 0; 83 | 84 | virtual void HandleProgressCallback(const char *data, size_t size) = 0; 85 | 86 | virtual void Destroy(); 87 | ``` 88 | 89 | 90 | ### Nan::AsyncQueueWorker 91 | 92 | `Nan::AsyncQueueWorker` will run a `Nan::AsyncWorker` asynchronously via libuv. Both the `execute` and `after_work` steps are taken care of for you. Most of the logic for this is embedded in `Nan::AsyncWorker`. 93 | 94 | Definition: 95 | 96 | ```c++ 97 | void AsyncQueueWorker(AsyncWorker *); 98 | ``` 99 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/doc/buffers.md: -------------------------------------------------------------------------------- 1 | ## Buffers 2 | 3 | NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. 4 | 5 | - Nan::NewBuffer() 6 | - Nan::CopyBuffer() 7 | - Nan::FreeCallback() 8 | 9 | 10 | ### Nan::NewBuffer() 11 | 12 | Allocate a new `node::Buffer` object with the specified size and optional data. Calls `node::Buffer::New()`. 13 | 14 | Note that when creating a `Buffer` using `Nan::NewBuffer()` and an existing `char*`, it is assumed that the ownership of the pointer is being transferred to the new `Buffer` for management. 15 | When a `node::Buffer` instance is garbage collected and a `FreeCallback` has not been specified, `data` will be disposed of via a call to `free()`. 16 | You _must not_ free the memory space manually once you have created a `Buffer` in this way. 17 | 18 | Signature: 19 | 20 | ```c++ 21 | Nan::MaybeLocal Nan::NewBuffer(uint32_t size) 22 | Nan::MaybeLocal Nan::NewBuffer(char* data, uint32_t size) 23 | Nan::MaybeLocal Nan::NewBuffer(char *data, 24 | size_t length, 25 | Nan::FreeCallback callback, 26 | void *hint) 27 | ``` 28 | 29 | 30 | 31 | ### Nan::CopyBuffer() 32 | 33 | Similar to [`Nan::NewBuffer()`](#api_nan_new_buffer) except that an implicit memcpy will occur within Node. Calls `node::Buffer::Copy()`. 34 | 35 | Management of the `char*` is left to the user, you should manually free the memory space if necessary as the new `Buffer` will have its own copy. 36 | 37 | Signature: 38 | 39 | ```c++ 40 | Nan::MaybeLocal Nan::CopyBuffer(const char *data, uint32_t size) 41 | ``` 42 | 43 | 44 | 45 | ### Nan::FreeCallback() 46 | 47 | A free callback that can be provided to [`Nan::NewBuffer()`](#api_nan_new_buffer). 48 | The supplied callback will be invoked when the `Buffer` undergoes garbage collection. 49 | 50 | Signature: 51 | 52 | ```c++ 53 | typedef void (*FreeCallback)(char *data, void *hint); 54 | ``` 55 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/doc/callback.md: -------------------------------------------------------------------------------- 1 | ## Nan::Callback 2 | 3 | `Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. 4 | 5 | - Nan::Callback 6 | 7 | 8 | ### Nan::Callback 9 | 10 | ```c++ 11 | class Callback { 12 | public: 13 | Callback(); 14 | 15 | explicit Callback(const v8::Local &fn); 16 | 17 | ~Callback(); 18 | 19 | bool operator==(const Callback &other) const; 20 | 21 | bool operator!=(const Callback &other) const; 22 | 23 | v8::Local operator*() const; 24 | 25 | v8::Local operator()(v8::Local target, 26 | int argc = 0, 27 | v8::Local argv[] = 0) const; 28 | 29 | v8::Local operator()(int argc = 0, 30 | v8::Local argv[] = 0) const; 31 | 32 | void SetFunction(const v8::Local &fn); 33 | 34 | v8::Local GetFunction() const; 35 | 36 | bool IsEmpty() const; 37 | 38 | v8::Local Call(v8::Local target, 39 | int argc, 40 | v8::Local argv[]) const; 41 | 42 | v8::Local Call(int argc, v8::Local argv[]) const; 43 | }; 44 | ``` 45 | 46 | Example usage: 47 | 48 | ```c++ 49 | v8::Local function; 50 | Nan::Callback callback(function); 51 | callback.Call(0, 0); 52 | ``` 53 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/doc/converters.md: -------------------------------------------------------------------------------- 1 | ## Converters 2 | 3 | NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. 4 | 5 | - Nan::To() 6 | 7 | 8 | ### Nan::To() 9 | 10 | Converts a `v8::Local` to a different subtype of `v8::Value` or to a native data type. Returns a `Nan::MaybeLocal<>` or a `Nan::Maybe<>` accordingly. 11 | 12 | See [maybe_types.md](./maybe_types.md) for more information on `Nan::Maybe` types. 13 | 14 | Signatures: 15 | 16 | ```c++ 17 | // V8 types 18 | Nan::MaybeLocal Nan::To(v8::Local val); 19 | Nan::MaybeLocal Nan::To(v8::Local val); 20 | Nan::MaybeLocal Nan::To(v8::Local val); 21 | Nan::MaybeLocal Nan::To(v8::Local val); 22 | Nan::MaybeLocal Nan::To(v8::Local val); 23 | Nan::MaybeLocal Nan::To(v8::Local val); 24 | Nan::MaybeLocal Nan::To(v8::Local val); 25 | 26 | // Native types 27 | Nan::Maybe Nan::To(v8::Local val); 28 | Nan::Maybe Nan::To(v8::Local val); 29 | Nan::Maybe Nan::To(v8::Local val); 30 | Nan::Maybe Nan::To(v8::Local val); 31 | Nan::Maybe Nan::To(v8::Local val); 32 | ``` 33 | 34 | ### Example 35 | 36 | ```c++ 37 | v8::Local val; 38 | Nan::MaybeLocal str = Nan::To(val); 39 | Nan::Maybe d = Nan::To(val); 40 | ``` 41 | 42 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/doc/node_misc.md: -------------------------------------------------------------------------------- 1 | ## Miscellaneous Node Helpers 2 | 3 | - Nan::MakeCallback() 4 | - NAN_MODULE_INIT() 5 | - Nan::Export() 6 | 7 | 8 | 9 | ### Nan::MakeCallback() 10 | 11 | Wrappers around `node::MakeCallback()` providing a consistent API across all supported versions of Node. 12 | 13 | Use `MakeCallback()` rather than using `v8::Function#Call()` directly in order to properly process internal Node functionality including domains, async hooks, the microtask queue, and other debugging functionality. 14 | 15 | Signatures: 16 | 17 | ```c++ 18 | v8::Local Nan::MakeCallback(v8::Local target, 19 | v8::Local func, 20 | int argc, 21 | v8::Local* argv); 22 | v8::Local Nan::MakeCallback(v8::Local target, 23 | v8::Local symbol, 24 | int argc, 25 | v8::Local* argv); 26 | v8::Local Nan::MakeCallback(v8::Local target, 27 | const char* method, 28 | int argc, 29 | v8::Local* argv); 30 | ``` 31 | 32 | 33 | 34 | ### NAN_MODULE_INIT() 35 | 36 | Used to define the entry point function to a Node add-on. Creates a function with a given `name` that receives a `target` object representing the equivalent of the JavaScript `exports` object. 37 | 38 | See example below. 39 | 40 | 41 | ### Nan::Export() 42 | 43 | A simple helper to register a `v8::FunctionTemplate` from a JavaScript-accessible method (see [Methods](./methods.md)) as a property on an object. Can be used in a way similar to assigning properties to `module.exports` in JavaScript. 44 | 45 | Signature: 46 | 47 | ```c++ 48 | void Export(v8::Local target, const char *name, Nan::FunctionCallback f) 49 | ``` 50 | 51 | Also available as the shortcut `NAN_EXPORT` macro. 52 | 53 | Example: 54 | 55 | ```c++ 56 | NAN_METHOD(Foo) { 57 | ... 58 | } 59 | 60 | NAN_MODULE_INIT(Init) { 61 | NAN_EXPORT(target, Foo); 62 | } 63 | ``` 64 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/doc/scopes.md: -------------------------------------------------------------------------------- 1 | ## Scopes 2 | 3 | A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. 4 | 5 | A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. 6 | 7 | The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. 8 | 9 | - Nan::HandleScope 10 | - Nan::EscapableHandleScope 11 | 12 | Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). 13 | 14 | 15 | ### Nan::HandleScope 16 | 17 | A simple wrapper around [`v8::HandleScope`](https://v8docs.nodesource.com/io.js-3.0/d3/d95/classv8_1_1_handle_scope.html). 18 | 19 | Definition: 20 | 21 | ```c++ 22 | class Nan::HandleScope { 23 | public: 24 | Nan::HandleScope(); 25 | static int NumberOfHandles(); 26 | }; 27 | ``` 28 | 29 | Allocate a new `Nan::HandleScope` whenever you are creating new V8 JavaScript objects. Note that an implicit `HandleScope` is created for you on JavaScript-accessible methods so you do not need to insert one yourself. 30 | 31 | Example: 32 | 33 | ```c++ 34 | // new object is created, it needs a new scope: 35 | void Pointless() { 36 | Nan::HandleScope scope; 37 | v8::Local obj = Nan::New(); 38 | } 39 | 40 | // JavaScript-accessible method already has a HandleScope 41 | NAN_METHOD(Pointless2) { 42 | v8::Local obj = Nan::New(); 43 | } 44 | ``` 45 | 46 | 47 | ### Nan::EscapableHandleScope 48 | 49 | Similar to [`Nan::HandleScope`](#api_nan_handle_scope) but should be used in cases where a function needs to return a V8 JavaScript type that has been created within it. 50 | 51 | Definition: 52 | 53 | ```c++ 54 | class Nan::EscapableHandleScope { 55 | public: 56 | Nan::EscapableHandleScope(); 57 | static int NumberOfHandles(); 58 | template v8::Local Escape(v8::Local value); 59 | } 60 | ``` 61 | 62 | Use `Escape(value)` to return the object. 63 | 64 | Example: 65 | 66 | ```c++ 67 | v8::Local EmptyObj() { 68 | Nan::EscapableHandleScope scope; 69 | v8::Local obj = Nan::New(); 70 | return scope.Escape(obj); 71 | } 72 | ``` 73 | 74 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/doc/script.md: -------------------------------------------------------------------------------- 1 | ## Script 2 | 3 | NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. 4 | 5 | - Nan::CompileScript() 6 | - Nan::RunScript() 7 | 8 | 9 | 10 | ### Nan::CompileScript() 11 | 12 | A wrapper around [`v8::Script::Compile()`](https://v8docs.nodesource.com/io.js-3.0/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b). 13 | 14 | Note that `Nan::BoundScript` is an alias for `v8::Script`. 15 | 16 | Signature: 17 | 18 | ```c++ 19 | Nan::MaybeLocal Nan::CompileScript( 20 | v8::Local s, 21 | const v8::ScriptOrigin& origin); 22 | Nan::MaybeLocal Nan::CompileScript(v8::Local s); 23 | ``` 24 | 25 | 26 | 27 | ### Nan::RunScript() 28 | 29 | Calls `script->Run()` or `script->BindToCurrentContext()->Run(Nan::GetCurrentContext())`. 30 | 31 | Note that `Nan::BoundScript` is an alias for `v8::Script` and `Nan::UnboundScript` is an alias for `v8::UnboundScript` where available and `v8::Script` on older versions of V8. 32 | 33 | Signature: 34 | 35 | ```c++ 36 | Nan::MaybeLocal Nan::RunScript(v8::Local script) 37 | Nan::MaybeLocal Nan::RunScript(v8::Local script) 38 | ``` 39 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/doc/string_bytes.md: -------------------------------------------------------------------------------- 1 | ## Strings & Bytes 2 | 3 | Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. 4 | 5 | - Nan::Encoding 6 | - Nan::Encode() 7 | - Nan::DecodeBytes() 8 | - Nan::DecodeWrite() 9 | 10 | 11 | 12 | ### Nan::Encoding 13 | 14 | An enum representing the supported encoding types. A copy of `node::encoding` that is consistent across versions of Node. 15 | 16 | Definition: 17 | 18 | ```c++ 19 | enum Nan::Encoding { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER } 20 | ``` 21 | 22 | 23 | 24 | ### Nan::Encode() 25 | 26 | A wrapper around `node::Encode()` that provides a consistent implementation across supported versions of Node. 27 | 28 | Signature: 29 | 30 | ```c++ 31 | v8::Local Nan::Encode(const void *buf, 32 | size_t len, 33 | enum Nan::Encoding encoding = BINARY); 34 | ``` 35 | 36 | 37 | 38 | ### Nan::DecodeBytes() 39 | 40 | A wrapper around `node::DecodeBytes()` that provides a consistent implementation across supported versions of Node. 41 | 42 | Signature: 43 | 44 | ```c++ 45 | ssize_t Nan::DecodeBytes(v8::Local val, 46 | enum Nan::Encoding encoding = BINARY); 47 | ``` 48 | 49 | 50 | 51 | ### Nan::DecodeWrite() 52 | 53 | A wrapper around `node::DecodeWrite()` that provides a consistent implementation across supported versions of Node. 54 | 55 | Signature: 56 | 57 | ```c++ 58 | ssize_t Nan::DecodeWrite(char *buf, 59 | size_t len, 60 | v8::Local val, 61 | enum Nan::Encoding encoding = BINARY); 62 | ``` 63 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/doc/v8_misc.md: -------------------------------------------------------------------------------- 1 | ## Miscellaneous V8 Helpers 2 | 3 | - Nan::Utf8String 4 | - Nan::GetCurrentContext() 5 | - Nan::SetIsolateData() 6 | - Nan::GetIsolateData() 7 | - Nan::TypedArrayContents 8 | 9 | 10 | 11 | ### Nan::Utf8String 12 | 13 | Converts an object to a UTF-8-encoded character array. If conversion to a string fails (e.g. due to an exception in the toString() method of the object) then the length() method returns 0 and the * operator returns NULL. The underlying memory used for this object is managed by the object. 14 | 15 | An implementation of [`v8::String::Utf8Value`](https://v8docs.nodesource.com/io.js-3.0/d4/d1b/classv8_1_1_string_1_1_utf8_value.html) that is consistent across all supported versions of V8. 16 | 17 | Definition: 18 | 19 | ```c++ 20 | class Nan::Utf8String { 21 | public: 22 | Nan::Utf8String(v8::Local from); 23 | 24 | int length() const; 25 | 26 | char* operator*(); 27 | const char* operator*() const; 28 | }; 29 | ``` 30 | 31 | 32 | ### Nan::GetCurrentContext() 33 | 34 | A call to [`v8::Isolate::GetCurrent()->GetCurrentContext()`](https://v8docs.nodesource.com/io.js-3.0/d5/dda/classv8_1_1_isolate.html#a81c7a1ed7001ae2a65e89107f75fd053) that works across all supported versions of V8. 35 | 36 | Signature: 37 | 38 | ```c++ 39 | v8::Local Nan::GetCurrentContext() 40 | ``` 41 | 42 | 43 | ### Nan::SetIsolateData() 44 | 45 | A helper to provide a consistent API to [`v8::Isolate#SetData()`](https://v8docs.nodesource.com/io.js-3.0/d5/dda/classv8_1_1_isolate.html#a7acadfe7965997e9c386a05f098fbe36). 46 | 47 | Signature: 48 | 49 | ```c++ 50 | void Nan::SetIsolateData(v8::Isolate *isolate, T *data) 51 | ``` 52 | 53 | 54 | 55 | ### Nan::GetIsolateData() 56 | 57 | A helper to provide a consistent API to [`v8::Isolate#GetData()`](https://v8docs.nodesource.com/io.js-3.0/d5/dda/classv8_1_1_isolate.html#aabd223436bc1100a787dadaa024c6257). 58 | 59 | Signature: 60 | 61 | ```c++ 62 | T *Nan::GetIsolateData(v8::Isolate *isolate) 63 | ``` 64 | 65 | 66 | ### Nan::TypedArrayContents 67 | 68 | A helper class for accessing the contents of an ArrayBufferView (aka a typedarray) from C++. If the input array is not a valid typedarray, then the data pointer of TypedArrayContents will default to `NULL` and the length will be 0. If the data pointer is not compatible with the alignment requirements of type, an assertion error will fail. 69 | 70 | Note that you must store a reference to the `array` object while you are accessing its contents. 71 | 72 | Definition: 73 | 74 | ```c++ 75 | template 76 | class Nan::TypedArrayContents { 77 | public: 78 | TypedArrayContents(v8::Local array); 79 | 80 | size_t length() const; 81 | 82 | T* const operator*(); 83 | const T* const operator*() const; 84 | }; 85 | ``` 86 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/include_dirs.js: -------------------------------------------------------------------------------- 1 | console.log(require('path').relative('.', __dirname)); 2 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/nan_callbacks.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_CALLBACKS_H_ 10 | #define NAN_CALLBACKS_H_ 11 | 12 | template class FunctionCallbackInfo; 13 | template class PropertyCallbackInfo; 14 | template class Global; 15 | 16 | typedef void(*FunctionCallback)(const FunctionCallbackInfo&); 17 | typedef void(*GetterCallback) 18 | (v8::Local, const PropertyCallbackInfo&); 19 | typedef void(*SetterCallback)( 20 | v8::Local, 21 | v8::Local, 22 | const PropertyCallbackInfo&); 23 | typedef void(*PropertyGetterCallback)( 24 | v8::Local, 25 | const PropertyCallbackInfo&); 26 | typedef void(*PropertySetterCallback)( 27 | v8::Local, 28 | v8::Local, 29 | const PropertyCallbackInfo&); 30 | typedef void(*PropertyEnumeratorCallback) 31 | (const PropertyCallbackInfo&); 32 | typedef void(*PropertyDeleterCallback)( 33 | v8::Local, 34 | const PropertyCallbackInfo&); 35 | typedef void(*PropertyQueryCallback)( 36 | v8::Local, 37 | const PropertyCallbackInfo&); 38 | typedef void(*IndexGetterCallback)( 39 | uint32_t, 40 | const PropertyCallbackInfo&); 41 | typedef void(*IndexSetterCallback)( 42 | uint32_t, 43 | v8::Local, 44 | const PropertyCallbackInfo&); 45 | typedef void(*IndexEnumeratorCallback) 46 | (const PropertyCallbackInfo&); 47 | typedef void(*IndexDeleterCallback)( 48 | uint32_t, 49 | const PropertyCallbackInfo&); 50 | typedef void(*IndexQueryCallback)( 51 | uint32_t, 52 | const PropertyCallbackInfo&); 53 | 54 | namespace imp { 55 | typedef v8::Local Sig; 56 | 57 | static const int kDataIndex = 0; 58 | 59 | static const int kFunctionIndex = 1; 60 | static const int kFunctionFieldCount = 2; 61 | 62 | static const int kGetterIndex = 1; 63 | static const int kSetterIndex = 2; 64 | static const int kAccessorFieldCount = 3; 65 | 66 | static const int kPropertyGetterIndex = 1; 67 | static const int kPropertySetterIndex = 2; 68 | static const int kPropertyEnumeratorIndex = 3; 69 | static const int kPropertyDeleterIndex = 4; 70 | static const int kPropertyQueryIndex = 5; 71 | static const int kPropertyFieldCount = 6; 72 | 73 | static const int kIndexPropertyGetterIndex = 1; 74 | static const int kIndexPropertySetterIndex = 2; 75 | static const int kIndexPropertyEnumeratorIndex = 3; 76 | static const int kIndexPropertyDeleterIndex = 4; 77 | static const int kIndexPropertyQueryIndex = 5; 78 | static const int kIndexPropertyFieldCount = 6; 79 | 80 | } // end of namespace imp 81 | 82 | #if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION 83 | # include "nan_callbacks_12_inl.h" // NOLINT(build/include) 84 | #else 85 | # include "nan_callbacks_pre_12_inl.h" // NOLINT(build/include) 86 | #endif 87 | 88 | #endif // NAN_CALLBACKS_H_ 89 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/nan_converters.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_CONVERTERS_H_ 10 | #define NAN_CONVERTERS_H_ 11 | 12 | namespace imp { 13 | template struct ToFactoryBase { 14 | typedef MaybeLocal return_t; 15 | }; 16 | template struct ValueFactoryBase { typedef Maybe return_t; }; 17 | 18 | template struct ToFactory; 19 | 20 | #define X(TYPE) \ 21 | template<> \ 22 | struct ToFactory : ToFactoryBase { \ 23 | static inline return_t convert(v8::Local val); \ 24 | }; 25 | 26 | X(Boolean) 27 | X(Number) 28 | X(String) 29 | X(Object) 30 | X(Integer) 31 | X(Uint32) 32 | X(Int32) 33 | 34 | #undef X 35 | 36 | #define X(TYPE) \ 37 | template<> \ 38 | struct ToFactory : ValueFactoryBase { \ 39 | static inline return_t convert(v8::Local val); \ 40 | }; 41 | 42 | X(bool) 43 | X(double) 44 | X(int64_t) 45 | X(uint32_t) 46 | X(int32_t) 47 | 48 | #undef X 49 | } // end of namespace imp 50 | 51 | template 52 | inline 53 | typename imp::ToFactory::return_t To(v8::Local val) { 54 | return imp::ToFactory::convert(val); 55 | } 56 | 57 | #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ 58 | (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) 59 | # include "nan_converters_43_inl.h" 60 | #else 61 | # include "nan_converters_pre_43_inl.h" 62 | #endif 63 | 64 | #endif // NAN_CONVERTERS_H_ 65 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/nan_converters_43_inl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_CONVERTERS_43_INL_H_ 10 | #define NAN_CONVERTERS_43_INL_H_ 11 | 12 | #define X(TYPE) \ 13 | imp::ToFactory::return_t \ 14 | imp::ToFactory::convert(v8::Local val) { \ 15 | return val->To ## TYPE(GetCurrentContext()); \ 16 | } 17 | 18 | X(Boolean) 19 | X(Number) 20 | X(String) 21 | X(Object) 22 | X(Integer) 23 | X(Uint32) 24 | X(Int32) 25 | 26 | #undef X 27 | 28 | #define X(TYPE, NAME) \ 29 | imp::ToFactory::return_t \ 30 | imp::ToFactory::convert(v8::Local val) { \ 31 | return val->NAME ## Value(GetCurrentContext()); \ 32 | } 33 | 34 | X(bool, Boolean) 35 | X(double, Number) 36 | X(int64_t, Integer) 37 | X(uint32_t, Uint32) 38 | X(int32_t, Int32) 39 | 40 | #undef X 41 | 42 | #endif // NAN_CONVERTERS_43_INL_H_ 43 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/nan_converters_pre_43_inl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_CONVERTERS_PRE_43_INL_H_ 10 | #define NAN_CONVERTERS_PRE_43_INL_H_ 11 | 12 | #define X(TYPE) \ 13 | imp::ToFactory::return_t \ 14 | imp::ToFactory::convert(v8::Local val) { \ 15 | return MaybeLocal(val->To ## TYPE()); \ 16 | } 17 | 18 | X(Boolean) 19 | X(Number) 20 | X(String) 21 | X(Object) 22 | X(Integer) 23 | X(Uint32) 24 | X(Int32) 25 | 26 | #undef X 27 | 28 | #define X(TYPE, NAME) \ 29 | imp::ToFactory::return_t \ 30 | imp::ToFactory::convert(v8::Local val) { \ 31 | return Just(val->NAME ##Value()); \ 32 | } 33 | 34 | X(bool, Boolean) 35 | X(double, Number) 36 | X(int64_t, Integer) 37 | X(uint32_t, Uint32) 38 | X(int32_t, Int32) 39 | 40 | #undef X 41 | 42 | #endif // NAN_CONVERTERS_PRE_43_INL_H_ 43 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/nan_typedarray_contents.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_TYPEDARRAY_CONTENTS_H_ 10 | #define NAN_TYPEDARRAY_CONTENTS_H_ 11 | 12 | template 13 | class TypedArrayContents { 14 | public: 15 | inline explicit TypedArrayContents(v8::Local from) : 16 | length_(0), data_(NULL) { 17 | 18 | size_t length = 0; 19 | void* data = NULL; 20 | 21 | #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ 22 | (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) 23 | 24 | if (from->IsArrayBufferView()) { 25 | v8::Local array = 26 | v8::Local::Cast(from); 27 | 28 | const size_t byte_length = array->ByteLength(); 29 | const ptrdiff_t byte_offset = array->ByteOffset(); 30 | v8::Local buffer = array->Buffer(); 31 | 32 | length = byte_length / sizeof(T); 33 | data = static_cast(buffer->GetContents().Data()) + byte_offset; 34 | } 35 | 36 | #else 37 | 38 | if (from->IsObject() && !from->IsNull()) { 39 | v8::Local array = v8::Local::Cast(from); 40 | 41 | MaybeLocal buffer = Get(array, 42 | New("buffer").ToLocalChecked()); 43 | MaybeLocal byte_length = Get(array, 44 | New("byteLength").ToLocalChecked()); 45 | MaybeLocal byte_offset = Get(array, 46 | New("byteOffset").ToLocalChecked()); 47 | 48 | if (!buffer.IsEmpty() && 49 | !byte_length.IsEmpty() && byte_length.ToLocalChecked()->IsUint32() && 50 | !byte_offset.IsEmpty() && byte_offset.ToLocalChecked()->IsUint32()) { 51 | data = array->GetIndexedPropertiesExternalArrayData(); 52 | if(data) { 53 | length = byte_length.ToLocalChecked()->Uint32Value() / sizeof(T); 54 | } 55 | } 56 | } 57 | 58 | #endif 59 | 60 | #if defined(_MSC_VER) && _MSC_VER >= 1900 || __cplusplus >= 201103L 61 | assert(reinterpret_cast(data) % alignof (T) == 0); 62 | #elif defined(_MSC_VER) && _MSC_VER >= 1600 || defined(__GNUC__) 63 | assert(reinterpret_cast(data) % __alignof(T) == 0); 64 | #else 65 | assert(reinterpret_cast(data) % sizeof (T) == 0); 66 | #endif 67 | 68 | length_ = length; 69 | data_ = static_cast(data); 70 | } 71 | 72 | inline size_t length() const { return length_; } 73 | inline T* operator*() { return data_; } 74 | inline const T* operator*() const { return data_; } 75 | 76 | private: 77 | NAN_DISALLOW_ASSIGN_COPY_MOVE(TypedArrayContents) 78 | 79 | //Disable heap allocation 80 | void *operator new(size_t size); 81 | void operator delete(void *, size_t); 82 | 83 | size_t length_; 84 | T* data_; 85 | }; 86 | 87 | #endif // NAN_TYPEDARRAY_CONTENTS_H_ 88 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nan", 3 | "version": "2.3.5", 4 | "description": "Native Abstractions for Node.js: C++ header for Node 0.8 -> 6 compatibility", 5 | "main": "include_dirs.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/nodejs/nan.git" 9 | }, 10 | "scripts": { 11 | "test": "tap --gc --stderr test/js/*-test.js", 12 | "rebuild-tests": "node-gyp rebuild --msvs_version=2013 --directory test", 13 | "docs": "doc/.build.sh" 14 | }, 15 | "contributors": [ 16 | { 17 | "name": "Rod Vagg", 18 | "email": "r@va.gg", 19 | "url": "https://github.com/rvagg" 20 | }, 21 | { 22 | "name": "Benjamin Byholm", 23 | "email": "bbyholm@abo.fi", 24 | "url": "https://github.com/kkoopa/" 25 | }, 26 | { 27 | "name": "Trevor Norris", 28 | "email": "trev.norris@gmail.com", 29 | "url": "https://github.com/trevnorris" 30 | }, 31 | { 32 | "name": "Nathan Rajlich", 33 | "email": "nathan@tootallnate.net", 34 | "url": "https://github.com/TooTallNate" 35 | }, 36 | { 37 | "name": "Brett Lawson", 38 | "email": "brett19@gmail.com", 39 | "url": "https://github.com/brett19" 40 | }, 41 | { 42 | "name": "Ben Noordhuis", 43 | "email": "info@bnoordhuis.nl", 44 | "url": "https://github.com/bnoordhuis" 45 | }, 46 | { 47 | "name": "David Siegel", 48 | "email": "david@artcom.de", 49 | "url": "https://github.com/agnat" 50 | } 51 | ], 52 | "devDependencies": { 53 | "bindings": "~1.2.1", 54 | "commander": "^2.8.1", 55 | "glob": "^5.0.14", 56 | "node-gyp": "~3.0.1", 57 | "tap": "~0.7.1", 58 | "xtend": "~4.0.0" 59 | }, 60 | "license": "MIT", 61 | "bugs": { 62 | "url": "https://github.com/nodejs/nan/issues" 63 | }, 64 | "homepage": "https://github.com/nodejs/nan#readme", 65 | "_id": "nan@2.3.5", 66 | "_shasum": "822a0dc266290ce4cd3a12282ca3e7e364668a08", 67 | "_resolved": "https://registry.npmjs.org/nan/-/nan-2.3.5.tgz", 68 | "_from": "nan@2.3.5", 69 | "_npmVersion": "3.3.6", 70 | "_nodeVersion": "5.0.0", 71 | "_npmUser": { 72 | "name": "kkoopa", 73 | "email": "bbyholm@abo.fi" 74 | }, 75 | "dist": { 76 | "shasum": "822a0dc266290ce4cd3a12282ca3e7e364668a08", 77 | "tarball": "https://registry.npmjs.org/nan/-/nan-2.3.5.tgz" 78 | }, 79 | "maintainers": [ 80 | { 81 | "name": "rvagg", 82 | "email": "rod@vagg.org" 83 | }, 84 | { 85 | "name": "kkoopa", 86 | "email": "bbyholm@abo.fi" 87 | } 88 | ], 89 | "_npmOperationalInternal": { 90 | "host": "packages-12-west.internal.npmjs.com", 91 | "tmp": "tmp/nan-2.3.5.tgz_1464707164994_0.4295874561648816" 92 | }, 93 | "directories": {} 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/tools/README.md: -------------------------------------------------------------------------------- 1 | 1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions, 2 | false positives and missed opportunities. The input files are rewritten in place. Make sure that 3 | you have backups. You will have to manually review the changes afterwards and do some touchups. 4 | 5 | ```sh 6 | $ tools/1to2.js 7 | 8 | Usage: 1to2 [options] 9 | 10 | Options: 11 | 12 | -h, --help output usage information 13 | -V, --version output the version number 14 | ``` 15 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/node_modules/nan/tools/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "1to2", 3 | "version": "1.0.0", 4 | "description": "NAN 1 -> 2 Migration Script", 5 | "main": "1to2.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/nodejs/nan.git" 9 | }, 10 | "contributors": [ 11 | "Benjamin Byholm (https://github.com/kkoopa/)", 12 | "Mathias Küsel (https://github.com/mathiask88/)" 13 | ], 14 | "dependencies": { 15 | "glob": "~5.0.10", 16 | "commander": "~2.8.1" 17 | }, 18 | "license": "MIT" 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pty.js", 3 | "description": "Pseudo terminals for node.", 4 | "author": { 5 | "name": "Christopher Jeffrey" 6 | }, 7 | "version": "0.3.1", 8 | "license": "MIT", 9 | "main": "./index.js", 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/chjj/pty.js.git" 13 | }, 14 | "homepage": "https://github.com/chjj/pty.js", 15 | "bugs": { 16 | "url": "https://github.com/chjj/pty.js/issues" 17 | }, 18 | "keywords": [ 19 | "pty", 20 | "tty", 21 | "terminal" 22 | ], 23 | "scripts": { 24 | "test": "NODE_ENV=test mocha -R spec", 25 | "install": "node-gyp rebuild" 26 | }, 27 | "tags": [ 28 | "pty", 29 | "tty", 30 | "terminal" 31 | ], 32 | "dependencies": { 33 | "extend": "~1.2.1", 34 | "nan": "2.3.5" 35 | }, 36 | "devDependencies": { 37 | "mocha": "~1.17.1" 38 | }, 39 | "gypfile": true, 40 | "gitHead": "fe63a412574f45ee6bb6d8fab4a5c102107b5201", 41 | "_id": "pty.js@0.3.1", 42 | "_shasum": "81f5bed332d6e5e7ab685688d1ba0373410d51b5", 43 | "_from": "pty.js@>=0.3.0", 44 | "_npmVersion": "3.8.8", 45 | "_nodeVersion": "6.0.0", 46 | "_npmUser": { 47 | "name": "chjj", 48 | "email": "chjjeffrey@gmail.com" 49 | }, 50 | "maintainers": [ 51 | { 52 | "name": "chjj", 53 | "email": "chjjeffrey@gmail.com" 54 | }, 55 | { 56 | "name": "TooTallNate", 57 | "email": "nathan@tootallnate.net" 58 | }, 59 | { 60 | "name": "tootallnate", 61 | "email": "nathan@tootallnate.net" 62 | } 63 | ], 64 | "dist": { 65 | "shasum": "81f5bed332d6e5e7ab685688d1ba0373410d51b5", 66 | "tarball": "https://registry.npmjs.org/pty.js/-/pty.js-0.3.1.tgz" 67 | }, 68 | "_npmOperationalInternal": { 69 | "host": "packages-12-west.internal.npmjs.com", 70 | "tmp": "tmp/pty.js-0.3.1.tgz_1467869205922_0.06822228198871017" 71 | }, 72 | "directories": {}, 73 | "_resolved": "https://registry.npmjs.org/pty.js/-/pty.js-0.3.1.tgz" 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/pty.js/wscript: -------------------------------------------------------------------------------- 1 | srcdir = "." 2 | blddir = "build" 3 | VERSION = "0.0.1" 4 | 5 | def set_options(opt): 6 | opt.tool_options("compiler_cxx") 7 | 8 | def configure(conf): 9 | conf.check_tool("compiler_cxx") 10 | conf.check_tool("node_addon") 11 | 12 | def build(bld): 13 | obj = bld.new_task_gen("cxx", "shlib", "node_addon") 14 | obj.cxxflags = ["-Wall"] 15 | obj.linkflags = ["-lutil"] 16 | obj.target = "pty" 17 | obj.source = "src/unix/pty.cc" 18 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/term.js/.npmignore: -------------------------------------------------------------------------------- 1 | .git* 2 | build/ 3 | .lock-wscript 4 | out/ 5 | Makefile.gyp 6 | *.Makefile 7 | *.target.gyp.mk 8 | node_modules/ 9 | img/ 10 | test/ 11 | *.node 12 | example/*.log 13 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/term.js/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2013, Christopher Jeffrey (https://github.com/chjj/) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/term.js/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @cp src/term.js term.js 3 | @uglifyjs -o term.min.js term.js 4 | 5 | clean: 6 | @rm term.js 7 | @rm term.min.js 8 | 9 | bench: 10 | @node test/bench 11 | 12 | .PHONY: clean all 13 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/term.js/README.md: -------------------------------------------------------------------------------- 1 | # term.js 2 | 3 | A full xterm clone written in javascript. Used by 4 | [**tty.js**](https://github.com/chjj/tty.js). 5 | 6 | ## Example 7 | 8 | Server: 9 | 10 | ``` js 11 | var term = require('term.js'); 12 | app.use(term.middleware()); 13 | ... 14 | ``` 15 | 16 | Client: 17 | 18 | ``` js 19 | window.addEventListener('load', function() { 20 | var socket = io.connect(); 21 | socket.on('connect', function() { 22 | var term = new Terminal({ 23 | cols: 80, 24 | rows: 24, 25 | screenKeys: true 26 | }); 27 | 28 | term.on('data', function(data) { 29 | socket.emit('data', data); 30 | }); 31 | 32 | term.on('title', function(title) { 33 | document.title = title; 34 | }); 35 | 36 | term.open(document.body); 37 | 38 | term.write('\x1b[31mWelcome to term.js!\x1b[m\r\n'); 39 | 40 | socket.on('data', function(data) { 41 | term.write(data); 42 | }); 43 | 44 | socket.on('disconnect', function() { 45 | term.destroy(); 46 | }); 47 | }); 48 | }, false); 49 | ``` 50 | 51 | ## Tmux-like 52 | 53 | While term.js has always supported copy/paste using the mouse, it now also 54 | supports several keyboard based solutions for copy/paste. 55 | 56 | term.js includes a tmux-like selection mode (enabled with the `screenKeys` 57 | option) which makes copy and paste very simple. `Ctrl-A` enters `prefix` mode, 58 | from here you can type `Ctrl-V` to paste. Press `[` in prefix mode to enter 59 | selection mode. To select text press `v` (or `space`) to enter visual mode, use 60 | `hjkl` to navigate and create a selection, and press `Ctrl-C` to copy. 61 | 62 | `Ctrl-C` (in visual mode) and `Ctrl-V` (in prefix mode) should work in any OS 63 | for copy and paste. `y` (in visual mode) will work for copying only on X11 64 | systems. It will copy to the primary selection. 65 | 66 | Note: `Ctrl-C` will also work in prefix mode for the regular OS/browser 67 | selection. If you want to select text with your mouse and copy it to the 68 | clipboard, simply select the text and type `Ctrl-A + Ctrl-C`, and 69 | `Ctrl-A + Ctrl-V` to paste it. 70 | 71 | For mac users: consider `Ctrl` to be `Command/Apple` above. 72 | 73 | ## Contribution and License Agreement 74 | 75 | If you contribute code to this project, you are implicitly allowing your code 76 | to be distributed under the MIT license. You are also implicitly verifying that 77 | all code is your original work. `` 78 | 79 | ## License 80 | 81 | Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) 82 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/term.js/example/index.html: -------------------------------------------------------------------------------- 1 | 2 | term.js 3 | 7 | 33 |

term.js

34 | 35 | 36 | 72 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/term.js/example/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * term.js 5 | * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) 6 | */ 7 | 8 | var http = require('http') 9 | , express = require('express') 10 | , io = require('socket.io') 11 | , pty = require('pty.js') 12 | , terminal = require('../'); 13 | 14 | /** 15 | * term.js 16 | */ 17 | 18 | process.title = 'term.js'; 19 | 20 | /** 21 | * Dump 22 | */ 23 | 24 | var stream; 25 | if (process.argv[2] === '--dump') { 26 | stream = require('fs').createWriteStream(__dirname + '/dump.log'); 27 | } 28 | 29 | /** 30 | * Open Terminal 31 | */ 32 | 33 | var buff = [] 34 | , socket 35 | , term; 36 | 37 | term = pty.fork(process.env.SHELL || 'sh', [], { 38 | name: require('fs').existsSync('/usr/share/terminfo/x/xterm-256color') 39 | ? 'xterm-256color' 40 | : 'xterm', 41 | cols: 80, 42 | rows: 24, 43 | cwd: process.env.HOME 44 | }); 45 | 46 | term.on('data', function(data) { 47 | if (stream) stream.write('OUT: ' + data + '\n-\n'); 48 | return !socket 49 | ? buff.push(data) 50 | : socket.emit('data', data); 51 | }); 52 | 53 | console.log('' 54 | + 'Created shell with pty master/slave' 55 | + ' pair (master: %d, pid: %d)', 56 | term.fd, term.pid); 57 | 58 | /** 59 | * App & Server 60 | */ 61 | 62 | var app = express() 63 | , server = http.createServer(app); 64 | 65 | app.use(function(req, res, next) { 66 | var setHeader = res.setHeader; 67 | res.setHeader = function(name) { 68 | switch (name) { 69 | case 'Cache-Control': 70 | case 'Last-Modified': 71 | case 'ETag': 72 | return; 73 | } 74 | return setHeader.apply(res, arguments); 75 | }; 76 | next(); 77 | }); 78 | 79 | app.use(express.basicAuth(function(user, pass, next) { 80 | if (user !== 'foo' || pass !== 'bar') { 81 | return next(true); 82 | } 83 | return next(null, user); 84 | })); 85 | 86 | app.use(express.static(__dirname)); 87 | app.use(terminal.middleware()); 88 | 89 | if (!~process.argv.indexOf('-n')) { 90 | server.on('connection', function(socket) { 91 | var address = socket.remoteAddress; 92 | if (address !== '127.0.0.1' && address !== '::1') { 93 | try { 94 | socket.destroy(); 95 | } catch (e) { 96 | ; 97 | } 98 | console.log('Attempted connection from %s. Refused.', address); 99 | } 100 | }); 101 | } 102 | 103 | server.listen(8080); 104 | 105 | /** 106 | * Sockets 107 | */ 108 | 109 | io = io.listen(server, { 110 | log: false 111 | }); 112 | 113 | io.sockets.on('connection', function(sock) { 114 | socket = sock; 115 | 116 | socket.on('data', function(data) { 117 | if (stream) stream.write('IN: ' + data + '\n-\n'); 118 | //console.log(JSON.stringify(data)); 119 | term.write(data); 120 | }); 121 | 122 | socket.on('disconnect', function() { 123 | socket = null; 124 | }); 125 | 126 | while (buff.length) { 127 | socket.emit('data', buff.shift()); 128 | } 129 | }); 130 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/term.js/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/index.js'); 2 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/term.js/lib/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * term.js - an xterm emulator 3 | * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) 4 | * https://github.com/chjj/term.js 5 | */ 6 | 7 | function term(options) { 8 | return new term.Terminal(options); 9 | } 10 | 11 | term.middleware = function(options) { 12 | var url = require('url'); 13 | 14 | options = options || {}; 15 | options.path = options.path || '/term.js'; 16 | 17 | return function(req, res, next) { 18 | if (url.parse(req.url).pathname !== options.path) { 19 | return next(); 20 | } 21 | 22 | if (+new Date(req.headers['if-modified-since']) === term.last) { 23 | res.statusCode = 304; 24 | res.end(); 25 | return; 26 | } 27 | 28 | res.writeHead(200, { 29 | 'Content-Type': 'application/javascript; charset=utf-8', 30 | 'Content-Length': Buffer.byteLength(term.script), 31 | 'Last-Modified': term.last 32 | }); 33 | 34 | res.end(term.script); 35 | }; 36 | }; 37 | 38 | term.path = __dirname + '/../src/term.js'; 39 | 40 | term.__defineGetter__('script', function() { 41 | if (term._script) return term._script; 42 | term.last = +new Date; 43 | return term._script = require('fs').readFileSync(term.path, 'utf8'); 44 | }); 45 | 46 | term.__defineGetter__('Terminal', function() { 47 | if (term._Terminal) return term._Terminal; 48 | return term._Terminal = require('../src/term'); 49 | }); 50 | 51 | /** 52 | * Expose 53 | */ 54 | 55 | module.exports = term; 56 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/node_modules/term.js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "term.js", 3 | "description": "A terminal written in javascript", 4 | "author": { 5 | "name": "Christopher Jeffrey" 6 | }, 7 | "version": "0.0.7", 8 | "license": "MIT", 9 | "main": "./index.js", 10 | "preferGlobal": false, 11 | "repository": { 12 | "type": "git", 13 | "url": "git://github.com/chjj/term.js.git" 14 | }, 15 | "homepage": "https://github.com/chjj/term.js", 16 | "bugs": { 17 | "url": "https://github.com/chjj/term.js/issues" 18 | }, 19 | "keywords": [ 20 | "tty", 21 | "terminal", 22 | "term", 23 | "xterm" 24 | ], 25 | "tags": [ 26 | "tty", 27 | "terminal", 28 | "term", 29 | "xterm" 30 | ], 31 | "engines": { 32 | "node": ">= 0.8.0" 33 | }, 34 | "devDependencies": { 35 | "express": "3.1.0", 36 | "socket.io": "0.9.13", 37 | "pty.js": ">= 0.2.13" 38 | }, 39 | "gitHead": "6fa19452ce526bf0df0fb766891ccb6e0d61f4f6", 40 | "_id": "term.js@0.0.7", 41 | "scripts": {}, 42 | "_shasum": "526f24cfc0f2ef6f80f517c9e27dae947bc87315", 43 | "_from": "term.js@>=0.0.7", 44 | "_npmVersion": "2.14.0", 45 | "_nodeVersion": "0.12.7", 46 | "_npmUser": { 47 | "name": "chjj", 48 | "email": "chjjeffrey@gmail.com" 49 | }, 50 | "maintainers": [ 51 | { 52 | "name": "chjj", 53 | "email": "chjjeffrey@gmail.com" 54 | } 55 | ], 56 | "dist": { 57 | "shasum": "526f24cfc0f2ef6f80f517c9e27dae947bc87315", 58 | "tarball": "https://registry.npmjs.org/term.js/-/term.js-0.0.7.tgz" 59 | }, 60 | "directories": {}, 61 | "_resolved": "https://registry.npmjs.org/term.js/-/term.js-0.0.7.tgz" 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/node_modules/ttystudio/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ttystudio", 3 | "description": "A terminal-to-gif recorder minus the headaches.", 4 | "author": { 5 | "name": "Christopher Jeffrey" 6 | }, 7 | "version": "0.0.16", 8 | "license": "MIT", 9 | "main": "./index.js", 10 | "bin": { 11 | "ttystudio": "./bin/ttystudio" 12 | }, 13 | "scripts": { 14 | "start": "./bin/ttystudio ~/ttystudio-test.gif" 15 | }, 16 | "man": [ 17 | "./man/ttystudio.1" 18 | ], 19 | "preferGlobal": true, 20 | "repository": { 21 | "type": "git", 22 | "url": "git://github.com/chjj/ttystudio.git" 23 | }, 24 | "homepage": "https://github.com/chjj/ttystudio", 25 | "bugs": { 26 | "url": "http://github.com/chjj/ttystudio/issues" 27 | }, 28 | "keywords": [ 29 | "terminal", 30 | "tty", 31 | "record", 32 | "recorder", 33 | "gif", 34 | "png", 35 | "apng" 36 | ], 37 | "tags": [ 38 | "terminal", 39 | "tty", 40 | "record", 41 | "recorder", 42 | "gif", 43 | "png", 44 | "apng" 45 | ], 46 | "dependencies": { 47 | "blessed": ">=0.1.80", 48 | "term.js": ">=0.0.7", 49 | "pty.js": ">=0.3.0" 50 | }, 51 | "gitHead": "b270fecc03552d29c7fbf7548d2633f2216272f8", 52 | "_id": "ttystudio@0.0.16", 53 | "_shasum": "a2d11179c3fee95f2d6fc3d2c537577f4f1255e4", 54 | "_from": "ttystudio@*", 55 | "_npmVersion": "2.14.0", 56 | "_nodeVersion": "0.12.7", 57 | "_npmUser": { 58 | "name": "chjj", 59 | "email": "chjjeffrey@gmail.com" 60 | }, 61 | "maintainers": [ 62 | { 63 | "name": "chjj", 64 | "email": "chjjeffrey@gmail.com" 65 | } 66 | ], 67 | "dist": { 68 | "shasum": "a2d11179c3fee95f2d6fc3d2c537577f4f1255e4", 69 | "tarball": "https://registry.npmjs.org/ttystudio/-/ttystudio-0.0.16.tgz" 70 | }, 71 | "directories": {}, 72 | "_resolved": "https://registry.npmjs.org/ttystudio/-/ttystudio-0.0.16.tgz" 73 | } 74 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/unmarshal.go: -------------------------------------------------------------------------------- 1 | package gjson 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "reflect" 7 | ) 8 | 9 | func analyzeValue(v interface{}) error { 10 | rv := reflect.ValueOf(v) 11 | if rv.Kind() != reflect.Ptr || rv.IsNil() { 12 | return &json.InvalidUnmarshalError{reflect.TypeOf(v)} 13 | } 14 | fmt.Printf("%+v\n", rv) 15 | return nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/unmarshal_test.go: -------------------------------------------------------------------------------- 1 | package gjson 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "testing" 7 | ) 8 | 9 | type Person struct { 10 | ID string `json:"id"` 11 | Name struct { 12 | First string `json:"first"` 13 | Last string `json:"last"` 14 | } `json:"name"` 15 | Age int `json:"age"` 16 | Friends []string `json:"friends"` 17 | } 18 | 19 | const jsonStr = ` 20 | { 21 | "id": "b39d3eaf813a", 22 | "name": { 23 | "first": "Randi", 24 | "last": "Andrews" 25 | }, 26 | "age": 29, 27 | "friends": [ 28 | "Bill", "Sharell", "Karen", "Tom" 29 | ] 30 | } 31 | ` 32 | 33 | func TestUnmarshal(t *testing.T) { 34 | var person Person 35 | res := GetMany(jsonStr, "id", "name.first", "name.last", "age", "friends") 36 | person.ID = res[0].String() 37 | person.Name.First = res[1].String() 38 | person.Name.Last = res[2].String() 39 | person.Age = int(res[3].Int()) 40 | res[4].ForEach(func(key, val Result) bool { 41 | person.Friends = append(person.Friends, val.String()) 42 | return true 43 | }) 44 | fmt.Printf("%v\n", person) 45 | } 46 | 47 | func BenchmarkPersonUnmarshalGJSON(t *testing.B) { 48 | var person Person 49 | person.Friends = make([]string, 8) 50 | t.ReportAllocs() 51 | t.ResetTimer() 52 | for i := 0; i < t.N; i++ { 53 | res := GetMany(jsonStr, "id", "name.first", "name.last", "age", "friends") 54 | person.ID = res[0].String() 55 | person.Name.First = res[1].String() 56 | person.Name.Last = res[2].String() 57 | person.Age = int(res[3].Int()) 58 | person.Friends = person.Friends[:0] 59 | res[4].ForEach(func(key, val Result) bool { 60 | person.Friends = append(person.Friends, val.String()) 61 | return true 62 | }) 63 | } 64 | } 65 | 66 | func BenchmarkPersonUnmarshalGoJSON(t *testing.B) { 67 | jsonBytes := []byte(jsonStr) 68 | var person Person 69 | person.Friends = make([]string, 8) 70 | t.ReportAllocs() 71 | t.ResetTimer() 72 | for i := 0; i < t.N; i++ { 73 | json.Unmarshal(jsonBytes, &person) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/match/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/match/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Josh Baker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/match/README.md: -------------------------------------------------------------------------------- 1 | Match 2 | ===== 3 | Build Status 4 | GoDoc 5 | 6 | Match is a very simple pattern matcher where '*' matches on any 7 | number characters and '?' matches on any one character. 8 | Installing 9 | ---------- 10 | 11 | ``` 12 | go get -u github.com/tidwall/match 13 | ``` 14 | 15 | Example 16 | ------- 17 | 18 | ```go 19 | match.Match("hello", "*llo") 20 | match.Match("jello", "?ello") 21 | match.Match("hello", "h*o") 22 | ``` 23 | 24 | 25 | Contact 26 | ------- 27 | Josh Baker [@tidwall](http://twitter.com/tidwall) 28 | 29 | License 30 | ------- 31 | Redcon source code is available under the MIT [License](/LICENSE). 32 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/sjson/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/sjson/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Josh Baker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/sjson/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tidwall/jd/42fe71a941b1caca2811a7c7ca52b498a13bbee0/vendor/github.com/tidwall/sjson/logo.png --------------------------------------------------------------------------------