Class: Roebe::Shell::DocumentedHelpOptions
- Defined in:
- lib/roebe/shell/help/documented_help_options.rb
Overview
Roebe::Shell::DocumentedHelpOptions
Constant Summary collapse
- N =
"\n"
- ARRAY_DOCUMENTED_HELP_OPTIONS =
#
ARRAY_DOCUMENTED_HELP_OPTIONS
The following help-options are documented.
You can invoke them via a leading ‘?’ character.
#
%w( ?become ?clear ?downcase ?grabc ?in ?rf ?show_task ?slogan? ?symlink ?system_checker ?show-docu ?show-method ?title ?touch ?windows ).map {|entry| entry.prepend('?') unless entry.start_with? '?' entry }
Class Method Summary collapse
-
.[](i) ⇒ Object
# === Roebe::Shell::DocumentedHelpOptions[].
-
.array_documented_help_options ⇒ Object
# === Roebe::Shell::DocumentedHelpOptions.array_documented_help_options ========================================================================= #.
-
.documented_help_options? ⇒ Boolean
# === Roebe::Shell::DocumentedHelpOptions.documented_help_options? ========================================================================= #.
-
.e(i = '') ⇒ Object
# === Roebe::Shell::DocumentedHelpOptions ========================================================================= #.
-
.ecap(i = '') ⇒ Object
# === Roebe::Shell::DocumentedHelpOptions.ecap.
-
.keys? ⇒ Boolean
# === Roebe::Shell::DocumentedHelpOptions.keys? ========================================================================= #.
-
.report_not_a_documented_option(i) ⇒ Object
# === Roebe::Shell::DocumentedHelpOptions.report_not_a_documented_option.
Class Method Details
.[](i) ⇒ Object
#
Roebe::Shell::DocumentedHelpOptions[]
The options in the following case-menu are “extra” documented options.
All other options will be handled in the else-clause.
#
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/roebe/shell/help/documented_help_options.rb', line 126 def self.[](i) this_key = i.to_s.delete('?') header = N+::Roebe.simp(' => ') case this_key # case tag # ======================================================================= # # === become # ======================================================================= # when 'become' ecap header+'become another superuser, that is, use another name for '\ 'the main account.' # ======================================================================= # # === clear # ======================================================================= # when 'clear' ecap header+'This method can be used to the (Xorg) buffer - for instance, do:' e e ' clear buffer' e e 'You can also "clear aliases" or "clear history".' e e ' clear screen' e e 'Also exists and will clear the screen.' # ======================================================================= # # === downcase # ======================================================================= # when 'downcase' ecap header+'downcase all files in the current directory' # ======================================================================= # # === grabc # ======================================================================= # when 'grabc' ecap header+'Use "grabc" to grab the colour code from a pixel '\ 'on the screen.'+N ecap header+'Simply click on the target pixel - the colour code will '\ 'then be displayed.' # ======================================================================= # # === rf # ======================================================================= # when 'rf' ecap header+'to open a local or remote page as in "rf map"' # ======================================================================= # # === touch (touch tag) # ======================================================================= # when 'touch' ecap header+'Use the "touch" command to create a new file.'+N ecap header+'You can also create several files in one go:' e ecap ' touch {foo,bar}' # ======================================================================= # # === in # ======================================================================= # when 'in' ecap header+'Usage examples are:' ecap header+' in 7 stunden trigger wecker' # ======================================================================= # # === show_task # ======================================================================= # when /show_?task/ ecap header+'to show some tasks (things todo or to read).' # ======================================================================= # # === slogan? # ======================================================================= # when 'slogan?' ecap 'to get the last slogan.' # ======================================================================= # # === show-method # ======================================================================= # when /show(-|_)?method/ ecap 'to show the method of a ruby method.' # ======================================================================= # # === title # ======================================================================= # when 'title' e header+'<name> to set name of the konsole tab' # ======================================================================= # # === tinyurl # ======================================================================= # when 'tinyurl' e header+'<url> to turn a "normal" url to a shorter tinyurl' # ======================================================================= # # === totarbz2 # ======================================================================= # when 'totarbz2','totarxz' e header+'totarx / totarbz2 <dir> to create a .tar.xz or '+ 'a .tar.bz2 archive' # ======================================================================= # # === windows # ======================================================================= # when 'windows' e 'You can install some windows-addons via:' e e sfancy(' update windows') else # else look at all other registered options. (else tag) # ===================================================================== # # For this to work, we must have properly initialized # the dataset obtained from the help menu. # ===================================================================== # if Roebe::Shell..include? i result = Roebe::Shell.[i] # =================================================================== # # We have to modify result a little because it may include # substrings such as '|shot|'. # =================================================================== # result = Roebe::Shell::ColourizedHelpLine[result].result? ecap header+result # header is defined at the start of this method. end end end |
.array_documented_help_options ⇒ Object
#
Roebe::Shell::DocumentedHelpOptions.array_documented_help_options
#
67 68 69 |
# File 'lib/roebe/shell/help/documented_help_options.rb', line 67 def self. ARRAY_DOCUMENTED_HELP_OPTIONS end |
.documented_help_options? ⇒ Boolean
#
Roebe::Shell::DocumentedHelpOptions.documented_help_options?
#
60 61 62 |
# File 'lib/roebe/shell/help/documented_help_options.rb', line 60 def self. Roebe::Shell. end |
.e(i = '') ⇒ Object
#
Roebe::Shell::DocumentedHelpOptions
#
30 31 32 |
# File 'lib/roebe/shell/help/documented_help_options.rb', line 30 def self.e(i = '') puts i end |
.ecap(i = '') ⇒ Object
#
Roebe::Shell::DocumentedHelpOptions.ecap
Simplified output for the documented help options.
This will simply capitalize the first character.
#
106 107 108 |
# File 'lib/roebe/shell/help/documented_help_options.rb', line 106 def self.ecap(i = '') Roebe::Shell.ecap(i) end |
.keys? ⇒ Boolean
#
Roebe::Shell::DocumentedHelpOptions.keys?
#
113 114 115 116 117 |
# File 'lib/roebe/shell/help/documented_help_options.rb', line 113 def self.keys? _ = Roebe::Shell. _ = _.keys if _.is_a? Hash (_ + Roebe::Shell.).flatten end |
.report_not_a_documented_option(i) ⇒ Object
#
Roebe::Shell::DocumentedHelpOptions.report_not_a_documented_option
Report to the user (or to me) if an option has not been documented yet.
#
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/roebe/shell/help/documented_help_options.rb', line 40 def self.report_not_a_documented_option(i) e 'This command (`'+ ::Colours.simp(i)+'`) either does not exist or has '\ 'not been documented.' if ::Roebe.is_on_roebe? e e 'The available help options are:' e pp Roebe::Shell::DocumentedHelpOptions. e e 'If you wish to extend this menu, have a look at the '\ 'file '+::Colours.sfile('help/help_menu.rb')+'.' # Tell the user where to find this. cliner # pp Roebe::Shell.hash_help_options # <-- No longer in use since Dec 2015. end end |