pipetext 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/pipetext +5 -0
  3. data/lib/pipetext.rb +29 -3
  4. metadata +8 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4df095ff8f81423a2a3e6f0735a581b277f9c994bb1f984607de2be6ce7611c2
4
- data.tar.gz: a865ea8325c576699e9a3daa17cce1ffdec22648e8651eee4fc06d3caf164673
3
+ metadata.gz: 6fc9491b4fce47f35c9169cada5aa9f17c64c230f1e8d82946ac1fa7f8f448a7
4
+ data.tar.gz: b064d18f993760700a51d4dfb1edc47439ceec32506c4dca9207ab5f23e714d4
5
5
  SHA512:
6
- metadata.gz: cc92d01dc1aae578c11091fbe806248f97a8b3bdd4f8d5a718206bf15503a5d68c9f765295f6b8055f395f1d594fd06c52ee3911aaee709da86fbd5ac18044ef
7
- data.tar.gz: 81591e8ef536a0b63a0bd9f224f38f9699823f69edebd7e10bbd3ffdce61bcc4a23b8069ba6217229a417f7e7881ad4a78a58735175db3395f4d084606f70cb5
6
+ metadata.gz: d4e9bbb7c99ad5a004a75e5c5f256ccbdd3d15ab2b7679b7760fcc2ffa4800fa569d7c2ca08d4ab06645225254c5313e711cee9cfd8f4c6a2a4e9732d325d834
7
+ data.tar.gz: 2fa9b749fa9cefb19979d88b86d2c1372bb5671d81fbbda5a26d3ee2d864153c6410ae1e49bf836c493d0ca87f8ed6cf2b068c61ea516fe65e5c4028dbfe462b
data/bin/pipetext CHANGED
@@ -28,6 +28,11 @@ pipetext_example = '|| pipe |||| && ampersand &&&& Toggle (&) backgrou
28
28
  |n&nnormal color and background ||n&&n Escape sequence ||\\
29
29
 
30
30
  Add spaces to line end ||; Set line end ||]#
31
+ Set current x,y cursor position ||[x,y] Terminal bell ||[bell]
32
+ Move cursor up 1 line ||^ Hide cursor ||h
33
+ Move cursor down 1 line ||v Unhide cursor ||H
34
+ Move cursor forward 1 character ||>
35
+ Move cursor back 1 character ||< Sleep timer in float seconds ||[#.#z]
31
36
 
32
37
  Emojis: https://unicode.org/emoji/charts/full-emoji-list.html
33
38
  ||[Abbreviated CLDR Short Name] |[smiling face with heart-eyes] ||[smiling face with heart-eyes] or
data/lib/pipetext.rb CHANGED
@@ -25,8 +25,8 @@ module PipeText
25
25
  'num' => 0, # Number of times to repeat pattern
26
26
  'end_capture' => false, # Used to capture the end column number
27
27
  'end' => 0, # Number which current denotes the end of the column
28
- 'emoji_capture' => false, # Used to capture emoji description
29
- 'emoji' => String.new, # Used to capture emoji description
28
+ 'emoji_capture' => false, # Used to capture emoji description or bell/move to position
29
+ 'emoji' => String.new, # Used to capture emoji description or bell/move to position
30
30
  'unicode_capture' => 0, # Used to capture Unicode using 6 character UTF-16 hex format
31
31
  'unicode' => String.new,
32
32
  'palette_capture' => 0, # Used to capture 8-bit color using 2 character hex format
@@ -172,7 +172,21 @@ module PipeText
172
172
  capture_palette_color(character, new_text, attributes)
173
173
  elsif(attributes['emoji_capture'] == true)
174
174
  if(character == ']')
175
- emit_emoji(new_text, attributes)
175
+ if(attributes['emoji'] =~ /bell/)
176
+ new_text << "\a"
177
+ attributes['emoji'] = String.new
178
+ attributes['emoji_capture'] = false
179
+ elsif(attributes['emoji'] =~ /^([0-9]*)[,;]([0-9]*)$/)
180
+ new_text << "\e[#{$1};#{$2}H"
181
+ attributes['emoji'] = String.new
182
+ attributes['emoji_capture'] = false
183
+ elsif(attributes['emoji'] =~ /^([\.0-9]*)[zZ]$/)
184
+ attributes['emoji'] = String.new
185
+ attributes['emoji_capture'] = false
186
+ sleep($1.to_f)
187
+ else
188
+ emit_emoji(new_text, attributes)
189
+ end
176
190
  else
177
191
  attributes['emoji'] << character
178
192
  end
@@ -458,6 +472,18 @@ module PipeText
458
472
  new_text << "\e[25m"
459
473
  attributes['blink'] = false
460
474
  end
475
+ when '^' # |^ - Move up 1 line
476
+ new_text << "\e[A"
477
+ when 'v', 'V' # |v - Move down 1 line
478
+ new_text << "\e[B"
479
+ when '>' # |> - Move forward 1 character
480
+ new_text << "\e[C"
481
+ when '<' # |< - Move back 1 character
482
+ new_text << "\e[D"
483
+ when 'h' # |h - Hide cursor
484
+ new_text << "\e[?25l"
485
+ when 'H' # |H - Unhide cursor
486
+ new_text << "\e[?25h"
461
487
  when 'i', 'I' # |i - Inverse
462
488
  if(attributes['inverse'] == false)
463
489
  new_text << "\e[7m"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipetext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minaswan Nakamoto
@@ -31,11 +31,16 @@ description: "== Easily add colors, boxes, repetitions and emojis to your termin
31
31
  \ Italics |~\n bright red with blue background |R&b Bold |+\n
32
32
  \ green with yellow background |g&y Faint |.\n bright green
33
33
  with red background |G&r Crossed out |x\n normal color and background
34
- \ |n&n Escape Sequence |\\\n---\n Emojis: https://unicode.org/emoji/charts/full-emoji-list.html\n
34
+ \ |n&n Escape Sequence |\\\n\n Add spaces to line end |;
35
+ \ Set line end |]#\n Set current x,y cursor position |[x,y] Terminal
36
+ bell |[bell]\n Move cursor up 1 line |^ Hide cursor |h\n
37
+ \ Move cursor down 1 line |v Unhide cursor |H\n Move cursor
38
+ forward 1 character |>\n Move cursor back 1 character |< Sleep
39
+ timer in float seconds |[#.#z]\n---\n Emojis: https://unicode.org/emoji/charts/full-emoji-list.html\n
35
40
  \ |[Abbreviated CLDR Short Name] \U0001F60D |[smiling face with heart-eyes]
36
41
  or\n ⚙ |[gear] \U0001F4A4 |[zzz] \U0001F468 |[man] \U0001F60D |[sm
37
42
  f w he e]\n ✔ |U2714 ❌ |U274c ☮ |u262E \U0001F48E |u1f48e \U0001F49C
38
- |u1f49c\n---\n Single or double line box mode with |- or |=\n \n ┌──┬──┐
43
+ |u1f49c\n---\n\n Single or double line box mode with |- or |=\n \n ┌──┬──┐
39
44
  ╔══╦══╗ +--+--+ <-- Draw this with this: |15 |-[--v--] |=[--v--] |o[--v--]\n │
40
45
  \ │ │ ║ ║ ║ | | | |15 |-! ! ! |=! ! ! |o! !
41
46
  \ !\n 123456789012345├──┴──┤ ╠══╩══╣ +--+--+ |y1234567890|g12345|n|->--^--<