colours 0.8.12 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +331 -200
  3. data/bin/colours +2 -2
  4. data/bin/show_basic_colour_palette +7 -0
  5. data/colours.gemspec +1 -2
  6. data/doc/README.gen +294 -178
  7. data/doc/how_to_pick_your_own_colours/how_to_pick_your_own_colours.md +33 -0
  8. data/lib/colours/autoalias_e.rb +4 -1
  9. data/lib/colours/autogenerated/256_colours_instance_methods.rb +1429 -0
  10. data/lib/colours/autogenerated/256_colours_methods.rb +1429 -0
  11. data/lib/colours/autogenerated/html_colours_instance_methods.rb +1191 -0
  12. data/lib/colours/autogenerated/html_colours_methods.rb +1191 -0
  13. data/lib/colours/base/base.rb +61 -13
  14. data/lib/colours/class/colours.rb +8 -6
  15. data/lib/colours/{toplevel_methods/use_colours.rb → colour/colour.rb} +4 -125
  16. data/lib/colours/commandline/README.md +2 -1
  17. data/lib/colours/commandline/commandline.rb +177 -34
  18. data/lib/colours/constants/constants.rb +752 -6
  19. data/lib/colours/e/README.md +6 -6
  20. data/lib/colours/eparse/eparse.rb +2 -1
  21. data/lib/colours/essentials/README.md +5 -0
  22. data/lib/colours/{basic_colours/basic_colours.rb → essentials/essentials.rb} +87 -85
  23. data/lib/colours/html_colours/README.md +2 -1
  24. data/lib/colours/html_colours/hash_html_colours.rb +168 -0
  25. data/lib/colours/html_colours/html_colours.rb +226 -244
  26. data/lib/colours/html_colours/push_the_html_colours_methods_onto_the_toplevel_namespace.rb +30 -0
  27. data/lib/colours/html_colours/random_html_colour.rb +67 -0
  28. data/lib/colours/{requires/require_the_basic_colours.rb → html_colours.rb} +4 -2
  29. data/lib/colours/map_symbol_to_corresponding_colour/map_symbol_to_corresponding_colour.rb +12 -10
  30. data/lib/colours/module_256_colours/module_256_colours.rb +465 -0
  31. data/lib/colours/project/project.rb +3 -1
  32. data/lib/colours/rainbow_colours/check_for_trollop_being_available_or_exit.rb +4 -0
  33. data/lib/colours/rainbow_colours/constants.rb +3 -3
  34. data/lib/colours/rainbow_colours/do_parse_via_rainbow_colours.rb +9 -10
  35. data/lib/colours/rainbow_colours/print_rainbow_line.rb +4 -4
  36. data/lib/colours/rainbow_colours/println_ani.rb +7 -7
  37. data/lib/colours/rainbow_colours/println_plain.rb +2 -2
  38. data/lib/colours/rainbow_colours/rainbow.rb +31 -1
  39. data/lib/colours/rainbow_colours/report_errors.rb +7 -7
  40. data/lib/colours/rainbow_colours/returnln_plain.rb +3 -3
  41. data/lib/colours/replace_tokens_with_colour_code/replace_tokens_with_colour_code.rb +409 -0
  42. data/lib/colours/requires/require_autogenerated_colour_methods.rb +4 -1
  43. data/lib/colours/requires/{require_the_colour_table.rb → require_essentials.rb} +2 -2
  44. data/lib/colours/requires/require_save_file.rb +11 -0
  45. data/lib/colours/requires/require_the_256_colours_module.rb +1 -3
  46. data/lib/colours/requires/require_the_colour_methods.rb +1 -22
  47. data/lib/colours/requires/require_the_project.rb +31 -29
  48. data/lib/colours/requires/require_the_toplevel_methods.rb +2 -20
  49. data/lib/colours/rgb/rgb.rb +107 -89
  50. data/lib/colours/{colour_methods/colour_methods.rb → sfile_sdir_sfancy_swarn_simp_scomments_and_ssymlink/sfile_sdir_sfancy_swarn_simp_scomments_and_ssymlink.rb} +467 -405
  51. data/lib/colours/testing/testing.rb +1 -3
  52. data/lib/colours/toplevel_methods/e.rb +9 -13
  53. data/lib/colours/toplevel_methods/map_this_symbol_to_that_html_colour.rb +57 -0
  54. data/lib/colours/toplevel_methods/{revert.rb → rev.rb} +5 -48
  55. data/lib/colours/toplevel_methods/toplevel_methods.rb +1204 -0
  56. data/lib/colours/version/version.rb +2 -2
  57. data/lib/colours/yaml/256_colours.yml +776 -257
  58. data/lib/colours/yaml/html_colours.yml +1 -1
  59. data/lib/colours/yaml/prefer_this_colour_schemata.yml +1 -1
  60. data/lib/colours/yaml/use_these_values_for_the_colour_methods.yml +5 -1
  61. data/lib/colours.rb +1 -1
  62. data/test/testing_256_colours_support.rb +10 -1
  63. data/test/testing_replace_number_words_with_the_corresponding_html_colour.rb +15 -9
  64. data/test/testing_the_colour_methods_such_as_simp_sdir_sfile_swarn_sfancy_sargument_and_ssymlink.rb +53 -0
  65. metadata +30 -57
  66. data/doc/HOW_TO_PICK_YOUR_OWN_COLOURS.md +0 -28
  67. data/lib/colours/256_colours/support_for_256_colours.rb +0 -196
  68. data/lib/colours/autogenerated/support_for_256_colours.rb +0 -2235
  69. data/lib/colours/autogenerated/support_for_html_colours.rb +0 -1778
  70. data/lib/colours/autogenerated/toplevel_basic_colour_methods.rb +0 -7001
  71. data/lib/colours/basic_colours/README.md +0 -4
  72. data/lib/colours/colour_methods/README.md +0 -11
  73. data/lib/colours/colour_table/README.md +0 -2
  74. data/lib/colours/colour_table/colour_table.rb +0 -282
  75. data/lib/colours/commandline/menu.rb +0 -122
  76. data/lib/colours/constants/escape.rb +0 -22
  77. data/lib/colours/constants/file_constants.rb +0 -73
  78. data/lib/colours/constants/hash_ansi_colours.rb +0 -39
  79. data/lib/colours/constants/hash_simple_colours.rb +0 -148
  80. data/lib/colours/constants/misc.rb +0 -361
  81. data/lib/colours/constants/newline.rb +0 -14
  82. data/lib/colours/constants/registered_colour_methods.rb +0 -53
  83. data/lib/colours/html_colours/add_html_colours_onto_the_toplevel_namespace.rb +0 -22
  84. data/lib/colours/toplevel_methods/autogenerate.rb +0 -310
  85. data/lib/colours/toplevel_methods/bold.rb +0 -41
  86. data/lib/colours/toplevel_methods/bold_and_italic.rb +0 -38
  87. data/lib/colours/toplevel_methods/cat.rb +0 -39
  88. data/lib/colours/toplevel_methods/clear_screen.rb +0 -18
  89. data/lib/colours/toplevel_methods/cliner.rb +0 -17
  90. data/lib/colours/toplevel_methods/col.rb +0 -54
  91. data/lib/colours/toplevel_methods/esystem.rb +0 -19
  92. data/lib/colours/toplevel_methods/html_colour_to_hex_value.rb +0 -41
  93. data/lib/colours/toplevel_methods/html_colourize.rb +0 -69
  94. data/lib/colours/toplevel_methods/is_on_roebe.rb +0 -16
  95. data/lib/colours/toplevel_methods/italic.rb +0 -110
  96. data/lib/colours/toplevel_methods/make_colour.rb +0 -28
  97. data/lib/colours/toplevel_methods/methods_related_to_html_colours.rb +0 -336
  98. data/lib/colours/toplevel_methods/misc.rb +0 -226
  99. data/lib/colours/toplevel_methods/open_this_file.rb +0 -26
  100. data/lib/colours/toplevel_methods/prefer_this_colour_schemata.rb +0 -88
  101. data/lib/colours/toplevel_methods/random_value.rb +0 -37
  102. data/lib/colours/toplevel_methods/remove_escape_sequence.rb +0 -112
  103. data/lib/colours/toplevel_methods/set_last_colour_used.rb +0 -32
  104. data/lib/colours/toplevel_methods/shell_file_containing_the_html_colours.sh +0 -148
  105. data/lib/colours/toplevel_methods/show_basic_colour_palette.rb +0 -36
  106. data/lib/colours/toplevel_methods/underline.rb +0 -130
  107. data/test/testing_the_colour_methods.rb +0 -36
  108. /data/doc/{COLOUR_CODES_CHART.md → colour_codes_chart/colour_codes_chart.md} +0 -0
@@ -2,28 +2,76 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
- # This is a "dummy" class from which you can quickly subclass if you
6
- # need methods such as royalblue() to work in your class.
5
+ # This class can be used if you want to subclass directly from the
6
+ # colours gem. It is in many ways a "dummy" class, but it also allows
7
+ # you to quickly subclass from it, if you need methods such as
8
+ # royalblue() to work in your class. Other than that it may be better
9
+ # to work with the modules instead, e. g. "include Colours" specifically.
7
10
  # =========================================================================== #
8
11
  # require 'colours/base/base.rb'
9
12
  # class Foobar < Colours::Base
10
13
  # =========================================================================== #
11
14
  module Colours
12
15
 
13
- begin
14
- require 'colours/autogenerated/toplevel_basic_colour_methods.rb'
15
- rescue LoadError => error
16
- pp error
17
- end
18
-
19
16
  class Base # === Colours::Base
20
17
 
21
- begin
22
- include Colours::AllColourMethods
23
- rescue; end # This is ok, as there is a begin/rescue above.
18
+ require 'colours/constants/constants.rb' # For methods such as left?.
19
+ require 'colours/requires/require_essentials.rb'
20
+ require 'colours/toplevel_methods/toplevel_methods.rb'
21
+ require 'colours/toplevel_methods/e.rb'
22
+ require 'colours/module_256_colours/module_256_colours.rb'
23
+ require 'colours/sfile_sdir_sfancy_swarn_simp_scomments_and_ssymlink/sfile_sdir_sfancy_swarn_simp_scomments_and_ssymlink.rb'
24
+ require 'colours/html_colours/html_colours.rb'
25
+
26
+ # =========================================================================== #
27
+ # === e
28
+ # =========================================================================== #
29
+ def e(i = '')
30
+ ::Colours.e(i)
31
+ end
32
+
33
+ # =========================================================================== #
34
+ # === set_commandline_arguments
35
+ # =========================================================================== #
36
+ def set_commandline_arguments(i)
37
+ @commandline_arguments = [i].flatten.compact
38
+ end
39
+
40
+ # =========================================================================== #
41
+ # === commandline_arguments?
42
+ # =========================================================================== #
43
+ def commandline_arguments?
44
+ @commandline_arguments
45
+ end
46
+
47
+ # =========================================================================== #
48
+ # === first_argument?
49
+ # =========================================================================== #
50
+ def first_argument?
51
+ @commandline_arguments.first
52
+ end
53
+
54
+ # =========================================================================== #
55
+ # === second_argument?
56
+ # =========================================================================== #
57
+ def second_argument?
58
+ @commandline_arguments[1]
59
+ end
60
+
61
+ # =========================================================================== #
62
+ # === extend_module_256_colours
63
+ # =========================================================================== #
64
+ def extend_module_256_colours
65
+ extend ::Colours::Module256Colours
66
+ end
24
67
 
25
68
  end; end
26
69
 
27
70
  if __FILE__ == $PROGRAM_NAME
28
- puts Colours::Base.new.royalblue('hi there')
29
- end
71
+ alias e puts
72
+ base = Colours::Base.new
73
+ base.extend_module_256_colours
74
+ e base.is_this_a_256_colour? 'LightSteelBlue3'
75
+ e base.royalblue('hi there')
76
+ e base.royalblue('hi there')
77
+ end # base.rb
@@ -26,14 +26,11 @@
26
26
  # require 'colours/class/colours.rb'
27
27
  # Colours.fancy_parse '<i><red>E. coli</red></i>'
28
28
  # =========================================================================== #
29
- module Colours
30
-
31
- class Colours
29
+ require 'colours/base/base.rb'
32
30
 
33
- alias e puts
31
+ module Colours
34
32
 
35
- require 'colours/constants/hash_ansi_colours.rb'
36
- require 'colours/toplevel_methods/methods_related_to_html_colours.rb'
33
+ class Colours < Base # === Colours::Colours
37
34
 
38
35
  # ========================================================================= #
39
36
  # === LEADING_PART
@@ -450,6 +447,8 @@ end
450
447
 
451
448
  # =========================================================================== #
452
449
  # === Colours.new
450
+ #
451
+ # Easier toplevel-instantiation.
453
452
  # =========================================================================== #
454
453
  def self.new(i = ARGV)
455
454
  ::Colours::Colours.new(i)
@@ -459,6 +458,9 @@ end
459
458
 
460
459
  # =========================================================================== #
461
460
  # === Colours()
461
+ #
462
+ # And a toplevel method that can be used to create a new instance of
463
+ # class Colours::Colours.
462
464
  # =========================================================================== #
463
465
  def Colours(i)
464
466
  ::Colours::Colours.new(i)
@@ -2,134 +2,13 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
- # require 'colours/toplevel_methods/use_colours.rb'
5
+ # === Colours::Colour
6
+ #
7
+ # This file includes a standalone Colour class, as part of the Colours
8
+ # namespace.
6
9
  # =========================================================================== #
7
10
  module Colours
8
11
 
9
- require 'colours/toplevel_methods/set_last_colour_used.rb'
10
-
11
- # ========================================================================= #
12
- # === @use_colours
13
- #
14
- # Whether we will use colours or whether we will not. This can be
15
- # used to globally disable colours in every project using the
16
- # Colours gem.
17
- # ========================================================================= #
18
- @use_colours = true
19
-
20
- # ========================================================================= #
21
- # === @use_html_colours
22
- #
23
- # This is a separate variable so that we can selectively disable or
24
- # enable the colours for the Konsole submodule. Some terminals do
25
- # not respond nicely to the R,G,B values that the Konsole submodule
26
- # may require.
27
- # ========================================================================= #
28
- @use_html_colours = true
29
-
30
- # ========================================================================= #
31
- # === Colours.use_colours?
32
- #
33
- # Use this method to find out whether we wish to use colours or
34
- # whether we do not.
35
- # ========================================================================= #
36
- def self.use_colours?
37
- @use_colours
38
- end
39
-
40
- # ========================================================================= #
41
- # === Colours.enable_html_colours
42
- #
43
- # Use this method to specifically enable konsole-colours.
44
- # ========================================================================= #
45
- def self.enable_html_colours
46
- @use_html_colours = true
47
- end; self.instance_eval { alias enable_konsole_colours enable_html_colours } # === Colours.enable_konsole_colours
48
-
49
- # ========================================================================= #
50
- # === Colours.use_html_colours?
51
- #
52
- # Query whether we will use the HTML colours or whether we will not.
53
- # ========================================================================= #
54
- def self.use_html_colours?
55
- @use_html_colours
56
- end; self.instance_eval { alias use_konsole? use_html_colours? } # === Colours.use_konsole?
57
- self.instance_eval { alias use_konsole_colours? use_html_colours? } # === Colours.use_konsole_colours??
58
-
59
- # ========================================================================= #
60
- # === Colours.disable_html_colours
61
- #
62
- # Disable the HTML colours.
63
- # ========================================================================= #
64
- def self.disable_html_colours
65
- @use_html_colours = false
66
- end
67
-
68
- # ========================================================================= #
69
- # === Colours.disable_colours
70
- #
71
- # This method can be used to disable the colours on the Colours
72
- # namespace.
73
- # ========================================================================= #
74
- def self.disable_colours(
75
- be_verbose = false
76
- )
77
- puts 'Disabling colours next.' if be_verbose
78
- @use_colours = false
79
- end; self.instance_eval { alias disable disable_colours } # === Colours.disable
80
-
81
- # ========================================================================= #
82
- # === Colours.enable_colours
83
- #
84
- # Use this method to enable colours for the whole Colours namespace.
85
- # ========================================================================= #
86
- def self.enable_colours(
87
- be_verbose = false
88
- )
89
- puts 'Enabling colours next.' if be_verbose
90
- @use_colours = true # Defined below.
91
- end; self.instance_eval { alias enable enable_colours } # === Colours.enable
92
-
93
- # ========================================================================= #
94
- # === Colours.use_colours=
95
- #
96
- # Determine whether we will use colours or whether we will not.
97
- #
98
- # The first input argument to this method should be a Bool, such
99
- # as true or false.
100
- # ========================================================================= #
101
- def self.use_colours=(
102
- new_value = true
103
- )
104
- @use_colours = new_value
105
- end; self.instance_eval { alias set_use_colours use_colours= } # === Colours.set_use_colours
106
-
107
- # ========================================================================= #
108
- # === use_colours?
109
- #
110
- # Delegate towards the class-method here. Unsure whether this method
111
- # is really needed, but let's keep it for now. After all we can
112
- # use "include Colours" to add that method.
113
- # ========================================================================= #
114
- def use_colours?
115
- ::Colours.use_colours?
116
- end
117
-
118
- # ========================================================================= #
119
- # === Colours.report_whether_colours_will_be_used
120
- # ========================================================================= #
121
- def self.report_whether_colours_will_be_used
122
- if @use_colours
123
- puts 'Yes, colours will be used.'
124
- else
125
- puts 'Colours are currently disabled.'
126
- end
127
- end
128
-
129
- # =========================================================================== #
130
- # This file includes a standalone Colour class, as part of the
131
- # Colours namespace.
132
- # =========================================================================== #
133
12
  class Colour # === Colours::Colour
134
13
 
135
14
  # ========================================================================= #
@@ -1,2 +1,3 @@
1
1
  This directory collects code that can be used for Colours.commandline()
2
- input, including the menu() functionality of it.
2
+ input, including the menu() functionality of it. This is handled by
3
+ a distinct class called Commandline since as of November 2023.
@@ -2,57 +2,200 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
+ # Although this is a class, the functionality must be made available
6
+ # on the toplevel module called "Colours" as well. So the class is
7
+ # just the wrapper over that toplevel functionality.
8
+ # =========================================================================== #
5
9
  # require 'colours/commandline/commandline.rb'
10
+ # Colours::Commandline.new
6
11
  # =========================================================================== #
12
+ require 'colours/base/base.rb'
13
+
7
14
  module Colours
8
15
 
9
- require 'colours/commandline/menu.rb'
10
- require 'colours/eparse/eparse.rb'
11
-
12
- alias e puts
16
+ class Commandline < Colours::Base # === Colours::Commandline
13
17
 
14
18
  # ========================================================================= #
15
- # === Colours.set_commandline
19
+ # === initialize
16
20
  # ========================================================================= #
17
- def self.set_commandline(i = ARGV)
18
- @commandline = [i].flatten.compact
21
+ def initialize(
22
+ commandline_arguments = ARGV,
23
+ run_already = true
24
+ )
25
+ set_commandline_arguments(
26
+ commandline_arguments
27
+ )
28
+ # ======================================================================= #
29
+ # Also store it on the toplevel since as of November 2023.
30
+ # ======================================================================= #
31
+ ::Colours.set_commandline_arguments(
32
+ commandline_arguments
33
+ )
34
+ run if run_already
19
35
  end
20
36
 
21
37
  # ========================================================================= #
22
- # === Colours.commandline?
38
+ # === menu (menu tag)
23
39
  # ========================================================================= #
24
- def self.commandline?
25
- @commandline
26
- end
40
+ def menu(
41
+ i = ARGV
42
+ )
43
+ if i.is_a? Array
44
+ i.each {|entry| menu(entry) }
45
+ else
46
+ case i # case tag
47
+ # ===================================================================== #
48
+ # === colours --autogenerate_html_colours_methods
49
+ # ===================================================================== #
50
+ when /^-?-?autogenerate(-|_)?html(-|_)?colours(-|_)?methods$/i,
51
+ /^-?-?autogenerate$/i
52
+ ::Colours.autogenerate_html_colours_methods
53
+ # ===================================================================== #
54
+ # === colours --autogenerate_256_colours_methods
55
+ # ===================================================================== #
56
+ when /^-?-?autogenerate(-|_)?256(-|_)?colours(-|_)?methods$/i,
57
+ /^-?-?256$/
58
+ require 'colours/module_256_colours/module_256_colours.rb'
59
+ ::Colours.autogenerate_256_colours_methods
60
+ # ===================================================================== #
61
+ # === colours --generate_shell_file_containing_the_html_colours
62
+ #
63
+ # This entry point will autogenerate the shell-file that contains
64
+ # the HTML colours (RGB colours).
65
+ # ===================================================================== #
66
+ when /^-?-?generate(-|_)?shell(-|_)?file(-|_)?containing(-|_)?the(-|_)?html(-|_)?colours$/i,
67
+ /^-?-?create(-|_)?shell(-|_)?file$/i # === colours --create-shell-file
68
+ ::Colours.generate_shell_file_containing_the_html_colours
69
+ # ===================================================================== #
70
+ # === colours --show-html_colours
71
+ # ===================================================================== #
72
+ when /^-?-?show(-|_)?html(-|_)?colours$/i,
73
+ /^-?-?show(-|_)?all(-|_)?html(-|_)?colours$/i,
74
+ /^-?-?show(-|_)?all(-|_)?colours$/i,
75
+ /^-?-?html(-|_)?colours$/i,
76
+ 'hcolours',
77
+ 'scolours',
78
+ 'all',
79
+ 'ALL',
80
+ '1',
81
+ 'ALL_COLOURS',
82
+ 'colours?',
83
+ 'all_colours',
84
+ 'COLOURS',
85
+ 'html',
86
+ '' # Show all colours here
87
+ ::Colours.show_html_colours
88
+ exit
89
+ # ===================================================================== #
90
+ # === colours --basics
91
+ # ===================================================================== #
92
+ when /^-?-?basics?$/i
93
+ ::Colours.show_basic_colour_palette
94
+ exit
95
+ # ===================================================================== #
96
+ # === colours --open
97
+ # ===================================================================== #
98
+ when /^-?-?open$/i
99
+ open_this_file :then_exit
100
+ # ===================================================================== #
101
+ # === colours --file?
102
+ # ===================================================================== #
103
+ when /^-?-?file\??$/i
104
+ cliner {
105
+ e 'We will next read in from the default file, from:'
106
+ e
107
+ e " #{sfile(TEST_FILE)}"
108
+ e
109
+ read_and_display_this_file
110
+ }
111
+ # ===================================================================== #
112
+ # === colours --show-colour-palette
113
+ # === colours --palette
114
+ #
115
+ # This entry point will show the basic colour palette.
116
+ # ===================================================================== #
117
+ when /^-?-?show(-|_)?colou?r(-|_)?palette$/i,
118
+ /^-?-?show(-|_)?palette$/i,
119
+ /^-?-?palette$/i
120
+ show_colour_palette
121
+ # ===================================================================== #
122
+ # === colours --help
123
+ # ===================================================================== #
124
+ when /^-?-?help$/i
125
+ show_help
126
+ # ===================================================================== #
127
+ # === colours --project_base_directory?
128
+ # ===================================================================== #
129
+ when /^-?-?project(_|-)?base(_|-)?dir\??$/i,
130
+ /^-?-?project(_|-)?base(_|-)?directory\??$/i,
131
+ /^-?-?base(_|-)?dir\??$/i
132
+ e Colours.project_base_directory?
133
+ # ===================================================================== #
134
+ # === ruby commandline.rb --version
135
+ # ===================================================================== #
136
+ when /-?-?version/i
137
+ Colours.show_the_version
138
+ # ===================================================================== #
139
+ # === colours --version
140
+ #
141
+ # Show the current version of the colours gem.
142
+ # ===================================================================== #
143
+ when /^-?-?versions?\??$/i
144
+ show_the_version
145
+ end
146
+ end
147
+ end; alias check_against_menu menu # === check_against_menu
27
148
 
28
149
  # ========================================================================= #
29
- # === Colours.show_the_version
30
- #
31
- # Invocation example:
32
- #
33
- # colours --version?
34
- #
150
+ # === show_help
35
151
  # ========================================================================= #
36
- def self.show_the_version
37
- e steelblue(VERSION)
152
+ def show_help
153
+ ::Colours.show_help
38
154
  end
39
155
 
40
156
  # ========================================================================= #
41
- # === Colours.show_help (help tag)
157
+ # === run (run tag)
42
158
  # ========================================================================= #
43
- def self.show_help
44
- e
45
- e 'This menu supports the following commands:'
46
- e
47
- eparse ' file? # read in from the default test file'
48
- eparse ' html_colours # show all html colours'
49
- eparse ' open # open this file here in your editor'
50
- eparse ' --version? # report the current version of '\
51
- 'the colours gem'
52
- eparse ' --base-dir? # show the project base directory '\
53
- 'of the Colours namespace'
54
- eparse ' --show-html-colours # show the available HTML colours'
55
- e
56
- end; self.instance_eval { alias help show_help } # === Colours.help
159
+ def run
160
+ menu
161
+ end
162
+
163
+ end
164
+
165
+ # =========================================================================== #
166
+ # === Colours.set_commandline_arguments
167
+ # =========================================================================== #
168
+ def self.set_commandline_arguments(i = ARGV)
169
+ @commandline_arguments = [i].flatten.compact
170
+ end
57
171
 
172
+ # =========================================================================== #
173
+ # === Colours.commandline_arguments?
174
+ # =========================================================================== #
175
+ def self.commandline_arguments?
176
+ @commandline_arguments
177
+ end; self.instance_eval { alias commandline? commandline_arguments? } # === Colours.commandline?
178
+
179
+ # =========================================================================== #
180
+ # === Colours.menu (menu tag)
181
+ #
182
+ #
183
+ # To invoke this method, try:
184
+ #
185
+ # colours --show_html_colours
186
+ # colours file?
187
+ #
188
+ # =========================================================================== #
189
+ def self.menu(
190
+ i = ARGV
191
+ )
192
+ _ = ::Colours::Commandline.new(i, :do_not_run_yet)
193
+ _.menu(i) # Directly pass it into the menu-method here.
194
+ end; self.instance_eval { alias check_against_menu menu } # === Colours.check_against_menu
195
+
196
+ end
197
+
198
+ if __FILE__ == $PROGRAM_NAME
199
+ alias e puts
200
+ Colours::Commandline.new(ARGV)
58
201
  end