mysh 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9838abe6d0993c89a86b4b5532928914b79e763
4
- data.tar.gz: 0c913b3f4a295000f5aa95bc1c2f1752a5e8ecdc
3
+ metadata.gz: 3fd9998d94e082db9a7e41d4338322d5031cee1e
4
+ data.tar.gz: 6c4c031b70519d71edabfc1220c8a1a3112072e7
5
5
  SHA512:
6
- metadata.gz: 853099d5554d1a06cec3aa83f16e86cd4d001bb2b90dfcbccb26857486753c5f4370306ce513d3892f00206b2116f9a259adbaf5988284e2a250e7ad05047488
7
- data.tar.gz: 9b5e6af59deb7716d4f3f11da57753c6f1174b38acf17bce8f35fff7dc628855cddcd200fe1a5e77dc1043e001aa31215176f01739f539bf52c5108af1acc9c7
6
+ metadata.gz: a08248ea5f888156d068a0fd123a9ac41033384c231bb9024da51570db8c68cff459b2642ef8703bb7b817254e345151fd527f5caf695bb895cf9c2fc7aaf4e2
7
+ data.tar.gz: 77922cf33ed6fa0d26f03ea44c649fdb4c8488fca4049300b3a65ad34792d8227bd7d477517b18380c734262f917665d4d2f668f8a3fc66a674f6769771d104c
data/README.md CHANGED
@@ -110,7 +110,7 @@ It should be noted that in the event of a conflict in settings during the boot
110
110
  process, the last command/option encountered shall prevail. For example if the
111
111
  ~/mysh_init.mysh contains the line:
112
112
  ```
113
- $debug = on
113
+ set $debug = on
114
114
  ```
115
115
  and the command line has the -nd option, then debug mode will be disabled
116
116
  because the -nd command line option is processed after the mysh_init file.
@@ -380,7 +380,27 @@ $time_fmt | The format for the time: "%H:%M"
380
380
  $u | The current user.
381
381
  $w | The current working directory's path.
382
382
 
383
+ #### Some Examples:
383
384
 
385
+ Imagine you wish to have all commands numbered sequentially. Use this or put it
386
+ in the Mysh ini file.
387
+
388
+ set $prompt = {{ cmd_cter||=0; cmd_cter+=1 }} mysh>
389
+
390
+ And the command line will not look like:
391
+
392
+ 1 mysh>ls
393
+ CODE_OF_CONDUCT.md LICENSE.txt lib rakefile.rb tests
394
+ Gemfile README.md mysh.gemspec reek.txt
395
+ Gemfile.lock bin pkg samples
396
+ C:\Sites\mysh
397
+ 2 mysh>git status
398
+ On branch master
399
+ Your branch is up to date with 'origin/master'.
400
+
401
+ nothing to commit, working tree clean
402
+ C:\Sites\mysh
403
+ 3 mysh>
384
404
 
385
405
  ### Ruby Expressions:
386
406
 
@@ -474,7 +494,6 @@ Topic | Description
474
494
  -----------|----------------------------------------------------
475
495
  none | General help on mysh.
476
496
  ! | Help on the history command.
477
- $ | Help on mysh variables.
478
497
  % | Help on timed command execution.
479
498
  = | Help on ruby expressions.
480
499
  ? | This help on the help command.
@@ -490,6 +509,7 @@ math | Help on math functions.
490
509
  mls | Help on mls internal mysh command.
491
510
  quick | Help on quick commands.
492
511
  ruby | Help on the show ruby command.
512
+ set | Help on mysh variables.
493
513
  show | Help on the show command.
494
514
  types | Help on mysh file types.
495
515
  usage | Help on mysh usage options.
@@ -522,6 +542,7 @@ host | The name of the host computer.
522
542
  os | The current operating system.
523
543
  platform | The operating platform detected by the low-level terminal gem.
524
544
  java | Is the current platform powered by Java?
545
+ code page| In Windows, what code page is active?
525
546
  term | What terminal is defined by the system, if one is defined.
526
547
  disp | What display is defined by the system, if one is defined.
527
548
  edit | What editor is defined by the system, if one is defined.
@@ -15,7 +15,7 @@ module Mysh
15
15
 
16
16
  if ext == '.rb'
17
17
  new_command = "#{RbConfig.ruby} #{input.cooked}"
18
- puts "=> #{new_command}" if MNV[:debug]
18
+ puts "=> #{new_command}" if MNV[:debug].extract_mysh_types
19
19
  system(new_command)
20
20
  :ruby_exec
21
21
  elsif ext == '.mysh'
@@ -5,12 +5,14 @@ module Mysh
5
5
 
6
6
  #Add the cd command to the library.
7
7
  desc = 'Change directory to the optional <dir> parameter ' +
8
- 'and then display the current working directory.'
8
+ 'or display the current working directory.'
9
9
 
10
10
  action = lambda do |input|
11
- args = input.args
12
- Dir.chdir(args[0]) unless args.empty?
13
- puts Dir.pwd.to_host_spec
11
+ if (args = input.args).empty?
12
+ puts Dir.pwd.to_host_spec
13
+ else
14
+ Dir.chdir(args[0]) unless args.empty?
15
+ end
14
16
  end
15
17
 
16
18
  COMMANDS.add_action(Action.new('cd <dir>', desc, &action))
@@ -32,7 +32,7 @@ module Mysh
32
32
 
33
33
  rescue Interrupt, StandardError, ScriptError => err
34
34
  puts "Error #{err.class}: #{err}"
35
- puts err.backtrace if MNV[:debug] || defined?(MiniTest)
35
+ puts err.backtrace if MNV[:debug].extract_mysh_types || defined?(MiniTest)
36
36
  end
37
37
 
38
38
  #Try to execute a single line of input. Does not handle exceptions.
@@ -12,7 +12,7 @@ module Mysh
12
12
 
13
13
  #Set up some default values.
14
14
  MNV[:debug] = "false"
15
- MNV[:prompt] = "mysh"
15
+ MNV[:prompt] = "mysh>"
16
16
  MNV[:post_prompt] = "$prompt"
17
17
  MNV[:pre_prompt] = "$w"
18
18
 
@@ -5,7 +5,7 @@ class String
5
5
 
6
6
  #Extract common mysh data from this string.
7
7
  def extract_mysh_types
8
- if self =~ /false|no|off/i
8
+ if self =~ /\A(false|no|off)\z/i
9
9
  false
10
10
  else
11
11
  self
@@ -18,7 +18,7 @@ class String
18
18
  sym = str[1..-1].to_sym
19
19
  MNV.key?(sym) ? MNV[sym].to_s : str
20
20
  end.gsub(/\\\$/, "$")
21
-
21
+
22
22
  end
23
23
 
24
24
  end
@@ -25,7 +25,7 @@ module Mysh
25
25
  ensure
26
26
  @loop_check = nil
27
27
  end
28
- end.extract_mysh_types
28
+ end
29
29
  end
30
30
 
31
31
  #Set the value of a variable.
@@ -14,7 +14,7 @@ module Mysh
14
14
  #Get the initial line of command input.
15
15
  def get_command
16
16
  puts MNV[:pre_prompt] if MNV.key?(:pre_prompt)
17
- get(prompt: MNV[:prompt] + '>')
17
+ get(prompt: MNV[:prompt])
18
18
  rescue MiniReadlinePLE => err
19
19
  retry unless handle_get_error(err, :prompt)
20
20
  exit
@@ -5,7 +5,7 @@ module Mysh
5
5
 
6
6
  #Try to execute as a system program.
7
7
  def self.try_execute_system(input)
8
- system(input.raw.preprocess + "\n") ? :system : :error
8
+ system(input.raw.preprocess.chomp + "\n") ? :system : :error
9
9
  end
10
10
 
11
11
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Mysh
4
4
  #The version string of MY SHell.
5
- VERSION = "0.6.1"
5
+ VERSION = "0.6.2"
6
6
 
7
7
  #A brief summary of this gem.
8
8
  SUMMARY = "mysh -- a Ruby inspired command line shell."
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'minitest', "~> 5.7"
29
29
  spec.add_development_dependency 'minitest_visible', "~> 0.1"
30
30
  spec.add_development_dependency 'rdoc', "~> 5.0"
31
- spec.add_development_dependency 'reek', "~> 4.5"
31
+ spec.add_development_dependency 'reek', "~> 5.0.2"
32
32
 
33
33
  spec.add_runtime_dependency 'mini_readline', "~> 0.8.1"
34
34
  spec.add_runtime_dependency 'vls', "~> 0.4.1"
@@ -150,8 +150,8 @@ class MyShellTester < Minitest::Test
150
150
  assert(MNV.key?(:test), "MNV[:test] should exist.")
151
151
 
152
152
  Mysh.try_execute_command("set $test = off")
153
- assert_equal(false, MNV[:test])
154
- assert_equal("off", MNV.get_source(:test))
153
+ assert_equal(false, MNV[:test].extract_mysh_types)
154
+ assert_equal("off", MNV[:test])
155
155
  assert(MNV.key?(:test), "MNV[:test] should exist.")
156
156
 
157
157
  Mysh.try_execute_command("set $a = foo")
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.6.1
4
+ version: 0.6.2
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-16 00:00:00.000000000 Z
11
+ date: 2018-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '4.5'
89
+ version: 5.0.2
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '4.5'
96
+ version: 5.0.2
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mini_readline
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -235,7 +235,6 @@ files:
235
235
  - lib/mysh/user_input.rb
236
236
  - lib/mysh/version.rb
237
237
  - mysh.gemspec
238
- - mysh.reek
239
238
  - rakefile.rb
240
239
  - reek.txt
241
240
  - samples/load.rb
data/mysh.reek DELETED
@@ -1,118 +0,0 @@
1
- ---
2
- Attribute:
3
- enabled: false
4
- exclude: []
5
- BooleanParameter:
6
- enabled: true
7
- exclude: []
8
- ClassVariable:
9
- enabled: true
10
- exclude: []
11
- ControlParameter:
12
- enabled: true
13
- exclude: []
14
- DataClump:
15
- enabled: true
16
- exclude: []
17
- max_copies: 2
18
- min_clump_size: 2
19
- DuplicateMethodCall:
20
- enabled: true
21
- exclude: []
22
- max_calls: 1
23
- allow_calls: []
24
- FeatureEnvy:
25
- enabled: true
26
- exclude: []
27
- InstanceVariableAssumption:
28
- enabled: true
29
- exclude: []
30
- IrresponsibleModule:
31
- enabled: true
32
- exclude: []
33
- LongParameterList:
34
- enabled: true
35
- exclude: []
36
- max_params: 3
37
- overrides:
38
- initialize:
39
- max_params: 5
40
- LongYieldList:
41
- enabled: true
42
- exclude: []
43
- max_params: 3
44
- ModuleInitialize:
45
- enabled: true
46
- exclude: []
47
- NestedIterators:
48
- enabled: true
49
- exclude: []
50
- max_allowed_nesting: 1
51
- ignore_iterators: []
52
- NilCheck:
53
- enabled: true
54
- exclude: []
55
- PrimaDonnaMethod:
56
- enabled: true
57
- exclude: []
58
- RepeatedConditional:
59
- enabled: true
60
- exclude: []
61
- max_ifs: 2
62
- TooManyInstanceVariables:
63
- enabled: true
64
- exclude: []
65
- max_instance_variables: 9
66
- TooManyMethods:
67
- enabled: true
68
- exclude: []
69
- max_methods: 25
70
- TooManyStatements:
71
- enabled: true
72
- exclude:
73
- - initialize
74
- max_statements: 5
75
- UncommunicativeMethodName:
76
- enabled: true
77
- exclude: []
78
- reject:
79
- - !ruby/regexp /^[a-z]$/
80
- - !ruby/regexp /[0-9]$/
81
- - !ruby/regexp /[A-Z]/
82
- accept: []
83
- UncommunicativeModuleName:
84
- enabled: true
85
- exclude: []
86
- reject:
87
- - !ruby/regexp /^.$/
88
- - !ruby/regexp /[0-9]$/
89
- accept:
90
- - Inline::C
91
- UncommunicativeParameterName:
92
- enabled: true
93
- exclude: []
94
- reject:
95
- - !ruby/regexp /^.$/
96
- - !ruby/regexp /[0-9]$/
97
- - !ruby/regexp /[A-Z]/
98
- - !ruby/regexp /^_/
99
- accept: []
100
- UncommunicativeVariableName:
101
- enabled: true
102
- exclude: []
103
- reject:
104
- - !ruby/regexp /^.$/
105
- - !ruby/regexp /[0-9]$/
106
- - !ruby/regexp /[A-Z]/
107
- accept:
108
- - _
109
- UnusedParameters:
110
- enabled: true
111
- exclude: []
112
- UtilityFunction:
113
- enabled: true
114
- exclude: []
115
- max_helper_calls: 1
116
- UnusedPrivateMethod:
117
- enabled: false
118
- exclude: []