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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1aaea546a90b6d110dd8910757083c385a7e72d5
4
- data.tar.gz: 4f82d70adf3479acf12ee7a670c6d3a247326777
3
+ metadata.gz: 1181f7c07f14be213795e5af840e9364e838ada9
4
+ data.tar.gz: 0005e8503ddd7a6905d834c85e01519f920ca65f
5
5
  SHA512:
6
- metadata.gz: 5b6d81b4a6cce7307a7b1262ad4125afb1cc1c0083a2c128543ff43211bd3be70bf4c3372f43a01b1225b4668d077b3b29cac51c29741313c0ae757510398e3a
7
- data.tar.gz: 1aff82db1052b83caf85b0e09f006eebebf80a0b0782da66660b09586fabe1527bdd72f4760c47eaa2a4387a5f16447acc6ce588f364101d3a692736c628bad1
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?
@@ -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
- $VERBOSE = nil
46
+ # Suppress an annoying warning during tests.
47
+ $VERBOSE = nil if defined?(Rake)
@@ -1,12 +1,12 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/init.rb -- The mysh init file loader.
3
+ # The mysh initial file loader.
4
4
  module Mysh
5
5
 
6
- #Set the init file used to startup mysh to none so far.
6
+ # Set the initial file used to startup mysh to none so far.
7
7
  $mysh_init_file = nil
8
8
 
9
- #Perform init phase processing.
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
+
@@ -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 }}"
@@ -1,17 +1,17 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/sources/console.rb -- The mysh console command source.
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
@@ -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(history: true,
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Mysh
4
4
  #The version string of MY SHell.
5
- VERSION = "0.6.11"
5
+ VERSION = "0.6.12"
6
6
 
7
7
  #A brief summary of this gem.
8
8
  SUMMARY = "mysh -- a Ruby inspired command line shell."
@@ -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.0"
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.11
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: 2018-12-30 00:00:00.000000000 Z
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.0
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.0
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