mysh 0.6.11 → 0.6.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/mysh.rb +5 -4
- data/lib/mysh/init.rb +3 -3
- data/lib/mysh/internal/actions/command_line/history.rb +61 -0
- data/lib/mysh/internal/actions/help/history.txt +7 -0
- data/lib/mysh/shell_variables.rb +3 -0
- data/lib/mysh/sources/console.rb +10 -7
- data/lib/mysh/user_input.rb +1 -2
- data/lib/mysh/version.rb +1 -1
- data/mysh.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1181f7c07f14be213795e5af840e9364e838ada9
|
4
|
+
data.tar.gz: 0005e8503ddd7a6905d834c85e01519f920ca65f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 536851ba0c923a4e2491d5abd50c417f8f3c6992cc61c885920d1c4654219c95efd40fbfcaf3a1574e94687a602248914b40a13a4a938f55993911d9903b3006
|
7
|
+
data.tar.gz: 5ccbc4d1709a355aa9d3a8b065aacee3dbe9c6620bcfb26f70fd27b8fedd89cffdeb03d88314dd747a7d0b3d64977c7f6f303673791e26127ce81569b511f852
|
data/README.md
CHANGED
@@ -125,8 +125,12 @@ Where the available options are:
|
|
125
125
|
Option | Short Form(s)| Description | Default
|
126
126
|
---------------------|--------------|-------------------------|-----------
|
127
127
|
--debug | -d | Turn on mysh debugging. | false
|
128
|
+
--do-move | | Turn on mysh command history shifting.
|
129
|
+
--no-move | | Turn off mysh command history shifting. | true
|
128
130
|
--no-debug | -nd | Turn off mysh debugging.
|
129
131
|
--help | -? -h | Display mysh usage info and exit.
|
132
|
+
--history | | Turn on mysh command history. | true
|
133
|
+
--no-history | | Turn off mysh command history.
|
130
134
|
--init filename | -i filename | Initialize mysh by loading the specified file. | ~/mysh_init.mysh
|
131
135
|
--no-init | -ni | Do not load a file to initialize mysh.
|
132
136
|
--load filename | -l filename | Load the specified file into the mysh.
|
@@ -417,7 +421,9 @@ $d | The current date.
|
|
417
421
|
$date_fmt | The format for the date: "%Y-%m-%d"
|
418
422
|
$debug | Does the shell display additional debugging info (true/false)
|
419
423
|
$h | The home folder's path
|
424
|
+
$history | Is command line history enabled?
|
420
425
|
$name | The name given to this mysh session.
|
426
|
+
$no_move | Entries are not moved up when pulled from the command history.
|
421
427
|
$page_height| The page height.
|
422
428
|
$page_msg | The paging message. Default is "Press a key, a space, or q:"
|
423
429
|
$page_pause | Is page pausing enabled?
|
data/lib/mysh.rb
CHANGED
@@ -24,10 +24,10 @@ require_relative 'mysh/init'
|
|
24
24
|
require_relative 'mysh/expression'
|
25
25
|
require_relative 'mysh/version'
|
26
26
|
|
27
|
-
#The Mysh (MY SHell) module. A container for mysh and its functionality.
|
27
|
+
# The Mysh (MY SHell) module. A container for mysh and its functionality.
|
28
28
|
module Mysh
|
29
29
|
|
30
|
-
#The actual shell method.
|
30
|
+
# The actual shell method.
|
31
31
|
def self.run(args=[])
|
32
32
|
process_command_args(args, :pre_boot)
|
33
33
|
mysh_load_init
|
@@ -40,7 +40,8 @@ module Mysh
|
|
40
40
|
end
|
41
41
|
|
42
42
|
if __FILE__ == $0
|
43
|
-
Mysh.run(ARGV) #Run a shell if this file is run directly.
|
43
|
+
Mysh.run(ARGV) # Run a shell if this file is run directly.
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
# Suppress an annoying warning during tests.
|
47
|
+
$VERBOSE = nil if defined?(Rake)
|
data/lib/mysh/init.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The mysh initial file loader.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
#Set the
|
6
|
+
# Set the initial file used to startup mysh to none so far.
|
7
7
|
$mysh_init_file = nil
|
8
8
|
|
9
|
-
#Perform
|
9
|
+
# Perform initial phase processing.
|
10
10
|
def self.mysh_load_init
|
11
11
|
|
12
12
|
unless $mysh_init_file
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
# The mysh command line options for history and no_move.
|
4
|
+
module Mysh
|
5
|
+
|
6
|
+
# The mysh command line options for history.
|
7
|
+
class HistoryOption < CommandOption
|
8
|
+
# Execute the history command line option.
|
9
|
+
# Endemic Code Smells :reek:UtilityFunction
|
10
|
+
def post_boot(_args)
|
11
|
+
MNV[:history] = "on"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Add the command line option to the library.
|
16
|
+
desc = 'Turn on mysh command history.'
|
17
|
+
COMMAND_LINE.add_action(HistoryOption.new('--history', desc))
|
18
|
+
|
19
|
+
|
20
|
+
# The mysh command line options for no history.
|
21
|
+
class NoHistoryOption < CommandOption
|
22
|
+
# Execute the no history command line option.
|
23
|
+
# Endemic Code Smells :reek:UtilityFunction
|
24
|
+
def post_boot(_args)
|
25
|
+
MNV[:history] = "off"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Add the no history command line options to the library.
|
30
|
+
desc = 'Turn off mysh command history.'
|
31
|
+
COMMAND_LINE.add_action(NoHistoryOption.new('--no-history', desc))
|
32
|
+
|
33
|
+
|
34
|
+
# The mysh command line no move option for history.
|
35
|
+
class NoMoveHistoryOption < CommandOption
|
36
|
+
# Execute the no move command line option.
|
37
|
+
# Endemic Code Smells :reek:UtilityFunction
|
38
|
+
def post_boot(_args)
|
39
|
+
MNV[:no_move] = "on"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Add the command line no move option to the library.
|
44
|
+
desc = 'Turn off mysh command history shifting.'
|
45
|
+
COMMAND_LINE.add_action(NoMoveHistoryOption.new('--no-move', desc))
|
46
|
+
|
47
|
+
|
48
|
+
# The mysh command line do move option for history.
|
49
|
+
class DoMoveHistoryOption < CommandOption
|
50
|
+
# Execute the do move command line option.
|
51
|
+
# Endemic Code Smells :reek:UtilityFunction
|
52
|
+
def post_boot(_args)
|
53
|
+
MNV[:no_move] = "off"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Add the command line do move option to the library.
|
58
|
+
desc = 'Turn on mysh command history shifting.'
|
59
|
+
COMMAND_LINE.add_action(DoMoveHistoryOption.new('--do-move', desc))
|
60
|
+
|
61
|
+
end
|
@@ -21,3 +21,10 @@ Form Form Description
|
|
21
21
|
regex pattern. Note: This pattern cannot be 'clear'
|
22
22
|
so use 'clea[r]' instead.
|
23
23
|
|
24
|
+
The history buffer is controlled by two variables:
|
25
|
+
|
26
|
+
$$history Is the history buffer enabled?
|
27
|
+
$$no_move Are history entries kept in place or shifted up the buffer?
|
28
|
+
|
29
|
+
These are also controlled by command line options. See ?usage for more info.
|
30
|
+
|
data/lib/mysh/shell_variables.rb
CHANGED
@@ -21,6 +21,9 @@ module Mysh
|
|
21
21
|
MNV[:page_pause] = "on"
|
22
22
|
MNV[:page_msg] = "Press a key, a space, or q:"
|
23
23
|
|
24
|
+
MNV[:history] = "on"
|
25
|
+
MNV[:no_move] = "on"
|
26
|
+
|
24
27
|
MNV[:d] = "{{ Time.now.strftime(MNV[:date_fmt]) }}"
|
25
28
|
MNV[:h] = "{{ ENV['HOME'].to_host_spec }}"
|
26
29
|
MNV[:r] = "{{ RbConfig.ruby.to_host_spec }}"
|
data/lib/mysh/sources/console.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The mysh console command source.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
#A wrapper for the mysh console terminal.
|
6
|
+
# A wrapper for the mysh console terminal.
|
7
7
|
class Console
|
8
8
|
|
9
|
-
#Setup the console wrapper.
|
9
|
+
# Setup the console wrapper.
|
10
10
|
def initialize
|
11
11
|
@eoi = false
|
12
12
|
end
|
13
13
|
|
14
|
-
#Get the initial line of command input.
|
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
17
|
get(prompt: MNV[:prompt])
|
@@ -20,7 +20,7 @@ module Mysh
|
|
20
20
|
exit
|
21
21
|
end
|
22
22
|
|
23
|
-
#Get additional lines of continued commands.
|
23
|
+
# Get additional lines of continued commands.
|
24
24
|
def get_command_extra(str)
|
25
25
|
get(prompt: MNV[:post_prompt] + '\\', prefix: str[0])
|
26
26
|
rescue MiniReadlinePLE => err
|
@@ -38,15 +38,18 @@ module Mysh
|
|
38
38
|
MNV[selector] = ""
|
39
39
|
end
|
40
40
|
|
41
|
-
#Have we reached the end of input?
|
41
|
+
# Have we reached the end of input?
|
42
42
|
def eoi?
|
43
43
|
@eoi
|
44
44
|
end
|
45
45
|
|
46
46
|
private
|
47
47
|
|
48
|
-
#Get some actual user input!
|
48
|
+
# Get some actual user input!
|
49
49
|
def get(parms={})
|
50
|
+
parms[:history] = MNV[:history].extract_boolean
|
51
|
+
parms[:no_move] = MNV[:no_move].extract_boolean
|
52
|
+
|
50
53
|
result = (input = Mysh.input).readline(parms)
|
51
54
|
input.instance_options[:initial] = ""
|
52
55
|
result
|
data/lib/mysh/user_input.rb
CHANGED
@@ -27,8 +27,7 @@ module Mysh
|
|
27
27
|
|
28
28
|
#Get the user input ready.
|
29
29
|
def self.input
|
30
|
-
@input ||= MiniReadline::Readline.new(
|
31
|
-
eoi_detect: true,
|
30
|
+
@input ||= MiniReadline::Readline.new(eoi_detect: true,
|
32
31
|
auto_complete: true,
|
33
32
|
auto_source: SmartSource)
|
34
33
|
end
|
data/lib/mysh/version.rb
CHANGED
data/mysh.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'rdoc', "~> 5.0"
|
31
31
|
spec.add_development_dependency 'reek', "~> 5.0.2"
|
32
32
|
|
33
|
-
spec.add_runtime_dependency 'mini_readline', "~> 0.9.
|
33
|
+
spec.add_runtime_dependency 'mini_readline', "~> 0.9.1"
|
34
34
|
spec.add_runtime_dependency 'mini_term', "~> 0.1.0"
|
35
35
|
spec.add_runtime_dependency 'pause_output', "~> 0.1.0"
|
36
36
|
spec.add_runtime_dependency 'format_output', "~> 0.1.0"
|
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.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.9.
|
103
|
+
version: 0.9.1
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.9.
|
110
|
+
version: 0.9.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: mini_term
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,6 +210,7 @@ files:
|
|
210
210
|
- lib/mysh/internal/actions/cd.rb
|
211
211
|
- lib/mysh/internal/actions/command_line.rb
|
212
212
|
- lib/mysh/internal/actions/command_line/debug.rb
|
213
|
+
- lib/mysh/internal/actions/command_line/history.rb
|
213
214
|
- lib/mysh/internal/actions/command_line/init.rb
|
214
215
|
- lib/mysh/internal/actions/command_line/load.rb
|
215
216
|
- lib/mysh/internal/actions/command_line/pause.rb
|