environment_information 1.4.124 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +91 -15
- data/doc/README.gen +42 -14
- data/doc/todo/TODO_FOR_THE_ENVIRONMENT_INFORMATION_PROJECT.md +16 -12
- data/lib/environment_information/base/base.rb +483 -99
- data/lib/environment_information/colours/colours.rb +92 -66
- data/lib/environment_information/commandline/commandline.rb +137 -0
- data/lib/environment_information/constants/constants.rb +372 -11
- data/lib/environment_information/project/project.rb +1 -1
- data/lib/environment_information/query/constants.rb +46 -0
- data/lib/environment_information/query/help.rb +88 -0
- data/lib/environment_information/query/menu.rb +487 -0
- data/lib/environment_information/query/misc.rb +2006 -0
- data/lib/environment_information/query/query.rb +245 -0
- data/lib/environment_information/query/reset.rb +202 -0
- data/lib/environment_information/query/run.rb +70 -0
- data/lib/environment_information/requires/require_the_environment_information_project.rb +2 -7
- data/lib/environment_information/requires/require_the_toplevel_methods.rb +1 -3
- data/lib/environment_information/toplevel_methods/toplevel_methods.rb +2258 -0
- data/lib/environment_information/version/version.rb +2 -2
- data/lib/environment_information/www/sinatra_interface.rb +20 -17
- data/lib/environment_information/www/webobject_interface.cgi +6 -7
- data/lib/environment_information/yaml/colours.yml +3 -3
- data/lib/environment_information/yaml/query_to_use_for_all_components.yml +284 -0
- data/lib/environment_information/yaml/{array_tracked_programs.yml → track_these_components.yml} +77 -11
- metadata +18 -60
- data/lib/environment_information/class/class.rb +0 -2580
- data/lib/environment_information/class/colours.rb +0 -282
- data/lib/environment_information/colours/sfancy.rb +0 -19
- data/lib/environment_information/colours/simp.rb +0 -19
- data/lib/environment_information/constants/array_tracked_components.rb +0 -210
- data/lib/environment_information/constants/encoding.rb +0 -21
- data/lib/environment_information/constants/error_line.rb +0 -17
- data/lib/environment_information/constants/file_constants.rb +0 -102
- data/lib/environment_information/constants/misc.rb +0 -86
- data/lib/environment_information/constants/namespace.rb +0 -14
- data/lib/environment_information/constants/newline.rb +0 -16
- data/lib/environment_information/constants/regex.rb +0 -30
- data/lib/environment_information/constants/temp_directory.rb +0 -52
- data/lib/environment_information/misc_components/README.md +0 -3
- data/lib/environment_information/misc_components/cflags.rb +0 -36
- data/lib/environment_information/misc_components/cpuinfo.rb +0 -64
- data/lib/environment_information/misc_components/operating_system.rb +0 -54
- data/lib/environment_information/misc_components/operating_system_bit_type.rb +0 -42
- data/lib/environment_information/misc_components/ram.rb +0 -30
- data/lib/environment_information/misc_components/rubygems_installation_directory.rb +0 -54
- data/lib/environment_information/misc_components/screen_resolution.rb +0 -50
- data/lib/environment_information/queries/README.md +0 -2
- data/lib/environment_information/queries/complex_version.rb +0 -273
- data/lib/environment_information/queries/pkg_config.rb +0 -125
- data/lib/environment_information/queries/simple_version.rb +0 -272
- data/lib/environment_information/requires/require_the_individual_misc_components.rb +0 -30
- data/lib/environment_information/toplevel_methods/autogenerate_all_relevant_methods.rb +0 -153
- data/lib/environment_information/toplevel_methods/cd.rb +0 -16
- data/lib/environment_information/toplevel_methods/e.rb +0 -43
- data/lib/environment_information/toplevel_methods/hash.rb +0 -65
- data/lib/environment_information/toplevel_methods/internet_is_available.rb +0 -30
- data/lib/environment_information/toplevel_methods/is_on_roebe.rb +0 -16
- data/lib/environment_information/toplevel_methods/menu.rb +0 -90
- data/lib/environment_information/toplevel_methods/misc.rb +0 -324
- data/lib/environment_information/toplevel_methods/n_subcommands.rb +0 -31
- data/lib/environment_information/toplevel_methods/prefix_to_use.rb +0 -39
- data/lib/environment_information/toplevel_methods/register_this_component_is_missing.rb +0 -61
- data/lib/environment_information/toplevel_methods/remote_url_of_this_program.rb +0 -45
- data/lib/environment_information/toplevel_methods/replay_from_the_stored_file.rb +0 -84
- data/lib/environment_information/toplevel_methods/return_alias_to.rb +0 -30
- data/lib/environment_information/toplevel_methods/return_pkgconfig_based_programs.rb +0 -28
- data/lib/environment_information/toplevel_methods/return_remote_gtk2_version.rb +0 -54
- data/lib/environment_information/toplevel_methods/return_simple_version_based_programs.rb +0 -28
- data/lib/environment_information/toplevel_methods/return_version_of_this_program.rb +0 -182
- data/lib/environment_information/toplevel_methods/show_all_available_components.rb +0 -192
- data/lib/environment_information/toplevel_methods/write_what_into.rb +0 -24
- data/lib/environment_information/yaml/array_default_programs_on_linux.yml +0 -15
- data/lib/environment_information/yaml/array_lfs_core_programs.yml +0 -37
- data/lib/environment_information/yaml/array_science_cluster.yml +0 -12
- data/lib/environment_information/yaml/array_tracked_non_programs.yml +0 -13
- data/lib/environment_information/yaml/array_tracked_xorg_components.yml +0 -37
- data/lib/environment_information/yaml/query_to_use_for_the_individual_components.yml +0 -284
@@ -0,0 +1,487 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# ============================================================================ #
|
5
|
+
# require 'environment_information/query/menu.rb'
|
6
|
+
# ============================================================================ #
|
7
|
+
require 'environment_information/base/base.rb'
|
8
|
+
|
9
|
+
module EnvironmentInformation
|
10
|
+
|
11
|
+
class Query < ::EnvironmentInformation::Base # === EnvironmentInformation::Query
|
12
|
+
|
13
|
+
# ========================================================================== #
|
14
|
+
# === menu (menu tag)
|
15
|
+
#
|
16
|
+
# This method constitutes the "menu" interface for
|
17
|
+
# class EnvironmentInformation::Query.
|
18
|
+
#
|
19
|
+
# It primarily deals with the commandline-given arguments stored in ARGV,
|
20
|
+
# but can also be used as a generic entry point to this class.
|
21
|
+
# ========================================================================== #
|
22
|
+
def menu(
|
23
|
+
i = commandline_arguments?
|
24
|
+
)
|
25
|
+
if i.is_a? Array
|
26
|
+
i.each {|entry| menu(entry) }
|
27
|
+
else
|
28
|
+
case i # case tag
|
29
|
+
# ====================================================================== #
|
30
|
+
# === envi --really-all
|
31
|
+
#
|
32
|
+
# This entry point is for really showing everything.
|
33
|
+
# ====================================================================== #
|
34
|
+
when /^-?-?REALLY(_|-)?ALL$/i,
|
35
|
+
/^-?-?compare(_|-)?program(_|-)?version$/i,
|
36
|
+
/^-?-?compare(_|-)?to(_|-)?program(_|-)?versions$/i,
|
37
|
+
/^-?-?do(_|-)?compare(_|-)?program(_|-)?version$/i,
|
38
|
+
/^-?-?really(_|-)?everything$/i # === envi --really-everything
|
39
|
+
do_compare_the_program_version # First toggle this.
|
40
|
+
clear_old_dataset
|
41
|
+
add_everything
|
42
|
+
# add_default_linux_programs
|
43
|
+
# add_ruby_and_rubygems
|
44
|
+
# do_show_almost_everything_excluding_the_default_linux_programs
|
45
|
+
# ====================================================================== #
|
46
|
+
# === envi --show-all
|
47
|
+
# ====================================================================== #
|
48
|
+
when /^-?-?show(-|_)?all$/i,
|
49
|
+
/^-?-?all$/i,
|
50
|
+
/^-?-?full$/i,
|
51
|
+
/^-?-?everything$/i, # === envi --everything
|
52
|
+
/^-?-?information$/i,
|
53
|
+
'f',
|
54
|
+
'4'
|
55
|
+
do_show_everything # <- Just to be sure.
|
56
|
+
# ====================================================================== #
|
57
|
+
# === envi --show-the-results-at-once
|
58
|
+
# ====================================================================== #
|
59
|
+
when /^-?-?show(-|_)the(-|_)?results(-|_)?at(-|_)?once$/i,
|
60
|
+
/^-?-?insta(-|_)show$/i # === envi --insta-show
|
61
|
+
@internal_hash[:display_the_results_at_once] = true
|
62
|
+
# ====================================================================== #
|
63
|
+
# === envi --do-not-show-the-results-at-once
|
64
|
+
#
|
65
|
+
# This is the slow variant, which is no longer the default as of
|
66
|
+
# April 2024.
|
67
|
+
# ====================================================================== #
|
68
|
+
when /^-?-?do(-|_)not(-|_)show(-|_)the(-|_)?results(-|_)?at(-|_)?once$/i,
|
69
|
+
/^-?-?display(-|_)after(-|_)gathering(-|_)?step$/i,
|
70
|
+
/^-?-?display(-|_)after(-|_)the(-|_)gathering(-|_)?step$/i
|
71
|
+
@internal_hash[:display_the_results_at_once] = false
|
72
|
+
# ====================================================================== #
|
73
|
+
# === envi --sort-alphabetically
|
74
|
+
#
|
75
|
+
# This entry point can also be combined, such as in:
|
76
|
+
#
|
77
|
+
# envi --show-everything --sort-alphabetically
|
78
|
+
#
|
79
|
+
# ====================================================================== #
|
80
|
+
when /^-?-?sort(-|_)?alphabetically$/i,
|
81
|
+
/^-?-?sort$/i,
|
82
|
+
/^-?-?alphabetically$/i,
|
83
|
+
/^-?-?alphabet$/i
|
84
|
+
enable_sort_alphabetically
|
85
|
+
# ====================================================================== #
|
86
|
+
# === envi --nocolours
|
87
|
+
#
|
88
|
+
# This entry point can be used to disable usage of colours.
|
89
|
+
# ====================================================================== #
|
90
|
+
when /^-?-?nocolours/,'2',
|
91
|
+
/^-?-?no(-|_)?colou?rs$/i,
|
92
|
+
/^-?-?nocol$/i,
|
93
|
+
/^-?-?disable(-|_)?colou?rs$/i, # === envi --really-all --disable-colours
|
94
|
+
:disable_colours
|
95
|
+
disable_colours
|
96
|
+
# ====================================================================== #
|
97
|
+
# === envi --disable=
|
98
|
+
#
|
99
|
+
# Invocation example:
|
100
|
+
#
|
101
|
+
# envi --disable=htop,awk,zlib
|
102
|
+
#
|
103
|
+
# ====================================================================== #
|
104
|
+
when /^-?-?disable=(.+)$/i # === envi --disable=htop,awk
|
105
|
+
remove_these_components($1.to_s.dup)
|
106
|
+
# ====================================================================== #
|
107
|
+
# === envi --kdeversions?
|
108
|
+
#
|
109
|
+
# Note that this variant depends on another gem, called "rbt", and
|
110
|
+
# the associated RBT namespace.
|
111
|
+
# ====================================================================== #
|
112
|
+
when /^-?-?kde(_|-)?versions\??$/i,
|
113
|
+
/^-?-?kde\??$/i
|
114
|
+
report_the_installed_KDE_software_suite
|
115
|
+
# ====================================================================== #
|
116
|
+
# === envi --generate-html-file
|
117
|
+
#
|
118
|
+
# This entry point can be used to generate a local .html file.
|
119
|
+
# ====================================================================== #
|
120
|
+
when /^-?-?generate(-|_)?html(-|_)?file$/i,
|
121
|
+
/^-?-?html$/i # envi --HTML
|
122
|
+
do_really_create_a_html_file
|
123
|
+
set_runmode_html # Set it here again, just in case.
|
124
|
+
do_show_everything
|
125
|
+
# ====================================================================== #
|
126
|
+
# === envi --be_silent
|
127
|
+
# ====================================================================== #
|
128
|
+
when /^-?-?be(_|-)?silent$/i # === envi --be-silent
|
129
|
+
do_not_display_the_result
|
130
|
+
do_show_everything
|
131
|
+
# ====================================================================== #
|
132
|
+
# === envi --show-components?
|
133
|
+
# ====================================================================== #
|
134
|
+
when /^-?-?show(-|_)?components\??$/i
|
135
|
+
e "#{true_rev}The following components will be shown on a default run:"
|
136
|
+
e
|
137
|
+
show_these_components?.each {|this_component|
|
138
|
+
if this_component.is_a? Array
|
139
|
+
this_component = this_component.first
|
140
|
+
end
|
141
|
+
e " - #{steelblue(this_component)}#{true_rev}"
|
142
|
+
}
|
143
|
+
e
|
144
|
+
exit
|
145
|
+
# ====================================================================== #
|
146
|
+
# === :do_not_run_yet
|
147
|
+
#
|
148
|
+
# Invocation example:
|
149
|
+
#
|
150
|
+
# envi --do-not-run-yet
|
151
|
+
#
|
152
|
+
# ====================================================================== #
|
153
|
+
when /^-?-?-do(-|_)?not(-|_)?run(-|_)?yet$/i, # === envi --do-not-run-yet
|
154
|
+
:do_not_run_yet,
|
155
|
+
:dont_run_yet,
|
156
|
+
:default # This is the default variant.
|
157
|
+
@run_already = false
|
158
|
+
# ====================================================================== #
|
159
|
+
# === envi --pkgconfig
|
160
|
+
#
|
161
|
+
# Show all pkgconfig entries - but only these.
|
162
|
+
# ====================================================================== #
|
163
|
+
when /^-?-?pkg(-|_)?config$/i
|
164
|
+
clear_old_dataset
|
165
|
+
add(:pkgconfig_entries)
|
166
|
+
# ====================================================================== #
|
167
|
+
# === :do_show_everything
|
168
|
+
#
|
169
|
+
# An alternative way to make use of this entry point is via:
|
170
|
+
#
|
171
|
+
# envi --do-show-everything
|
172
|
+
# envi --show-everything
|
173
|
+
# envi --all
|
174
|
+
#
|
175
|
+
# ====================================================================== #
|
176
|
+
when :do_show_everything,
|
177
|
+
:show_really_everything,
|
178
|
+
/^-?-?do(_|-)?show(_|-)?everything$/i,
|
179
|
+
/^-?-?show(-|_)?everything$/i,
|
180
|
+
/^-?-?show(-|_)?full(-|_)?information$/i,
|
181
|
+
/^-?-?everything$/i,
|
182
|
+
/^-?-?rall$/i,
|
183
|
+
/^-?-?ALL$/i
|
184
|
+
do_show_everything
|
185
|
+
@run_already = true
|
186
|
+
# ====================================================================== #
|
187
|
+
# === envi --n_entries?
|
188
|
+
# ====================================================================== #
|
189
|
+
when /^-?-?n(_|-)?entries\??$/i,
|
190
|
+
/^-?-?n(_|-)?programs\??$/i # envi --nprograms?
|
191
|
+
show_n_registered_entries # === envi --n_entries
|
192
|
+
@internal_hash[:do_exit_the_program] = true
|
193
|
+
# ====================================================================== #
|
194
|
+
# === envi --be_silent_no_colours
|
195
|
+
#
|
196
|
+
# Not sure why the following entry point exists, but I will retain it
|
197
|
+
# for the time being.
|
198
|
+
# ====================================================================== #
|
199
|
+
when /^-?-?be(_|-)?silent(_|-)?no(_|-)?colours$/
|
200
|
+
disable_colours
|
201
|
+
do_not_display_the_result
|
202
|
+
do_show_everything
|
203
|
+
# ====================================================================== #
|
204
|
+
# This entry point is mostly for internal use, e. g. to pass
|
205
|
+
# in Symbols to menu().
|
206
|
+
# ====================================================================== #
|
207
|
+
when :be_silent_no_colours_everything,
|
208
|
+
:be_silent_and_no_colours,
|
209
|
+
:be_silent_no_colours,
|
210
|
+
:full_be_silent
|
211
|
+
disable_colours
|
212
|
+
do_show_everything
|
213
|
+
do_not_display_the_result
|
214
|
+
# ====================================================================== #
|
215
|
+
# === envi noruby
|
216
|
+
# ====================================================================== #
|
217
|
+
when /^-?-?noruby$/i,
|
218
|
+
'show_no_ruby',
|
219
|
+
'classic',
|
220
|
+
'naked',
|
221
|
+
'3',
|
222
|
+
'minimal'
|
223
|
+
show_no_ruby
|
224
|
+
# ====================================================================== #
|
225
|
+
# === envi --xorg-components
|
226
|
+
#
|
227
|
+
# This entry point is for when the user only wants to show the
|
228
|
+
# xorg-components on the local computer system.
|
229
|
+
# ====================================================================== #
|
230
|
+
when /^-?-?xorg(_|-)?components$/i,
|
231
|
+
/^-?-?xorg$/i,
|
232
|
+
/^-?-?show(_|-)?xorg(_|-)?components$/i
|
233
|
+
do_show_only_the_xorg_components
|
234
|
+
# ====================================================================== #
|
235
|
+
# === :be_silent
|
236
|
+
# ====================================================================== #
|
237
|
+
when /^-?-?be(_|-)?silent$/i,
|
238
|
+
:be_silent # We will be silent, but we will still show everything.
|
239
|
+
do_not_display_the_result
|
240
|
+
do_show_everything
|
241
|
+
# ====================================================================== #
|
242
|
+
# === envi --compare_programs
|
243
|
+
#
|
244
|
+
# This entry point allows us to compare the program versions with
|
245
|
+
# the one registered in RBT.
|
246
|
+
# ====================================================================== #
|
247
|
+
when *ARRAY_COMPARE_PROGRAM_VERSIONS
|
248
|
+
do_compare_the_program_version
|
249
|
+
# ====================================================================== #
|
250
|
+
# === envi --work-on-programs-directory-only
|
251
|
+
# ====================================================================== #
|
252
|
+
when /^-?-?work(-|_)?on(-|_)?programs(-|_)?directory(-|_)?only$/i,
|
253
|
+
/^-?-?work(-|_)?on(-|_)?the(-|_)?programs(-|_)?directory(-|_)?only$/i
|
254
|
+
work_on_the_programs_directory_only
|
255
|
+
# ====================================================================== #
|
256
|
+
# === envi --do-save
|
257
|
+
# ====================================================================== #
|
258
|
+
when /^save$/i,
|
259
|
+
/^-?-?do(_|-)?save$/i
|
260
|
+
do_store_the_results_into_local_files
|
261
|
+
# ====================================================================== #
|
262
|
+
# === envi --asciitable
|
263
|
+
# ====================================================================== #
|
264
|
+
when /^-?-?asciitable$/i,
|
265
|
+
'table','1'
|
266
|
+
use_ascii_table if ASCIITABLE_IS_AVAILABLE
|
267
|
+
# ====================================================================== #
|
268
|
+
# === envi --read-from-this-file=/Depot/j/display_these_programs.md
|
269
|
+
# === envi --file=/Depot/j/display_these_programs.md
|
270
|
+
# === envi --input-from=/Depot/j/display_these_programs.md
|
271
|
+
# ====================================================================== #
|
272
|
+
when /^-?-?read(-|_)?from(-|_)?this(-|_)?file=(.+)$/i, # <- And this has $4
|
273
|
+
/^-?-?file=(.+)$/i, # <- This has only $1
|
274
|
+
/^-?-?input(-|_)?from=(.+)$/i # <- This has $2
|
275
|
+
_ = $1.to_s.dup
|
276
|
+
_ = $2.to_s.dup if $2
|
277
|
+
_ = $4.to_s.dup if $4
|
278
|
+
clear_old_dataset
|
279
|
+
set_use_this_as_main_input(
|
280
|
+
load_dataset_from_this_file(_)
|
281
|
+
)
|
282
|
+
# ====================================================================== #
|
283
|
+
# === envi --no-yaml-file
|
284
|
+
# ====================================================================== #
|
285
|
+
when /^-?-?no(-|_)?yaml(-|_)?file$/i,
|
286
|
+
/^-?-?no(-|_)?local(-|_)?file$/i
|
287
|
+
do_store_the_results_into_local_files
|
288
|
+
# ====================================================================== #
|
289
|
+
# === envi --registered-components?
|
290
|
+
# ====================================================================== #
|
291
|
+
when /^-?-?registered(_|-)?components\??$/i,
|
292
|
+
/^-?-?available\??$/i
|
293
|
+
do_not_run_already
|
294
|
+
show_the_registered_components
|
295
|
+
@internal_hash[:do_exit_the_program] = true
|
296
|
+
# ====================================================================== #
|
297
|
+
# === envi --use-these-programs=bash,binutils,bison,yacc,bzip2,coreutils,diff,find,gawk,gcc,grep,gzip,linux,make,m4,patch,perl,python,sed,tar,makeinfo,xz
|
298
|
+
# === envi --use-these-programs=:lfs
|
299
|
+
#
|
300
|
+
# This entry point can be used to display a certain subset of
|
301
|
+
# programs, at the user's discretion.
|
302
|
+
# ====================================================================== #
|
303
|
+
when /^-?-?use(-|_)?these(-|_)?programs=(.+)$/i # === $3
|
304
|
+
# =================================================================== #
|
305
|
+
# First clear (aka reset) the main dataset.
|
306
|
+
# =================================================================== #
|
307
|
+
clear_old_dataset
|
308
|
+
match = $3.to_s.dup
|
309
|
+
add(match)
|
310
|
+
# ====================================================================== #
|
311
|
+
# === envi --show-remote-url
|
312
|
+
#
|
313
|
+
# This entry point will also show the remote URL to the
|
314
|
+
# program at hand.
|
315
|
+
# ====================================================================== #
|
316
|
+
when /^-?-?show(_|-)?remote(_|-)?url$/i
|
317
|
+
do_report_the_remote_urls
|
318
|
+
# ====================================================================== #
|
319
|
+
# === envi --no-save
|
320
|
+
#
|
321
|
+
# Skip saving into a local file through this entry point.
|
322
|
+
#
|
323
|
+
# Invocation example:
|
324
|
+
#
|
325
|
+
# envi --lfs --no-save
|
326
|
+
#
|
327
|
+
# ====================================================================== #
|
328
|
+
when /^-?-?no(_|-)?save$/i
|
329
|
+
do_not_save_anything
|
330
|
+
# ====================================================================== #
|
331
|
+
# === envi --os?
|
332
|
+
# ====================================================================== #
|
333
|
+
when /^-?-?OS\??$/i,
|
334
|
+
/^-?-?show(-|_)?only(-|_)?the(-|_)?operating(-|_)?system$/i
|
335
|
+
do_show_only_the_operating_system
|
336
|
+
show_no_ruby
|
337
|
+
# ====================================================================== #
|
338
|
+
# === envi openssl
|
339
|
+
# ====================================================================== #
|
340
|
+
when /^-?-?openssl$/,
|
341
|
+
/^-?-?ssl$/
|
342
|
+
add(:openssl)
|
343
|
+
# ====================================================================== #
|
344
|
+
# === envi --science
|
345
|
+
# ====================================================================== #
|
346
|
+
when /^-?-?science$/
|
347
|
+
clear_old_dataset
|
348
|
+
add(:science_cluster)
|
349
|
+
# ====================================================================== #
|
350
|
+
# === envi --version
|
351
|
+
# ====================================================================== #
|
352
|
+
when *ARRAY_VERSION
|
353
|
+
report_version
|
354
|
+
# ====================================================================== #
|
355
|
+
# === envi --gui
|
356
|
+
# ====================================================================== #
|
357
|
+
when /^-?-?gui$/i,
|
358
|
+
/^-?-?gtk$/i,
|
359
|
+
/^-?-?start(-|_)?gtk$/i
|
360
|
+
start_gtk_component
|
361
|
+
# ====================================================================== #
|
362
|
+
# === envi --replay
|
363
|
+
# ====================================================================== #
|
364
|
+
when /^-?-?replay$/i
|
365
|
+
::EnvironmentInformation.replay_from_the_stored_file
|
366
|
+
# ====================================================================== #
|
367
|
+
# === envi --additional=php
|
368
|
+
#
|
369
|
+
# This entry point allows us to show additional programs.
|
370
|
+
#
|
371
|
+
# Another usage example:
|
372
|
+
#
|
373
|
+
# envi --additional=php,python,perl
|
374
|
+
#
|
375
|
+
# ====================================================================== #
|
376
|
+
when /^-?-?additional=(.+)$/i,
|
377
|
+
/^-?-?add=(.+)$/i
|
378
|
+
_ = $1.to_s.dup
|
379
|
+
add(_)
|
380
|
+
# ====================================================================== #
|
381
|
+
# === envi --use-colours?
|
382
|
+
# ====================================================================== #
|
383
|
+
when /^-?-?use(-|_)?colou?rs\??$/i
|
384
|
+
e 'Will colours be used? '+
|
385
|
+
::EnvironmentInformation.verbose_truth(
|
386
|
+
::EnvironmentInformation.use_colours?.to_s
|
387
|
+
)
|
388
|
+
do_not_run
|
389
|
+
@internal_hash[:do_exit_the_program] = true
|
390
|
+
# ====================================================================== #
|
391
|
+
# === envi --short
|
392
|
+
# ====================================================================== #
|
393
|
+
when /^-?-?short$/i,
|
394
|
+
/^-?-?display(-|_)?short(-|_)?format$/i,
|
395
|
+
/^-?-?do(-|_)?display(-|_)?in(-|_)?a(-|_)?short(-|_)?format$/i
|
396
|
+
do_display_in_a_short_format
|
397
|
+
# ====================================================================== #
|
398
|
+
# === envi --one-liner
|
399
|
+
#
|
400
|
+
# A more complex usage example may be this:
|
401
|
+
#
|
402
|
+
# envi --rall --oneliner
|
403
|
+
#
|
404
|
+
# ====================================================================== #
|
405
|
+
when /^-?-?one(-|_)?liner$/i # === envi --oneliner
|
406
|
+
@internal_hash[:use_one_line_to_show_the_result] = true # This is different to the short-format.
|
407
|
+
# ====================================================================== #
|
408
|
+
# === envi --sinatra
|
409
|
+
# ====================================================================== #
|
410
|
+
when /^-?-?sinatra$/i,
|
411
|
+
/^-?-?www$/i
|
412
|
+
start_the_sinatra_interface
|
413
|
+
# ====================================================================== #
|
414
|
+
# === envi --open
|
415
|
+
# ====================================================================== #
|
416
|
+
when /^-?-?open$/i,
|
417
|
+
/^-?-?edit$/i
|
418
|
+
open_this_file_in_editor
|
419
|
+
# ====================================================================== #
|
420
|
+
# === envi --lfs
|
421
|
+
# ====================================================================== #
|
422
|
+
when /^-?-?lfs$/i,
|
423
|
+
/^-?-?lfs(_|-)?core(_|-)?programs$/i
|
424
|
+
clear_old_dataset
|
425
|
+
add(:lfs_core_programs)
|
426
|
+
# ====================================================================== #
|
427
|
+
# === envi --clear
|
428
|
+
#
|
429
|
+
# This entry point will simply clear the old dataset.
|
430
|
+
#
|
431
|
+
# This can be used to only display a few components, such as:
|
432
|
+
#
|
433
|
+
# envi --clear --python --ruby --perl
|
434
|
+
#
|
435
|
+
# ====================================================================== #
|
436
|
+
when /^-?-?clear$/i,
|
437
|
+
/^-?-?clear(_|-)?old(_|-)?dataset$/i
|
438
|
+
clear_old_dataset
|
439
|
+
# ====================================================================== #
|
440
|
+
# === envi --assign_components_for_the_short_format
|
441
|
+
# ====================================================================== #
|
442
|
+
when /^-?-?assign(_|-)?components(_|-)?for(_|-)?the(_|-)?short(_|-)?format$/i
|
443
|
+
assign_components_for_the_short_format
|
444
|
+
# ====================================================================== #
|
445
|
+
# === envi --help
|
446
|
+
# ====================================================================== #
|
447
|
+
when /^-?-?help$/i
|
448
|
+
show_help
|
449
|
+
exit
|
450
|
+
else # else tag
|
451
|
+
# =================================================================== #
|
452
|
+
# It is better to report that the given commandline-input as
|
453
|
+
# not found, so this will be reported. Before we can do so, we
|
454
|
+
# will first check whether the user wanted to pass some
|
455
|
+
# existing/registered component nonetheless.
|
456
|
+
#
|
457
|
+
# This clause can be checked via something like this:
|
458
|
+
#
|
459
|
+
# envi --bash
|
460
|
+
# envi --brotli
|
461
|
+
#
|
462
|
+
# =================================================================== #
|
463
|
+
if is_a_registered_component?(i.delete('-'))
|
464
|
+
# ==================================================================== #
|
465
|
+
# The next line has been added in August 2022. Not sure if we
|
466
|
+
# retain it or not - either way the future will show.
|
467
|
+
# ==================================================================== #
|
468
|
+
clear_the_main_hash # Clear the old result first.
|
469
|
+
do_not_store_anything
|
470
|
+
add(
|
471
|
+
i.delete('-')
|
472
|
+
)
|
473
|
+
else
|
474
|
+
# ==================================================================== #
|
475
|
+
# Only enter the report-section if we do NOT want to exit early.
|
476
|
+
# ==================================================================== #
|
477
|
+
# Or:
|
478
|
+
# e 'Unhandled command input (in file environment_information/class/menu.rb): '
|
479
|
+
# e
|
480
|
+
# e " #{sfancy(i)}"
|
481
|
+
# e
|
482
|
+
end
|
483
|
+
end
|
484
|
+
end
|
485
|
+
end
|
486
|
+
|
487
|
+
end; end
|