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 +4 -4
- data/README.md +23 -2
- data/lib/mysh/external.rb +1 -1
- data/lib/mysh/internal/actions/cd.rb +6 -4
- data/lib/mysh/process.rb +1 -1
- data/lib/mysh/shell_variables.rb +1 -1
- data/lib/mysh/shell_variables/evaluate.rb +2 -2
- data/lib/mysh/shell_variables/shell_variable_store.rb +1 -1
- data/lib/mysh/sources/console.rb +1 -1
- data/lib/mysh/system.rb +1 -1
- data/lib/mysh/version.rb +1 -1
- data/mysh.gemspec +1 -1
- data/tests/my_shell_tests.rb +2 -2
- metadata +4 -5
- data/mysh.reek +0 -118
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fd9998d94e082db9a7e41d4338322d5031cee1e
|
4
|
+
data.tar.gz: 6c4c031b70519d71edabfc1220c8a1a3112072e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
data/lib/mysh/external.rb
CHANGED
@@ -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
|
-
'
|
8
|
+
'or display the current working directory.'
|
9
9
|
|
10
10
|
action = lambda do |input|
|
11
|
-
args = input.args
|
12
|
-
|
13
|
-
|
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))
|
data/lib/mysh/process.rb
CHANGED
@@ -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.
|
data/lib/mysh/shell_variables.rb
CHANGED
@@ -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 =~
|
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
|
data/lib/mysh/sources/console.rb
CHANGED
@@ -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
|
data/lib/mysh/system.rb
CHANGED
data/lib/mysh/version.rb
CHANGED
data/mysh.gemspec
CHANGED
@@ -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', "~>
|
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"
|
data/tests/my_shell_tests.rb
CHANGED
@@ -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
|
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.
|
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-
|
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:
|
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:
|
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: []
|