mysh 0.2.7 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bceb539dd8a9fe46587018141691e37cbb6b71fa
4
- data.tar.gz: cb7f62b68e30efe7589670f14a3bbeab072aca64
3
+ metadata.gz: e859f5e9fd3f2d6d4e88de719444088195e2d1e0
4
+ data.tar.gz: e2eb0dacb82603274b4511a7b6f72f366230649e
5
5
  SHA512:
6
- metadata.gz: af00b483a5f61b429b70dbd843660e17c6176b10b2172abb749b1ca4432299954e2ac818b6b99c3a0158874e17ee038f9203e0b5db888174c27c1629f3d9c843
7
- data.tar.gz: 2707296e56b968dc1495e1ba11e476ed6aa5463561bded59eda61de83dfb022aa006dced3ab7665216cb2ac0ace3fa90ae886c882ba303604b52d6bc07abc1d7
6
+ metadata.gz: 09493f5a93d52dbe8812cbf01c7cf3418fb0f2c627935f258b86b4819ee874ce986453eb5a43c98b67da911fc95ee39062dde4795c1d2fe4db86b394702c21cf
7
+ data.tar.gz: abde27a389011b5175a46579c5878a4e514a6906d178893df5623f9df4cbbbecf1b496e3acf315ca0bf661d1299c6b89683075863437ad81d458ee84b174c7ef
data/README.md CHANGED
@@ -8,26 +8,23 @@ Inspired by the excellent article "Writing a Shell in 25 Lines of Ruby Code"
8
8
  I thought it would be fun to experiment with that concept and see if it could
9
9
  be taken further.
10
10
 
11
- Many years ago, a popular shell program was modeled after
12
- the 'C' programming language. It went by the name csh for C-shell (by the C
13
- shore :-) Instead of 'C', my shell would be based on Ruby (were you shocked?)!
14
- The obvious name rsh for Ruby-shell was already in use by the Remote-shell. So,
15
- given the limited scope of this effort, and not wanting to do a lot of typing
16
- all the time, I chose the name mysh for MY-SHell.
11
+ Many years ago, a popular shell program was modeled after the 'C' programming
12
+ language. It went by the name csh for C-shell (by the C shore :-) Instead of
13
+ 'C', my shell would be based on Ruby (were you shocked?)! The obvious name rsh
14
+ for Ruby-shell was already in use by the Remote-shell. So, given the limited
15
+ scope of this effort, and not wanting to do a lot of typing all the time, I
16
+ chose the name mysh for MY-SHell.
17
17
 
18
18
  Since that name was available, it would seem that no one had yet written a
19
19
  shell program at this level of narcissism.
20
20
 
21
21
  The mysh is available as both a stand-alone CLI program and for use as a
22
- command shell within Ruby applications and (eventually) Rails web sites.
22
+ command shell within Ruby applications and (maybe? eventually? someday?) Rails
23
+ web sites.
23
24
 
24
25
  See the original article at:
25
26
  (http://www.blackbytes.info/2016/07/writing-a-shell-in-ruby/)
26
27
 
27
- By the way. The briefest look at the code will reveal that mysh has grown to be
28
- way more than 25 lines long. As Thomas Edison once said: 1% inspiration, 99%
29
- perspiration. Enjoy!
30
-
31
28
  ## Installation
32
29
 
33
30
  Add this line to your application's Gemfile:
@@ -46,33 +43,304 @@ Or install it yourself as:
46
43
 
47
44
  ## Usage
48
45
 
49
- The mysh gem includes a simple executable called mysh. Command entry is a
50
- typical cli. For more information, see the mini_readline gem at
51
- ( https://github.com/PeterCamilleri/mini_readline )
46
+ The mysh gem includes a simple executable called mysh. The template for running
47
+ the mysh is:
48
+
49
+ ```
50
+ mysh <args>
51
+ ```
52
+
53
+ Where args are currently a work in progress and not available at this time.
52
54
 
53
- When running mysh, the user is presented with a command prompt:
55
+ When mysh is run, the user is presented with a command prompt:
54
56
 
55
57
  ```
56
58
  $ mysh
59
+ /cygdrive/c/Sites/mysh
57
60
  mysh>
61
+
62
+ ```
63
+ Now the user (that's you) may enter commands that hopefully increase the level
64
+ of awesome coolness in the known universe. Entropy does not take vacations so
65
+ hop to it! :-)
66
+
67
+ ###REPL
68
+
69
+ Now for a little more detail. The mysh program is built around a design pattern
70
+ called REPL. This stands for Read Eval Print and Loop and is used in may
71
+ utilities like irb, pry and the rails console. To better use mysh, it is good
72
+ to understand each of these four operating steps.
73
+
74
+ ####READ
75
+
76
+ The first step is just to get input from the user. For interactive sessions
77
+ this is done using the mini_readline gem. The user is prompted and input is
78
+ obtained. There is a twist here. Just what constitutes a unit of input?
79
+ Normally an input is one line entered by the user. Like this:
80
+
81
+ ```
82
+ mysh> ls *.rb
83
+ ```
84
+ In mysh, the user is able to chain together multiple lines and have them
85
+ treated as a single input. So for the following scenario:
58
86
  ```
87
+ mysh>line one\
88
+ mysh\line two\
89
+ mysh\line three
90
+ ```
91
+ The input string will be:
92
+ ```
93
+ "line one\nline two\nline three\n"
94
+ ```
95
+ Note that while the prompt is user configurable, it will always end with '>'
96
+ for the initial line and '\\' for subsequent lines.
97
+
98
+ For more information about the mini_readline gem please see
99
+ https://github.com/PeterCamilleri/mini_readline or
100
+ https://rubygems.org/gems/mini_readline
101
+
102
+ ####EVAL
103
+
104
+ Once input has been obtained from the user, that input is then evaluated. This
105
+ evaluation has two phases: pre-processing and processing.
106
+
107
+ #####Input Preprocessing
108
+
109
+ During pre-processing, the input is scanned for macro-like substitutions that
110
+ have been placed into the input. There are three steps to this phase:
111
+
112
+ 1. Replacing mysh variables with their values. This process is recursive in
113
+ that these variables also undergo the full pre-processing treatment before
114
+ being inserted into the user command.
115
+ 2. Replacing embedded ruby "handlebars" with the results of their execution.
116
+ 3. Replacing '\\{' and '\\}' with '{' and '}' respectively.
117
+
118
+ #####Command Processing
119
+
120
+ Once input has been obtained and massaged adequately, it's time to actually
121
+ do some work. In mysh there is a hierarchy of four types of commands. These
122
+ command types serve as a simple command path for determining what action is to
123
+ be taken for the input. The four types are:
124
+
125
+ 1. Quick Commands - These commands are recognized by having a signature first
126
+ character in the input. These signature characters are:
127
+ * ! to access the mysh command history buffer. For more information see
128
+ Command History below.
129
+ * $ to access or update mysh variables. For more information see Shell
130
+ Variables below.
131
+ * = to evaluate an expression of Ruby code. For more information see Ruby
132
+ Expressions below.
133
+ * ? to access the mysh help subsystem. For more information see Shell Help
134
+ below.
135
+ * @ to get information about the system, its environment, and the ruby
136
+ installation. For more information see Shell Info below.
137
+
138
+ 2. Internal Commands - These commands are recognized by having the first word
139
+ in the input match a word stored in an internal hash of command actions. For
140
+ more information see Interanl Commands below.
141
+ 3. External Ruby Commands - These commands are recognized by having the first
142
+ word in the input have the extension (*.rb) of a ruby source file. For more
143
+ information see External Ruby Commands below.
144
+ 4. External Commands - Any command not matching any of the above is sent to the
145
+ system shell for execution. For more information see External Commands below.
146
+
147
+ Notes:
148
+ * The recursive pre-processing steps have checks on them to detect loops and
149
+ other forms of bad behavior before they do nasty things like blow up the stack.
150
+ * The mysh variables are also used to control many aspects of the mysh and are
151
+ covered in their own section below.
152
+ * The embedded ruby "handlebars" also get their own section below.
153
+
154
+ ####PRINT
155
+
156
+ Once the command is run, some results are expected most of the time. For Ruby
157
+ expressions, this is handled by the pretty print gem. The 'pp' function is
158
+ given the value returned by the expression just evaluated. For other types
159
+ of command, the command itself generates any required output.
160
+
161
+ To assist in the creation of well formatted output, the mysh environment
162
+ provides a number of "helper" methods in the Array and String classes. These
163
+ are:
164
+
165
+ * String#decorate - given a string with a file path/name value, express that
166
+ string in a manner compatible with the current operating environment.
167
+ * Array#format_mysh_columns - take an array and convert it to a string with nice
168
+ regular columns.
169
+ * Array#puts_mysh_columns - as above, but print the string.
170
+ * Array#format_mysh_bullets - take an array and convert it to a string with nice
171
+ bullet points. The appearance of each point depends on its structure. See below:
172
+ * Array#puts_mysh_bullets - as above, but print the string.
173
+
174
+ This must all be confusing. Some examples may help:
175
+
176
+ ```
177
+ mysh>=puts "lib/mysh/expression/lineage.rb".decorate
178
+ lib\mysh\expression\lineage.rb
179
+
180
+ mysh>=(1..100).to_a.puts_mysh_columns
181
+ 1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93 97
182
+ 2 6 10 14 18 22 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 86 90 94 98
183
+ 3 7 11 15 19 23 27 31 35 39 43 47 51 55 59 63 67 71 75 79 83 87 91 95 99
184
+ 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100
185
+
186
+ mysh>=["foo", "bar "*30, "some "*25, "stuff"].puts_mysh_bullets
187
+ * foo
188
+ * bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar
189
+ bar bar bar bar bar bar bar bar bar bar bar
190
+ * some some some some some some some some some some some some some some some
191
+ some some some some some some some some some some
192
+ * stuff
193
+
194
+ mysh>=[["foo", "bar "*20], ["sna", "foo young "*10 ] ].puts_mysh_bullets
195
+ foo bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar
196
+ bar bar
197
+ sna foo young foo young foo young foo young foo young foo young foo young foo
198
+ young foo young foo young
199
+
200
+ mysh>=[["foo", 1,2,3]].puts_mysh_bullets
201
+ foo 1
202
+ 2
203
+ 3
204
+
205
+ mysh>=[[(1..100).to_a]].puts_mysh_bullets
206
+ * 1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93 97
207
+ 2 6 10 14 18 22 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 86 90 94 98
208
+ 3 7 11 15 19 23 27 31 35 39 43 47 51 55 59 63 67 71 75 79 83 87 91 95 99
209
+ 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100
210
+
211
+ mysh>=[["foo", (1..100).to_a], ["baz", "yes"]].puts_mysh_bullets
212
+ foo 1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93 97
213
+ 2 6 10 14 18 22 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 86 90 94 98
214
+ 3 7 11 15 19 23 27 31 35 39 43 47 51 55 59 63 67 71 75 79 83 87 91 95 99
215
+ 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100
216
+ baz yes
217
+
218
+ ```
219
+
220
+
221
+ ####LOOP
222
+
223
+ The processing of input continues (looping) until it doesn't. This occurs when
224
+ a command to stop looping is entered or the mini_readline gem signals
225
+ end-of-input condition. The commands that do this are:
226
+
227
+ * exit - exit the current mysh level.
228
+ * quit - terminate the mysh program.
229
+
230
+ Work-in-progress - mysh only has one level at this time so these two commands
231
+ do exactly the same thing... for now!
232
+
233
+ An end-of-input condition is signaled by the user by entering Ctrl-z (in
234
+ windows) or Alt-z (in Linux/Mac). See the mini_readline gem (link above) for
235
+ more information on the keyboard mappings used by mysh.
236
+
237
+ ### Handlebars
238
+
239
+ In mysh, it is possible to embed snippets of ruby into text files, in shell
240
+ variables or on the command line through the use of handlebars. Handlebars
241
+ look like this:
242
+
243
+ {{ code goes here }}
244
+
245
+ Lets see a simple example of putting the result of a calculation into the
246
+ command line:
247
+
248
+ mysh>echo {{ (1..10).map {|i| i.to_s}.join(" ") }} > foo.txt
249
+ mysh>type foo.txt
250
+ 1 2 3 4 5 6 7 8 9 10
251
+
252
+ Handlebars work by evaluating the ruby code within the {{ }} sequence in
253
+ the appropriate execution environment. For the command line, this is the same
254
+ environment used for the '=' quick execution command. For example:
59
255
 
60
- Then start entering some commands! This prompt can be used to execute four
61
- sorts of commands:
256
+ mysh>=a="A very long string indeed!"
257
+ "A very long string indeed!"
258
+ mysh>echo {{ a }}
259
+ A very long string indeed!
62
260
 
63
- * Ruby expressions, which are preceded by the equal (=) sign.
64
- * Internal commands that are processed directly by mysh
65
- * External ruby source files that are passed on to the Ruby interpreter.
66
- * External commands that are passed on to the standard command shell.
261
+ The value returned by expression is coverted to a string (if needed) and then
262
+ inserted in place of the handlebar expression. There are, however, times when
263
+ it is not desired to insert anything in the place of the code snippet. For
264
+ those cases, simply end the expression with a '#' character. For example:
67
265
 
68
- #### Ruby expressions:
266
+ mysh>echo {{ "not embedded" #}}{{ "embedded" }}
267
+ embedded
268
+
269
+ Finally, it may be that it is desired to embed braces into a text file or
270
+ the command line. In that case precede the brace with a backslash character
271
+ like: \{ or \}
272
+
273
+ ### Command History
274
+
275
+ The history (or !) command is used to allow the user greater control over the
276
+ history of commands that have been entered. The action taken by the history
277
+ command is controlled by an optional parameter.
278
+
279
+ If the longer form, show is used, a space is required before the parameter. If
280
+ the quick form, ! is used, the space is optional.
281
+
282
+ Quick Form | Long Form | Command Description
283
+ -----------|--------------|--------------------------------
284
+ ! | history | Display the entire history buffer.
285
+ !5 | history 5 | Retrieve history entry 5 and present this to the user as the next command.
286
+ !clear | history clear| Clear the command history.
287
+
288
+ ### Shell Variables
289
+
290
+ In mysh, variables are kept that control the behavior of the shell. This simple
291
+ command is used to set, delete, and display these variables. The basic method
292
+ for setting a variable is:
293
+
294
+ $name=value
295
+
296
+ Where:
297
+ * name is a word matching the regex: /[a-z][a-z0-9_]*/. Lower case only.
298
+ * value is a string, with embedded variables and handlebars.
299
+
300
+ To erase the value of a variable, use:
301
+
302
+ $name=
303
+
304
+ To display the name/value of a variable, use:
305
+
306
+ $name
307
+
308
+ To display all variable names/values use:
309
+
310
+ $
311
+
312
+ As an escapement, the string $$ maps to a single $.
313
+
314
+ Some variables that are used in mysh are:
315
+
316
+ Variable | Description
317
+ ------------|--------------------------------------------
318
+ $d | The current date.
319
+ $date_fmt | The format for the date: "%Y-%m-%d"
320
+ $debug | Does the shell display additional debugging info (true/false)
321
+ $h | The home folder's path
322
+ $post_prompt| The prompt used when a line is continued with a trailing \\ character.
323
+ $pre_prompt | A prompt string displayed before the actual command prompt. Delete the pre_prompt variable to disable pre-prompting.
324
+ $prompt | The user prompt.
325
+ $t | The current time.
326
+ $time_fmt | The format for the time: "%H:%M"
327
+ $u | The current user.
328
+ $w | The current working directory's path.
329
+
330
+
331
+
332
+ ### Ruby Expressions:
333
+
334
+ In mysh, ruby code may be executed at any time from command prompt. This allows
335
+ the mysh command line to serve as a programming, debugging and super-calculator
336
+ environment. Just a few reminders:
69
337
 
70
338
  * Any line beginning with an equals "=" sign will be evaluated as a Ruby
71
- expression. This allows the mysh command line to serve as a programming,
72
- debugging and super-calculator environment.
339
+ expression.
73
340
  * Expressions ending with a backslash character "\" are continued on the next
74
- line. The prompt changes to "mysh\" to indicate that this is going on.
75
- * The results are displayed using the pretty-print facility.
341
+ line. The prompt changes to end with a "\" character to indicate that this is
342
+ going on.
343
+ * The results of the expression are displayed using the pretty-print facility.
76
344
  * Auto-complete always places any file names in quotes so they can be used
77
345
  as string parameters.
78
346
 
@@ -95,14 +363,11 @@ mysh>=a.lineage
95
363
  mysh>=reset
96
364
 
97
365
  mysh>=a
98
- NameError: undefined local variable or method `a' for #<#<Class:0x1c57a10>:0x1c57938>
366
+ NameError: undefined local variable or method `a' for exec_host:#<Class:0x1ba8720>
99
367
  mysh>=result
100
368
 
101
369
  mysh>
102
370
  ```
103
-
104
-
105
-
106
371
  The Ruby expression execution environment has direct access to many advanced
107
372
  Math functions. For example, to compute the cosine of 3.141592653589793 use:
108
373
  ```
@@ -144,72 +409,128 @@ tanh(x) |Float |The hyperbolic tangent of x (in radians).
144
409
  E |Float |The value e (2.718281828459045)
145
410
  PI |Float |The value &#960; (3.141592653589793)
146
411
 
147
- #### Internal mysh commands:
148
-
149
- Internal commands are recognized by name and are executed by mysh directly.
412
+ ### Shell Help
150
413
 
151
- The following set of commands are supported:
152
-
153
- ```
154
- !<index> Display the mysh command history, or if an index is specified,
155
- retrieve the command with that index value.
156
- ?<topic> Display help information for mysh with an optional topic.
157
- @<item> Display information about a part of mysh. See ?@ for more.
158
- cd <dir> Change directory to the optional <dir> parameter and then
159
- display the current working directory.
160
- exit Exit mysh.
161
- gls <-l> <mask> Display the loaded ruby gems. See ?gls for more.
162
- help <topic> Display help information for mysh with an optional topic.
163
- history <index> Display the mysh command history, or if an index is specified,
164
- retrieve the command with that index value.
165
- pwd Display the current working directory.
166
- quit Exit mysh.
167
- show <item> Display information about a part of mysh. See ?@ for more.
168
- type Display a text file with optional embedded handlebars.
169
- vls <mask> Display the loaded modules, matching the optional mask, that
170
- have version info.
171
- ```
172
- Of note is the command "help help" or "??" which provides a list of all
173
- available help topics.
414
+ The help (or ?) command is used to get either general help about mysh or an
415
+ optional specified topic. If the longer form, help is used, a space is required
416
+ before the topic. If the quick form, ? is used, the space is optional. Of note
417
+ is the command "help help" or "??" which provides a list of all available help
418
+ topics. These are:
419
+
420
+ Topic | Description
421
+ -----------|----------------------------------------------------
422
+ | General help on mysh.
423
+ ! | Help on the history command.
424
+ $ | Help on mysh variables.
425
+ = | Help on ruby expressions.
426
+ ? | This help on the help command.
427
+ @ | Help on the show command.
428
+ env | Help on the show env command.
429
+ gls | Help on gls internal mysh command.
430
+ help | This help on the help command.
431
+ history | Help on the history command.
432
+ kbd | Help on mysh keyboard mapping.
433
+ math | Help on math functions.
434
+ quick | Help on quick commands.
435
+ ruby | Help on the show ruby command.
436
+ show | Help on the show command.
437
+ {{ | Help on mysh handlebars.
438
+
439
+
440
+ ### Shell Info
441
+
442
+ The show (or @) command is used to inspect various aspects of the mysh
443
+ environment specified by the item parameter. If the longer form, show is used,
444
+ a space is required before the topic. If the quick form, @ is used, the space
445
+ is optional. Currently, mysh supports two areas on inquiry: the environment and
446
+ ruby:
447
+
448
+ ##### Environment (@env)
449
+
450
+ This command displays useful information about the current operating
451
+ environment.
452
+
453
+ Topic | Description
454
+ ---------|----------------------------------------------------
455
+ user | The current user name.
456
+ home | The current home directory.
457
+ name | The path/name of the mysh program currently executing.
458
+ shell | The path/name of the system command shell.
459
+ host | The name of the host computer.
460
+ os | The current operating system.
461
+ platform | The operating platform detected by the low-level terminal gem.
462
+ java | Is the current platform powered by Java?
463
+ term | What terminal is defined by the system, if one is defined.
464
+ disp | What display is defined by the system, if one is defined.
465
+ edit | What editor is defined by the system, if one is defined.
466
+ path | An easy-to-read, formatted version of the current search path.
467
+
468
+
469
+ ##### Ruby (@ruby)
470
+
471
+ This command displays useful information about the currently running ruby
472
+ language system.
473
+
474
+ Topic | Description
475
+ ------------|----------------------------------------------------
476
+ location | The path/name of the current ruby interpreter.
477
+ description | A comprehensive summary of the version and other such data.
478
+ version | The version of ruby.
479
+ patch | Its patch level.
480
+ revision | Its revision level.
481
+ date | The date of its release.
482
+ platform | The target platform.
483
+ copyright | The legal ownership of the software.
484
+ engine | The internal engine in the software.
485
+ host | A summary of the host operating environment.
486
+ host cpu | A (crude) approximation of the installed cpu.
487
+ host os | The current operating system.
488
+ host vendor | The current environment vendor/genre.
489
+ $: | An easy-to-read, formatted version of $: or the ruby search path.
490
+
491
+
492
+ ### Internal Shell Commands:
493
+
494
+ Internal commands are recognized by name and are executed by mysh directly. The
495
+ complete list of internal commands is given in the default help command ("?").
496
+ Some commands, not already covered in other sections include:
497
+
498
+ Command | Description
499
+ ---------------|----------------------------------------------------
500
+ cd {dir} | Change directory to the optional dir parameter and then display the current working directory.
501
+ exit | Exit mysh.
502
+ gls {-l} {mask}| Display the loaded ruby gems. Use optional -l for a more details and a mask to limit output.
503
+ history {index}| Display the mysh command history, or if an index is specified, retrieve the command with that index value.
504
+ pwd | Display the current working directory.
505
+ quit | Exit mysh.
506
+ type | Display a text file with optional embedded handlebars.
507
+ vls {mask} | Display the loaded modules, matching the optional mask, that have version info.
508
+
509
+ ### External Ruby Commands
510
+
511
+ Any command that ends with a ".rb" extension will be sent as the target of the
512
+ ruby interpreter. So for example, let's run the test.rb file located in the
513
+ samples folder:
174
514
 
175
515
  ```
176
- Help: mysh help command summary:
177
-
178
- The help (or ?) command is used to get either general help about mysh or an
179
- optional specified topic.
180
-
181
- If the longer form, help is used, a space is required before the topic. If the
182
- quick form, ? is used, the space is optional.
183
-
184
- The available help topics are:
185
-
186
- General help on mysh.
187
- ! This help on the history command.
188
- = Help on ruby expressions.
189
- ? This help on the help command.
190
- @ Help on the show command.
191
- env Help on the show env command.
192
- gls Help on gls internal mysh command.
193
- help This help on the help command.
194
- history This help on the history command.
195
- kbd Help on mysh keyboard mapping.
196
- math Help on math functions.
197
- quick Help on quick commands.
198
- ruby Help on the show ruby command.
199
- show Help on the show command.
200
- {{ Help on mysh handlebars.
516
+ mysh>$debug = on
517
+ mysh>samples/test.rb 1 2 $d $t
518
+ => samples/test.rb 1 2 2016-12-21 13:43
519
+ => C:/RailsInstaller/Ruby2.1.0/bin/ruby.exe samples/test.rb 1 2 2016-12-21 13:43
520
+ Running sample file.
521
+ args = ["1", "2", "2016-12-21", "13:43"]
522
+ mysh>
201
523
  ```
202
524
 
203
- #### External commands:
525
+ ### External Commands:
204
526
 
205
527
  All other commands are executed by the system using the standard shell or
206
- the appropriate ruby interpreter.
528
+ the appropriate ruby interpreter. In effect, the system method is the action of
529
+ last resort for mysh commands.
207
530
 
208
531
  Notes:
209
532
  * If an internal command has the same name as an external command, adding a
210
533
  leading space will force the use of the external command.
211
- * If the command has a '.rb' extension, it is executed by the appropriate ruby
212
- interpreter. The interpreter used is the one specified by RbConfig.ruby
213
534
 
214
535
  ## Embedding mysh in an application.
215
536
 
@@ -218,7 +539,7 @@ The mysh can also be used from within a Ruby application:
218
539
  ```ruby
219
540
  require "mysh"
220
541
 
221
- #Some stuff omitted.
542
+ #Some application stuff omitted.
222
543
 
223
544
  Mysh.run
224
545
  ```
@@ -245,7 +566,6 @@ module Mysh
245
566
  def call(args)
246
567
  end
247
568
 
248
-
249
569
  end
250
570
 
251
571
  desc = "A succinct description of what this command does."