markdown_exec 1.3.7 → 1.3.9

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: f4a8eee857b22f6ce92a03144f7eb68a2c8298e8888f0b538ff2bfb710aeb790
4
- data.tar.gz: 651842b64a4ec92610d8f4ea00e002ffeaba952838d9142eb7da845edd2c7594
3
+ metadata.gz: 8fb58efae22bb345c1c1a863aa9dbf62bd6682cda0154d15d8e114cdf1b8ae64
4
+ data.tar.gz: eb0f7696597c1c53fc529e0a538e0ca9b2b684418242605574d01c449a47bf67
5
5
  SHA512:
6
- metadata.gz: afc863af78e1b75eec616e855625d1d5e8cae8a750bc51377c7110a8ed630d82a215242b2a09f8a49fdd549be7b57e96567c3b6bc384b61313feffa404600516
7
- data.tar.gz: 41cd17fff38d663fd9b052496ec1f37d40ac8df2929d28f2ffd2e0b7fee5c002a982f4ed01618e82aa4c51dc71b85032d3772d8667727f63ec75a7795ccfe1dc
6
+ metadata.gz: 0520a2e9c8c224e511821e362c189aa648f1f76a2e72876d1d87132d7f76f3ecbf2e84adbb6c4852d07b44aa52ddb08b40cd5f913dbd6540cf459794762b682f
7
+ data.tar.gz: 8acbbc2f5bde35a2e41b9852951349ff5ee5bd561c42a283675d25d6edc8d915540ea33de8cc48f72e92692ce31edff8b33a1583e3d8a983f8c28b01e82799f9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.9] - 2023-10-29
4
+
5
+ Add block types for linking and variable control
6
+
7
+ Rename options to match use.
8
+
9
+ ### Added
10
+
11
+ - Pass-through arguments after "--" to the executed script.
12
+ See document `examples/pass-through.md`.
13
+
14
+ - Add RGB color specification to basic ANSI color names.
15
+ Foreground R, G, and B values are encoded in the name "fg_rgb_R_G_B" with their decimal values.
16
+ e.g. red = "fg_rgb_255_0_0"
17
+ e.g. green = "fg_rgb_0_255_0"
18
+ e.g. blue = "fg_rgb_0_0_255"
19
+
20
+ - Add a "link" fenced code block type as a menu choice to load a different document.
21
+ The `link` block can specify:
22
+ - environment variables and values to set prior to loading the document,
23
+ - a block name to execute in the loaded document.
24
+ In the resulting menu, an automatic option (Back) allows the user to return to the original document.
25
+ See documents `examples/linked1.md`, `examples/linked2.md`.
26
+
27
+ - Add an "opts" fenced code block type as a menu choice to set current MDE options.
28
+ See document `examples/opts.md`.
29
+
30
+ - Add a "vars" fenced code block type as a menu choice to set current environment variables.
31
+ See document `examples/vars.md`.
32
+ These blocks can be hidden blocks and required in a script.
33
+
34
+ - Add a "wrap" fenced code block type to facilitate script generation.
35
+ See document `examples/wrap.md`.
36
+ These blocks are hidden and can be required by one or more blocks.
37
+
38
+ ### Changed
39
+
40
+ - Rename RegExp options to match use.
41
+
42
+ ## [1.3.8] - 2023-10-20
43
+
44
+ ### Added
45
+
46
+ - Options for hidden, included, and wrapped blocks
47
+
48
+ ## [1.3.7] - 2023-10-16
49
+
50
+ ### Changed
51
+
52
+ - Fix invocation of SavedAsset class
53
+
3
54
  ## [1.3.6] - 2023-10-15
4
55
 
5
56
  ### Added
@@ -218,8 +269,8 @@ e.g. `MDE_OUTPUT_VIEWER_OPTIONS="-a '/Applications/Sublime Text.app'" mde --sele
218
269
  | block_name_hidden_match | MDE_BLOCK_NAME_HIDDEN_MATCH | `^\(.+\)$` |
219
270
  | block_name_match | MDE_BLOCK_NAME_MATCH | `:(?<title>\S+)( \|$)` |
220
271
  | block_required_scan | MDE_BLOCK_REQUIRED_SCAN | `\+\S+` |
221
- | fenced_start_and_end_match | MDE_FENCED_START_AND_END_MATCH | ``^`{3,}`` |
222
- | fenced_start_ex_match | MDE_FENCED_START_EX_MATCH | ``^`{3,}(?<shell>[^`\s]*) *(?<name>.*)$`` |
272
+ | fenced_start_and_end_regex | MDE_FENCED_START_AND_END_REGEX | ``^`{3,}`` |
273
+ | fenced_start_extended_regex | MDE_FENCED_START_EXTENDED_REGEX | ``^`{3,}(?<shell>[^`\s]*) *(?<name>.*)$`` |
223
274
  | heading1_match | MDE_HEADING1_MATCH | `^# *(?<name>[^#]*?) *$` |
224
275
  | heading2_match | MDE_HEADING2_MATCH | `^## *(?<name>[^#]*?) *$` |
225
276
  | heading3_match | MDE_HEADING3_MATCH | `^### *(?<name>.+?) *$` |
data/Gemfile CHANGED
@@ -8,6 +8,7 @@ source 'https://rubygems.org'
8
8
  gemspec
9
9
  gem 'clipboard'
10
10
  gem 'erb'
11
+ gem 'mocha', require: false
11
12
  gem 'minitest', require: false
12
13
  gem 'pry-nav'
13
14
  gem 'pry-stack_explorer'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (1.3.7)
4
+ markdown_exec (1.3.9)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
@@ -54,6 +54,8 @@ GEM
54
54
  nokogiri (>= 1.12.0)
55
55
  method_source (1.0.0)
56
56
  minitest (5.20.0)
57
+ mocha (2.1.0)
58
+ ruby2_keywords (>= 0.0.5)
57
59
  nokogiri (1.15.4-arm64-darwin)
58
60
  racc (~> 1.4)
59
61
  open3 (0.1.2)
@@ -138,6 +140,7 @@ GEM
138
140
  rubocop-capybara (~> 2.17)
139
141
  rubocop-factory_bot (~> 2.22)
140
142
  ruby-progressbar (1.13.0)
143
+ ruby2_keywords (0.0.5)
141
144
  shellwords (0.1.0)
142
145
  thor (1.2.2)
143
146
  tty-color (0.6.0)
@@ -166,6 +169,7 @@ DEPENDENCIES
166
169
  erb
167
170
  markdown_exec!
168
171
  minitest
172
+ mocha
169
173
  pry-nav
170
174
  pry-stack_explorer
171
175
  railties
data/Rakefile CHANGED
@@ -81,6 +81,7 @@ task :minitest do
81
81
  './lib/cached_nested_file_reader.rb',
82
82
  './lib/fcb.rb',
83
83
  './lib/filter.rb',
84
+ './lib/markdown_exec.rb',
84
85
  './lib/mdoc.rb',
85
86
  './lib/object_present.rb',
86
87
  './lib/option_value.rb',
@@ -90,12 +91,10 @@ task :minitest do
90
91
  ]
91
92
 
92
93
  commands.each do |command|
93
- begin
94
- raise "Failed: #{command}" unless system("bundle exec ruby #{command}")
95
- rescue StandardError => e
96
- puts "Error: #{e.message}"
97
- exit 1
98
- end
94
+ raise "Failed: #{command}" unless system("bundle exec ruby #{command}")
95
+ rescue StandardError => err
96
+ puts "Error: #{err.message}"
97
+ exit 1
99
98
  end
100
99
  end
101
100
 
@@ -104,6 +103,12 @@ task :reek do
104
103
  `reek --config .reek .`
105
104
  end
106
105
 
106
+ desc 'test'
107
+ task :test do
108
+ Rake::Task['minitest'].execute
109
+ system 'bundle exec rspec'
110
+ end
111
+
107
112
  private
108
113
 
109
114
  # write menu.yml
@@ -0,0 +1,7 @@
1
+ colorize_env_vars() {
2
+ echo -e "- \033[1;32m${1}\033[0m"
3
+ shift
4
+ for var_name in "$@"; do
5
+ echo -e "\033[0;33m${var_name}\033[0;31m:\033[0m ${!var_name}"
6
+ done
7
+ }
@@ -13,7 +13,7 @@ __filedirs_all()
13
13
  }
14
14
 
15
15
  _mde_echo_version() {
16
- echo "1.3.7"
16
+ echo "1.3.9"
17
17
  }
18
18
 
19
19
  _mde() {
@@ -40,14 +40,6 @@ _mde() {
40
40
 
41
41
  -f) COMPREPLY="."; return 0 ;;
42
42
 
43
- --path) COMPREPLY="."; return 0 ;;
44
-
45
- -p) COMPREPLY="."; return 0 ;;
46
-
47
- --user-must-approve) COMPREPLY="1"; return 0 ;;
48
-
49
- -q) COMPREPLY="1"; return 0 ;;
50
-
51
43
  --list-count) COMPREPLY="32"; return 0 ;;
52
44
 
53
45
  --output-execution-summary) COMPREPLY="0"; return 0 ;;
@@ -56,6 +48,10 @@ _mde() {
56
48
 
57
49
  --output-stdout) COMPREPLY="1"; return 0 ;;
58
50
 
51
+ --path) COMPREPLY="."; return 0 ;;
52
+
53
+ -p) COMPREPLY="."; return 0 ;;
54
+
59
55
  --save-executed-script) COMPREPLY="0"; return 0 ;;
60
56
 
61
57
  --save-execution-output) COMPREPLY="0"; return 0 ;;
@@ -64,6 +60,10 @@ _mde() {
64
60
 
65
61
  --saved-stdout-folder) COMPREPLY="logs"; return 0 ;;
66
62
 
63
+ --user-must-approve) COMPREPLY="1"; return 0 ;;
64
+
65
+ -q) COMPREPLY="1"; return 0 ;;
66
+
67
67
  --display-level) COMPREPLY="1"; return 0 ;;
68
68
 
69
69
  esac
@@ -74,7 +74,7 @@ _mde() {
74
74
  # present matching option names
75
75
  #
76
76
  if [[ ${cur} == -* ]] ; then
77
- opts=("--block-name" "--config" "--debug" "--filename" "--help" "--path" "--user-must-approve" "--version" "--exit" "--list-blocks" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--select-recent-output" "--select-recent-script" "--tab-completions" "--run-last-script" "--pwd" "--list-count" "--output-execution-summary" "--output-script" "--output-stdout" "--save-executed-script" "--save-execution-output" "--saved-script-folder" "--saved-stdout-folder" "--display-level")
77
+ opts=("--block-name" "--config" "--debug" "--exit" "--filename" "--help" "--list-blocks" "--list-count" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--output-execution-summary" "--output-script" "--output-stdout" "--path" "--pwd" "--run-last-script" "--save-executed-script" "--save-execution-output" "--saved-script-folder" "--saved-stdout-folder" "--select-recent-output" "--select-recent-script" "--tab-completions" "--user-must-approve" "--version" "--display-level")
78
78
  COMPREPLY=( $(compgen -W "$(printf "'%s' " "${opts[@]}")" -- "${cur}") )
79
79
 
80
80
  return 0
@@ -101,14 +101,6 @@ _mde() {
101
101
 
102
102
  -f) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
103
103
 
104
- --path) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
105
-
106
- -p) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
107
-
108
- --user-must-approve) COMPREPLY=".BOOL."; return 0 ;;
109
-
110
- -q) COMPREPLY=".BOOL."; return 0 ;;
111
-
112
104
  --list-count) COMPREPLY=".INT.1-."; return 0 ;;
113
105
 
114
106
  --output-execution-summary) COMPREPLY=".BOOL."; return 0 ;;
@@ -117,6 +109,10 @@ _mde() {
117
109
 
118
110
  --output-stdout) COMPREPLY=".BOOL."; return 0 ;;
119
111
 
112
+ --path) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
113
+
114
+ -p) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
115
+
120
116
  --save-executed-script) COMPREPLY=".BOOL."; return 0 ;;
121
117
 
122
118
  --save-execution-output) COMPREPLY=".BOOL."; return 0 ;;
@@ -125,6 +121,10 @@ _mde() {
125
121
 
126
122
  --saved-stdout-folder) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
127
123
 
124
+ --user-must-approve) COMPREPLY=".BOOL."; return 0 ;;
125
+
126
+ -q) COMPREPLY=".BOOL."; return 0 ;;
127
+
128
128
  --display-level) COMPREPLY=".INT.0-3."; return 0 ;;
129
129
 
130
130
  esac
@@ -138,4 +138,4 @@ _mde() {
138
138
 
139
139
  complete -o filenames -o nospace -F _mde mde
140
140
  # _mde_echo_version
141
- # echo "Updated: 2023-10-16 16:49:28 UTC"
141
+ # echo "Updated: 2023-10-29 19:38:35 UTC"
@@ -0,0 +1,10 @@
1
+ ```bash :a
2
+ 01
3
+ ```
4
+ ```bash :a
5
+ 02
6
+ ```
7
+ ```bash :a
8
+ 03
9
+ ```
10
+
@@ -0,0 +1,8 @@
1
+ ```bash :01
2
+ 01
3
+ ```
4
+ @import import1.md
5
+ ```bash :03
6
+ 03
7
+ ```
8
+
@@ -0,0 +1,10 @@
1
+ ```bash :11
2
+ 11
3
+ ```
4
+ ```bash :12
5
+ 12
6
+ ```
7
+ ```bash:13
8
+ 13
9
+ ```
10
+
@@ -0,0 +1,12 @@
1
+ ```bash :(one)
2
+ a
3
+ ```
4
+ ```bash :two +(one)
5
+ b
6
+ ```
7
+ ```bash :(three) +two +(one)
8
+ c
9
+ ```
10
+ ```bash :four +(three)
11
+ d
12
+ ```
@@ -0,0 +1,10 @@
1
+ ```yaml :(mde_config)
2
+ display_level: -1 # invalid value, use only for testing
3
+ menu_divider_match: "^::: +(?<name>.+?)$"
4
+ menu_divider_format: "=> %s <="
5
+ ```
6
+
7
+ ::: :divider 1
8
+
9
+ ```bash :placeholder
10
+ ```
@@ -0,0 +1,28 @@
1
+ # Demo document linking
2
+
3
+ ::: * This is document 1 *
4
+ ::: This document links to a matching document to demonstrate navigation between documents.
5
+
6
+ ::: This Bash block displays the value of variables "linked1var" and "linked2var"
7
+
8
+ ```bash :page1_show_vars
9
+ source bin/colorize_env_vars.sh
10
+ colorize_env_vars 'on page1' linked1var linked2var
11
+ ```
12
+
13
+ ::: This Link block sets variable "linked2var" and navigates to document 2.
14
+
15
+ ```link :linked2
16
+ file: examples/linked2.md
17
+ vars:
18
+ linked2var: from_linked1
19
+ ```
20
+
21
+ ::: This Link block sets variable "linked2var", navigates to document 2, and executes block "page2_show_vars".
22
+
23
+ ```link :linked2_show_vars
24
+ file: examples/linked2.md
25
+ block: page2_show_vars
26
+ vars:
27
+ linked2var: from_linked1
28
+ ```
@@ -0,0 +1,28 @@
1
+ # Demo document linking
2
+
3
+ ::: * This is document 2 *
4
+ ::: This document links to a matching document to demonstrate navigation between documents.
5
+
6
+ ::: This Bash block displays the value of variables "linked1var" and "linked2var"
7
+
8
+ ```bash :page2_show_vars
9
+ source bin/colorize_env_vars.sh
10
+ colorize_env_vars 'on page2' linked1var linked2var
11
+ ```
12
+
13
+ ::: This Link block sets variable "linked1var" and navigates to document 1.
14
+
15
+ ```link :linked1
16
+ file: examples/linked1.md
17
+ vars:
18
+ linked1var: from_linked2
19
+ ```
20
+
21
+ ::: This Link block sets variable "linked1var", navigates to document 1, and executes block "page1_show_vars".
22
+
23
+ ```link :linked1_show_vars
24
+ file: examples/linked1.md
25
+ block: page1_show_vars
26
+ vars:
27
+ linked1var: from_linked2
28
+ ```
data/examples/opts.md ADDED
@@ -0,0 +1,13 @@
1
+ # Demo configuring options
2
+
3
+ ::: These Opts blocks set the color of a couple of menu options to demonstrate the live update of options.
4
+
5
+ ```opts :opts1
6
+ menu_divider_color: yellow
7
+ menu_task_color: fg_rgb_255_63_255
8
+ ```
9
+
10
+ ```opts :opts2
11
+ menu_divider_color: fg_rgb_255_0_255
12
+ menu_task_color: fg_rgb_127_127_255
13
+ ```
@@ -0,0 +1,14 @@
1
+ Pass-through arguments after "--" to the executed script.
2
+
3
+ A block can expect arguments to receive all arguments to MDE after "--".
4
+
5
+ For `mde examples/pass-through.md output_arguments -- 123`,
6
+ this block outputs:
7
+
8
+ ARGS: 123
9
+
10
+ ::: This block will output any arguments after "--" in the command line.
11
+
12
+ ```bash :output_arguments
13
+ echo "ARGS: $*"
14
+ ```
data/examples/plant.md ADDED
@@ -0,0 +1,23 @@
1
+ ::: Nourish
2
+
3
+ [ ] Observe soil moisture level
4
+
5
+ ```bash :Watering_the_plant
6
+ echo glug glug glug
7
+ ```
8
+
9
+ ::: Maintain
10
+
11
+ [ ] Observe leaf color and health
12
+
13
+ ```bash :Trimming_dead_or_yellowing_leaves
14
+ echo snip snip
15
+ ```
16
+
17
+ ::: Release
18
+
19
+ [ ] Observe flowering and fruiting patterns
20
+
21
+ ```bash :Repotting_when_necessary
22
+ echo farewell
23
+ ```
data/examples/port.md ADDED
@@ -0,0 +1,23 @@
1
+ # Demo variable porting
2
+
3
+ ::: This block requires the Port block and displays the value.
4
+ ::: The Port block contributes the variable VAULT to the generated script.
5
+
6
+ ```bash :show +(vault)
7
+ : ${VAULT:=This variable has not been set.}
8
+ source bin/colorize_env_vars.sh
9
+ colorize_env_vars '' VAULT
10
+ ```
11
+
12
+ ::: Set the VAULT value in memory.
13
+ ::: Call this block prior to `show` to demonstrate in-memory value being written to script.
14
+
15
+ ```vars :set
16
+ VAULT: This variable was set by the "set" block.
17
+ ```
18
+
19
+ ::: There is an invisible Port block that saves current/live environment variable values into the generated script.
20
+
21
+ ```port :(vault)
22
+ VAULT
23
+ ```
data/examples/vars.md ADDED
@@ -0,0 +1,20 @@
1
+ ```bash :(defaults)
2
+ : ${VAULT:=default}
3
+ ```
4
+ ```bash :show_vars +(defaults)
5
+ source bin/colorize_env_vars.sh
6
+ colorize_env_vars '' VAULT
7
+ ```
8
+ ```vars :set
9
+ VAULT: 11
10
+ ```
11
+ ```vars :set_with_show +show_vars
12
+ VAULT: 22
13
+ ```
14
+ ```bash :(hidden)
15
+ colorize_env_vars '' NOTHING
16
+ ```
17
+ ```bash :show_with_set +set
18
+ source bin/colorize_env_vars.sh
19
+ colorize_env_vars '' VAULT
20
+ ```
data/examples/wrap.md ADDED
@@ -0,0 +1,33 @@
1
+ # Demo block wrapping
2
+
3
+ ::: This block is wrapped by the `{outer*}` pair of blocks.
4
+
5
+ ```bash :single +{outer}
6
+ echo single body - wrapped by outer
7
+ ```
8
+
9
+ ::: This block is wrapped first by the `{outer*}` pair of blocks
10
+ ::: and nested inside, the `{inner*}` pair of blocks.
11
+
12
+ ```bash :nested +{outer} +{inner}
13
+ echo nested body - wrapped by outer and then inner
14
+ ```
15
+
16
+ ::: This pair of hidden blocks are the `{inner*}` set.
17
+ ```bash :{inner}
18
+ echo inner-before
19
+ ```
20
+
21
+ ```bash :{inner-after}
22
+ echo inner-after
23
+ ```
24
+
25
+ ::: This pair of hidden blocks are the `{outer*}` set.
26
+
27
+ ```bash :{outer}
28
+ echo outer-before
29
+ ```
30
+
31
+ ```bash :{outer-after}
32
+ echo outer-after
33
+ ```
@@ -0,0 +1,5 @@
1
+ BLOCK_TYPE_BASH = 'bash'
2
+ BLOCK_TYPE_LINK = 'link'
3
+ BLOCK_TYPE_OPTS = 'opts'
4
+ BLOCK_TYPE_PORT = 'port'
5
+ BLOCK_TYPE_VARS = 'vars'
@@ -69,7 +69,6 @@ if $PROGRAM_NAME == __FILE__
69
69
  @file1 = Tempfile.new('test1.txt')
70
70
  @file1.write("Line1\nLine2\n #insert #{@file2.path}\nLine3")
71
71
  @file1.rewind
72
- # binding.pry
73
72
  @reader = CachedNestedFileReader.new(import_pattern: /^ *#insert (.+)$/)
74
73
  end
75
74
 
data/lib/colorize.rb CHANGED
@@ -2,67 +2,81 @@
2
2
 
3
3
  # encoding=utf-8
4
4
 
5
- # │0 │ to restore default │
6
- # │ │ color │
7
- # ├───┼───────────────────────┤
8
- # │ │ │
9
- # │1 │ for brighter colors │
10
- # ├───┼───────────────────────┤
11
- # │ │ │
12
- # │4 │ for underlined text │
13
- # ├───┼───────────────────────┤
14
- # │ │ │
15
- # │5 │ for flashing text
16
5
  class String
6
+ alias_method :original_method_missing, :method_missing
7
+
8
+ def method_missing(method_name, *args, &block)
9
+ if /^fg_rgb_/ =~ method_name.to_s
10
+ fg_rgb_color($'.gsub('_', ';'))
11
+ else
12
+ original_method_missing(method_name, *args, &block)
13
+ end
14
+ end
15
+
16
+ # control sequence with reset
17
+ #
18
+ def ansi_control_sequence
19
+ "\033[#{self}\033[0m"
20
+ end
21
+
22
+ # use 24-bit RGB foreground color spec
23
+ # ex: 1;2;3
24
+ #
25
+ def fg_rgb_color(rgb)
26
+ "38;2;#{rgb}m#{self}".ansi_control_sequence
27
+ end
28
+
17
29
  def plain
18
30
  self
19
31
  end
20
32
 
33
+ # named colors
34
+ #
21
35
  def black
22
- "\033[30m#{self}\033[0m"
36
+ "30m#{self}".ansi_control_sequence
23
37
  end
24
38
 
25
39
  def red
26
- "\033[31m#{self}\033[0m"
40
+ "31m#{self}".ansi_control_sequence
27
41
  end
28
42
 
29
43
  def bred
30
- "\033[1;31m#{self}\033[0m"
44
+ "1;31m#{self}".ansi_control_sequence
31
45
  end
32
46
 
33
47
  def green
34
- "\033[32m#{self}\033[0m"
48
+ "32m#{self}".ansi_control_sequence
35
49
  end
36
50
 
37
51
  def bgreen
38
- "\033[1;32m#{self}\033[0m"
52
+ "1;32m#{self}".ansi_control_sequence
39
53
  end
40
54
 
41
55
  def yellow
42
- "\033[33m#{self}\033[0m"
56
+ "33m#{self}".ansi_control_sequence
43
57
  end
44
58
 
45
59
  def byellow
46
- "\033[1;33m#{self}\033[0m"
60
+ "1;33m#{self}".ansi_control_sequence
47
61
  end
48
62
 
49
63
  def blue
50
- "\033[34m#{self}\033[0m"
64
+ "34m#{self}".ansi_control_sequence
51
65
  end
52
66
 
53
67
  def magenta
54
- "\033[35m#{self}\033[0m"
68
+ "35m#{self}".ansi_control_sequence
55
69
  end
56
70
 
57
71
  def cyan
58
- "\033[36m#{self}\033[0m"
72
+ "36m#{self}".ansi_control_sequence
59
73
  end
60
74
 
61
75
  def white
62
- "\033[37m#{self}\033[0m"
76
+ "37m#{self}".ansi_control_sequence
63
77
  end
64
78
 
65
79
  def bwhite
66
- "\033[1;37m#{self}\033[0m"
80
+ "1;37m#{self}".ansi_control_sequence
67
81
  end
68
82
  end