mysh 0.5.6 → 0.6.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: 492acc6593ec0707a12940ad838851bc1c33350f
4
- data.tar.gz: abbe75851d94b86bcd42843effb014f1af35f400
3
+ metadata.gz: 3dca3a0e863422640812a8eda3d02fac5c1581eb
4
+ data.tar.gz: e89463ff2e335de7296fa66f25ce2a5265e20c8b
5
5
  SHA512:
6
- metadata.gz: ae5cf72e11d76df6a321d715ab1cdab622f569cb8ad1d2f7e140afd099029b995a78804b655f0f3fd82316c10118304ae4109f3b508ba655064f7e64d7f08c17
7
- data.tar.gz: 6087d5402df7fb99e16e19a15c7f1edc16c22174956bd6f028fd788db2ebcc824f0ddd30674082db33709a958e7303af6e9aceecaeed9ec9f12552b9ecfc8631
6
+ metadata.gz: 70cd3855b98c7f2fec630dbd6d9981e429b6dcd14ce39f2d8920c75b08c85ff03160c33f3788645d10d2949e942af08bbb045851cf7a85490156f02fcba62a30
7
+ data.tar.gz: be9ac7a4f9ef4fe2a9c222a2484e097c9d200a80e09b2c494c0b315a28c02354b16b777d2e8c4f9f8e28bb22f0302a85a93f9610400a773f55f4f1c4b40fe3ef
@@ -3,18 +3,19 @@ Help: mysh show env command summary:
3
3
  The show env (or @env) command is used to display useful information about the
4
4
  current execution environment. This includes:
5
5
 
6
- user - The current user name.
7
- home - The current home directory.
8
- name - The path/name of the mysh program currently executing.
9
- shell - The path/name of the system command shell.
10
- host - The name of the host computer.
11
- os - The current operating system.
12
- platform - The operating platform detected by the low-level terminal gem.
13
- java - Is the current platform powered by Java?
14
- term - What terminal is defined by the system, if one is defined.
15
- disp - What display is defined by the system, if one is defined.
16
- edit - What editor is defined by the system, if one is defined.
17
- PID - The process ID of the mysh program.
6
+ user - The current user name.
7
+ home - The current home directory.
8
+ name - The path/name of the mysh program currently executing.
9
+ shell - The path/name of the system command shell.
10
+ host - The name of the host computer.
11
+ os - The current operating system.
12
+ platform - The operating platform detected by the low-level terminal gem.
13
+ java - Is the current platform powered by Java?
14
+ code page - For Windows, what is the current code page?
15
+ term - What terminal is defined by the system, if one is defined.
16
+ disp - What display is defined by the system, if one is defined.
17
+ edit - What editor is defined by the system, if one is defined.
18
+ PID - The process ID of the mysh program.
18
19
 
19
- path - An easy-to-read, formatted version of the current search path.
20
+ path - An easy-to-read, formatted version of the current search path.
20
21
 
@@ -17,8 +17,6 @@ Form Form Description
17
17
 
18
18
  # A comment.
19
19
 
20
- $ A mysh variable statement. See ?$ for more info.
21
-
22
20
  % Execute a command and then report the elapsed time.
23
21
 
24
22
  = All command lines that begin with = are evaluated as Ruby
@@ -22,7 +22,7 @@ module Mysh
22
22
  #Add help topics here. Don't sweat the order; they get sorted by name.
23
23
  # Name Description Help File
24
24
  help = [['', 'General help on mysh.', 'help.txt' ],
25
- ['$', 'Help on mysh variables.', 'vars.txt' ],
25
+ ['set', 'Help on mysh variables.', 'vars.txt' ],
26
26
  ['show', 'Help on the show command.', 'show.txt' ],
27
27
  ['@', 'Help on the show command.', 'show.txt' ],
28
28
  ['%', 'Help on timed command execution.', 'timed.txt' ],
@@ -4,15 +4,15 @@ In mysh, variables are kept that control the behavior of the shell. This simple
4
4
  command is used to set, delete, and display these variables. The basic method
5
5
  for setting a variable is:
6
6
 
7
- $name=value
7
+ set $name=value
8
8
 
9
9
  Where:
10
10
  * name is a word matching the regex: /[a-z][a-z0-9_]*/. Lower case only.
11
11
  * value is a string, with embedded variables and handlebars.
12
12
 
13
- To erase the value of a variable, use: $$name=
14
- To display the name/value of a variable, use: $$name
15
- To display all variable names/values use: $$
13
+ To erase the value of a variable, use: set $$name=
14
+ To display the name/value of a variable, use: set $$name
15
+ To display all variable names/values use: set
16
16
 
17
17
  As an escapement, the string $$$$ maps to a single $$.
18
18
 
@@ -20,8 +20,12 @@ module Mysh
20
20
 
21
21
  #Execute a command against the internal mysh variables.
22
22
  def process_command(input)
23
- match = VAR_EXP.match(input.raw)
24
- @var_name, @equals, @value = match[:name], match[:equals], match[:value]
23
+ if (match = VAR_EXP.match(input.raw_body))
24
+ @var_name, @equals, @value = match[:name], match[:equals], match[:value]
25
+ else
26
+ @var_name, @equals, @value = nil
27
+ end
28
+
25
29
  do_command
26
30
  :internal
27
31
  end
@@ -35,7 +39,7 @@ module Mysh
35
39
  elsif @equals
36
40
  MNV[sym] = ""
37
41
  elsif @var_name
38
- puts "#{@var_name} = #{MNV.get_source(sym)}"
42
+ puts "$#{@var_name} = #{MNV.get_source(sym)}"
39
43
  else
40
44
  show_all_values
41
45
  end
@@ -52,7 +56,6 @@ module Mysh
52
56
  end
53
57
 
54
58
  #The show command action object.
55
- desc = 'Set/query mysh variables. See ?$ for more.'
56
- VARS_COMMAND = VarsCommand.new('$<name>=value', desc)
57
- COMMANDS.add_action(VARS_COMMAND)
59
+ desc = 'Set/query mysh variables. See ?set for more.'
60
+ COMMANDS.add_action(VarsCommand.new('set <$name>=value', desc))
58
61
  end
data/lib/mysh/quick.rb CHANGED
@@ -8,7 +8,6 @@ module Mysh
8
8
 
9
9
  QUICK['!'] = lambda {|input| HISTORY_COMMAND.process_quick_command(input)}
10
10
  QUICK['#'] = lambda {|input| MYSH_COMMENT.process_command(input)}
11
- QUICK['$'] = lambda {|input| VARS_COMMAND.process_command(input)}
12
11
  QUICK['%'] = lambda {|input| TIMED_COMMAND.process_command(input)}
13
12
  QUICK['='] = lambda {|input| $mysh_exec_host.execute(input.raw.preprocess)}
14
13
  QUICK['?'] = lambda {|input| HELP_COMMAND.process_quick_command(input)}
data/lib/mysh/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Mysh
4
4
  #The version string of MY SHell.
5
- VERSION = "0.5.6"
5
+ VERSION = "0.6.0"
6
6
 
7
7
  #A brief summary of this gem.
8
8
  SUMMARY = "mysh -- a Ruby inspired command line shell."
data/rakefile.rb CHANGED
@@ -31,7 +31,7 @@ task :reek do |t|
31
31
  `reek --no-color lib > reek.txt`
32
32
  end
33
33
 
34
- desc "What version of mine_readline is this?"
34
+ desc "What version of mysh is this?"
35
35
  task :vers do |t|
36
36
  puts
37
37
  puts "mysh (My Shell) version = #{Mysh::VERSION}"
@@ -134,60 +134,60 @@ class MyShellTester < Minitest::Test
134
134
  assert_equal("", MNV.get_source(:test))
135
135
  refute(MNV.key?(:test), "MNV[:test] should not exist.")
136
136
 
137
- Mysh.try_execute_command("$test = new value")
137
+ Mysh.try_execute_command("set $test = new value")
138
138
  assert_equal("new value", MNV[:test])
139
139
  assert_equal("new value", MNV.get_source(:test))
140
140
  assert(MNV.key?(:test), "MNV[:test] should exist.")
141
141
 
142
- Mysh.try_execute_command("$test =")
142
+ Mysh.try_execute_command("set $test =")
143
143
  assert_equal("", MNV[:test])
144
144
  assert_equal("", MNV.get_source(:test))
145
145
  refute(MNV.key?(:test), "MNV[:test] should not exist.")
146
146
 
147
- Mysh.try_execute_command("$test = true")
147
+ Mysh.try_execute_command("set $test = true")
148
148
  assert(MNV[:test])
149
149
  assert_equal("true", MNV.get_source(:test))
150
150
  assert(MNV.key?(:test), "MNV[:test] should exist.")
151
151
 
152
- Mysh.try_execute_command("$test = off")
152
+ Mysh.try_execute_command("set $test = off")
153
153
  assert_equal(false, MNV[:test])
154
154
  assert_equal("off", MNV.get_source(:test))
155
155
  assert(MNV.key?(:test), "MNV[:test] should exist.")
156
156
 
157
- Mysh.try_execute_command("$a = foo")
158
- Mysh.try_execute_command("$b = bar")
159
- Mysh.try_execute_command("$test = $a$b")
157
+ Mysh.try_execute_command("set $a = foo")
158
+ Mysh.try_execute_command("set $b = bar")
159
+ Mysh.try_execute_command("set $test = $a$b")
160
160
  assert_equal("foobar", MNV[:test])
161
161
  assert_equal("$a$b", MNV.get_source(:test))
162
162
 
163
- Mysh.try_execute_command("$test = $$foo")
163
+ Mysh.try_execute_command("set $test = $$foo")
164
164
  assert_equal("$foo", MNV[:test])
165
165
  assert_equal("$$foo", MNV.get_source(:test))
166
166
 
167
- Mysh.try_execute_command("$bad = $bad")
167
+ Mysh.try_execute_command("set $bad = $bad")
168
168
  assert_raises { MNV[:bad] }
169
169
 
170
170
  MNV[:test] = "{{(1..9).to_a.join}}"
171
171
  assert_equal("123456789", MNV[:test])
172
172
  assert_equal("{{(1..9).to_a.join}}", MNV.get_source(:test))
173
173
 
174
- Mysh.try_execute_command("$test = $whats_all_this")
174
+ Mysh.try_execute_command("set $test = $whats_all_this")
175
175
  assert_equal("$whats_all_this", MNV[:test])
176
176
  assert_equal("$whats_all_this", MNV.get_source(:test))
177
177
 
178
- Mysh.try_execute_command("$bad = {{ MNV[:bad] }}")
178
+ Mysh.try_execute_command("set $bad = {{ MNV[:bad] }}")
179
179
  assert_raises { MNV[:bad] }
180
180
  assert_raises { MNV[:bad] } #Yes test this twice!
181
181
  assert_raises { Mysh.try_execute_command("=$bad") }
182
182
  assert_raises { Mysh.try_execute_command("=$bad") } #And this too!
183
183
 
184
- Mysh.try_execute_command("$bad = OK")
184
+ Mysh.try_execute_command("set $bad = OK")
185
185
  assert_equal("OK", MNV[:bad])
186
186
  assert_equal("OK", MNV[:bad]) #And this too!
187
187
  end
188
188
 
189
189
  def test_executing_some_strings
190
- Mysh.process_string("$c=43\n$d=99")
190
+ Mysh.process_string("set $c=43\nset $d=99")
191
191
  assert_equal("43", MNV[:c])
192
192
  assert_equal("99", MNV[:d])
193
193
  end
@@ -214,7 +214,7 @@ class MyShellTester < Minitest::Test
214
214
  assert_equal(["@", "last", "45", "is finished", "4", "ever"], wrapper.parsed)
215
215
  assert_equal(["last", "45", "is finished", "4", "ever"], wrapper.args)
216
216
 
217
- Mysh.process_string("$unjust = him")
217
+ Mysh.process_string("set $unjust = him")
218
218
  wrapper = Mysh::InputWrapper.new "Lock $unjust up!"
219
219
 
220
220
  assert_equal("Lock $unjust up!", wrapper.raw)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-12 00:00:00.000000000 Z
11
+ date: 2018-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake