tty_string 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1b227f64f424b3dc76c088e9caa52639a5070e0543d022ffd920b01d830f78e
4
- data.tar.gz: 6ddcd309f2b26d2a43251fcd0d7d673c72b5576e7e13c8d86df420a84b8d8c52
3
+ metadata.gz: 9abd5adac382e5520dc2699ff14dd2e213a9fed0d7aa3807e0b054a610ca9c46
4
+ data.tar.gz: 254d7adb36f29313bc441c237dc760399f9e3e9f4a4447c348a1387282d43b33
5
5
  SHA512:
6
- metadata.gz: c1db0493d2d8c027517b531d6997ddc52c47d0f9de6f375efab05f781d30db0e2c63d98f5933d62f471cb882f3248d4798aa1a5b6018158453e13d6be7045ab8
7
- data.tar.gz: 97bef4800b9e802e5aa5d12afc86483bf570dc3913b9cf7b7b6530f2c6d58adba935a772d6f1b16626c6ffe0096a59dcea715ab017a252dd36bcf93092dd3913
6
+ metadata.gz: b2883d488aa1ba89ddc5535ccf6c50d9b5722d3d9e906f5b856bca53a237f6901069f85e9d51a20d2c2fc9d10d9cab2ef14a37fa23665ddf7310c66fcdfde53e
7
+ data.tar.gz: c048606897448877ba108a78555697f7cbaad9578abd381313be692bb8dc16dd0bd1594c9b33e0fc32646b1529187ef873b60882d8e00d54765337d1507aa7d3
@@ -1,3 +1,6 @@
1
+ # v1.0.1
2
+ - test push to rubygems, no functional changes
3
+
1
4
  # v1.0.0
2
5
  - added TTYString.parse as a shortcut for .new#to_s
3
6
  - added TTYString.to_proc for lols
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # TTYString
2
2
 
3
- [![Build Status](https://travis-ci.org/robotdana/tty_string.svg?branch=master)](https://travis-ci.org/robotdana/tty_string)
3
+ [![Build Status](https://travis-ci.com/robotdana/tty_string.svg?branch=master)](https://travis-ci.com/robotdana/tty_string)
4
+ [![Gem Version](https://badge.fury.io/rb/tty_string.svg)](https://rubygems.org/gems/tty_string)
4
5
 
5
6
  Render to a string like your terminal does by (narrowly) parsing ANSI TTY codes.
7
+ Intended for use in tests of command line interfaces.
6
8
 
7
9
  ## Features
8
10
 
@@ -11,25 +13,26 @@ Render to a string like your terminal does by (narrowly) parsing ANSI TTY codes.
11
13
 
12
14
  ## Supported codes
13
15
 
14
- - `\a` # BEL, just removed.
15
- - `\b` # backspace
16
- - `\n` # newline
17
- - `\r` # return, jump to the start of the line
18
- - `\t` # tab, move to the next multiple-of-8 column
19
- - `\e[nA` # move up n lines, default: 1
20
- - `\e[nB` # move down n lines, default: 1
21
- - `\e[nC` # move right n columns, default: 1
22
- - `\e[nD` # move left n columns, default: 1
23
- - `\e[nE` # move down n lines, and to the start of the line, default: 1
24
- - `\e[nF` # move up n lines, and to the start of the line, default: 1
25
- - `\e[nG` # jump to column to n
26
- - `\e[n;mH` # jump to row n, column m, default: 1,1
27
- - `\e[nJ` # n=0: clear the screen forward, n=1: clear backward, n=2 or 3: clear the screen. default 0
28
- - `\e[nK` # n=0: clear the line forward, n=1: clear the line backward, n=2: clear the line. default 0
29
- - `\e[n;mf` # jump to row n, column m, default: 1,1
30
- - `\e[m` # styling codes, optionally suppressed with `clear_style: false`
31
- - `\e[nS` # scroll down n rows, default 1
32
- - `\e[nT` # scroll up n rows, default 1
16
+ | Code | Description | Default |
17
+ |------|-------------|---------|
18
+ | `\a` | bell: suppressed | |
19
+ | `\b` | backspace: clear the character to the left of the cursor and move the cursor back one column | |
20
+ | `\n` | newline: move the cursor to the start of the next line | |
21
+ | `\r` | return: move the cursor to the start of the current line | |
22
+ | `\t` | tab: move the cursor to the next multiple-of-8 column | |
23
+ | `\e[nA` | move the cursor up _n_ lines | _n_=`1` |
24
+ | `\e[nB` | move the cursor down _n_ lines | _n_=`1` |
25
+ | `\e[nC` | move the cursor right _n_ columns | _n_=`1` |
26
+ | `\e[nD` | move the cursor left _n_ columns | _n_=`1` |
27
+ | `\e[nE` | move the cursor down _n_ lines, and to the start of the line | _n_=`1` |
28
+ | `\e[nF` | move the cursor up _n_ lines, and to the start of the line | _n_=`1` |
29
+ | `\e[nG` | move the cursor to column _n_. `1` is left-most column | _n_=`1` |
30
+ | `\e[n;mH` <br> `\e[n;mf` | move the cursor to row _n_, column _m_. `1;1` is top left corner | _n_=`1` _m_=`1` |
31
+ | `\e[nJ` | _n_=`0`: clear the screen from the cursor forward <br>_n_=`1`: clear the screen from the cursor backward <br>_n_=`2` or _n_=`3`: clear the screen | _n_=`0` |
32
+ | `\e[nK` | _n_=`0`: clear the line from the cursor forward <br>_n_=`1`: clear the line from the cursor backward <br>_n_=`2`: clear the line | _n_=`0` |
33
+ | `\e[nS` | scroll up _n_ rows | _n_=`1` |
34
+ | `\e[nT` | scroll down _n_ rows | _n_=`1` |
35
+ | `\e[m` | styling codes: optionally suppressed with `clear_style: false` | |
33
36
 
34
37
  ## Installation
35
38
 
@@ -67,17 +70,17 @@ TTYString.parse("th\ta \e[31mstring\e[0m\e[3Gis is", clear_style: false)
67
70
 
68
71
  Just for fun TTYString.to_proc provides the `parse` method as a lambda, so:
69
72
  ```ruby
70
- "th\ta string\e[3Gis is".yield_self(&TTYString)
71
- => "this is a string"
73
+ ["th\ta string\e[3Gis is"].each(&TTYString)
74
+ => ["this is a string"]
72
75
  ```
73
76
 
74
77
  ## Limitations
75
78
 
76
- Various terminals are wildly variously permissive with what they accept,
77
- so this doesn't even try to cover all possible cases,
78
- instead it covers the narrowest possible case, and leaves the codes in place when unrecognized
79
+ - Various terminals are wildly variously permissive with what they accept,
80
+ so this doesn't even try to cover all possible cases,
81
+ instead it covers the narrowest possible case, and leaves the codes in place when unrecognized
79
82
 
80
- `clear_style: false` treats the style codes as regular text which may work differently when rendering codes that move the cursor.
83
+ - `clear_style: false` treats the style codes as regular text which may work differently when rendering codes that move the cursor.
81
84
 
82
85
  ## Development
83
86
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TTYString
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tty_string
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dana Sherson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-26 00:00:00.000000000 Z
11
+ date: 2020-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler