mysh 0.6.9 → 0.6.16
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 +4 -4
- data/README.md +25 -5
- data/lib/mysh.rb +19 -9
- data/lib/mysh/{internal/action.rb → action.rb} +8 -8
- data/lib/mysh/{internal/action_pool.rb → action_pool.rb} +8 -8
- data/lib/mysh/{internal/actions/command_line.rb → command_line.rb} +10 -10
- data/lib/mysh/{internal/actions/command_line → command_line}/debug.rb +9 -11
- data/lib/mysh/command_line/history.rb +61 -0
- data/lib/mysh/{internal/actions/command_line → command_line}/init.rb +8 -8
- data/lib/mysh/{internal/actions/command_line → command_line}/load.rb +5 -5
- data/lib/mysh/{internal/actions/command_line → command_line}/pause.rb +6 -8
- data/lib/mysh/{internal/actions/command_line → command_line}/post_prompt.rb +10 -12
- data/lib/mysh/{internal/actions/command_line → command_line}/pre_prompt.rb +10 -12
- data/lib/mysh/{internal/actions/command_line → command_line}/prompt.rb +9 -10
- data/lib/mysh/command_line/quit.rb +19 -0
- data/lib/mysh/{internal/actions/command_line → command_line}/usage.rb +4 -4
- data/lib/mysh/expression.rb +11 -31
- data/lib/mysh/external.rb +4 -5
- data/lib/mysh/globalize.rb +14 -10
- data/lib/mysh/handlebars.rb +10 -13
- data/lib/mysh/handlebars/eval_handlebars.rb +38 -0
- data/lib/mysh/{internal/actions/help → help}/env.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/expr.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/gem.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/gls.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/h_o_h.txt +1 -1
- data/lib/mysh/{internal/actions/help → help}/hbar.txt +11 -0
- data/lib/mysh/{internal/actions/help → help}/help.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/history.txt +7 -0
- data/lib/mysh/{internal/actions/help → help}/init.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/kbd.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/math.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/mls.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/quick.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/ruby.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/show.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/term.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/timed.txt +0 -0
- data/lib/mysh/help/type.txt +28 -0
- data/lib/mysh/{internal/actions/help → help}/types.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/usage.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/vars.txt +4 -4
- data/lib/mysh/input_wrapper.rb +13 -13
- data/lib/mysh/internal.rb +20 -8
- data/lib/mysh/internal/{actions/cancel.rb → cancel.rb} +0 -0
- data/lib/mysh/internal/{actions/cd.rb → cd.rb} +2 -2
- data/lib/mysh/internal/{actions/comment.rb → comment.rb} +2 -2
- data/lib/mysh/internal/{actions/elapsed.rb → elapsed.rb} +2 -2
- data/lib/mysh/internal/{actions/exit.rb → exit.rb} +0 -0
- data/lib/mysh/internal/{actions/gls.rb → gls.rb} +6 -7
- data/lib/mysh/internal/{actions/help.rb → help.rb} +7 -9
- data/lib/mysh/internal/{actions/history.rb → history.rb} +10 -9
- data/lib/mysh/internal/load.rb +45 -0
- data/lib/mysh/internal/{actions/mls.rb → mls.rb} +2 -2
- data/lib/mysh/internal/{actions/pwd.rb → pwd.rb} +1 -1
- data/lib/mysh/internal/{actions/say.rb → say.rb} +1 -1
- data/lib/mysh/internal/{actions/show.rb → show.rb} +7 -6
- data/lib/mysh/internal/{actions/help → support}/sub_help.rb +9 -7
- data/lib/mysh/internal/type.rb +38 -0
- data/lib/mysh/internal/{actions/vars.rb → vars.rb} +8 -8
- data/lib/mysh/{init.rb → load_init_file.rb} +3 -3
- data/lib/mysh/process.rb +7 -7
- data/lib/mysh/quick.rb +10 -4
- data/lib/mysh/shell_variables.rb +9 -4
- data/lib/mysh/shell_variables/evaluate.rb +2 -11
- data/lib/mysh/shell_variables/shell_variable_keeper.rb +6 -7
- data/lib/mysh/shell_variables/shell_variable_store.rb +13 -14
- data/lib/mysh/{internal/actions/show → show}/env.rb +3 -5
- data/lib/mysh/{internal/actions/show → show}/gem.rb +3 -16
- data/lib/mysh/{internal/actions/show → show}/ruby.rb +0 -0
- data/lib/mysh/{internal/actions/show → show}/term.rb +5 -7
- data/lib/mysh/sources/console.rb +11 -7
- data/lib/mysh/sources/parse.rb +7 -10
- data/lib/mysh/sources/smart_auto_complete.rb +5 -5
- data/lib/mysh/sources/string.rb +6 -6
- data/lib/mysh/string_helpers.rb +37 -0
- data/lib/mysh/system.rb +2 -2
- data/lib/mysh/user_input.rb +5 -9
- data/lib/mysh/version.rb +4 -4
- data/mysh.gemspec +4 -3
- data/samples/show.txt +2 -0
- data/tests/my_shell_tests.rb +18 -6
- metadata +77 -65
- data/lib/mysh/binding_wrapper.rb +0 -21
- data/lib/mysh/handlebars/string.rb +0 -22
- data/lib/mysh/internal/actions/actions_path.rb +0 -15
- data/lib/mysh/internal/actions/command_line/quit.rb +0 -19
- data/lib/mysh/internal/actions/load.rb +0 -36
- data/lib/mysh/internal/actions/type.rb +0 -22
- data/lib/mysh/internal/manage.rb +0 -20
- data/lib/mysh/internal/to_file_spec.rb +0 -26
- data/lib/mysh/pre_processor.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 934758602fb71789f5fa61aef2d82bcb1643fd96
|
4
|
+
data.tar.gz: cd18110024b6cf77c004da3cd5374228e096cd27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c9cca6285afcad01d54fcf85576596942673ea0f579df1edf1506580f4dfb4fdba16ed9f87bc252d14e38dfb630e396ea85dac19ee2278951ae663c8c9200c2
|
7
|
+
data.tar.gz: 21aa9ed6bc0b02981a0e982423ffd6d0235865479b2c015837083696e892c83846434a1e202b8cbf3330cb70782c3bec0d5b8c6b7974d0b8b58738d47b268eb7
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ See the original article at:
|
|
26
26
|
(http://www.blackbytes.info/2016/07/writing-a-shell-in-ruby/)
|
27
27
|
|
28
28
|
Oh, and one other little thing. A survey of the mysh reveals that it currently
|
29
|
-
contains
|
29
|
+
contains 2188 lines of code. It seems that there has been some growth beyond
|
30
30
|
the 25 lines in the original article.
|
31
31
|
|
32
32
|
## Installation
|
@@ -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,10 @@ $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_dups | Suppress duplicate entries in the history buffer.
|
427
|
+
$no_move | Entries are not moved up when pulled from the command history.
|
421
428
|
$page_height| The page height.
|
422
429
|
$page_msg | The paging message. Default is "Press a key, a space, or q:"
|
423
430
|
$page_pause | Is page pausing enabled?
|
@@ -429,6 +436,7 @@ $r | The location of the Ruby compiler.
|
|
429
436
|
$s | The location of the host command interpreter.
|
430
437
|
$t | The current time.
|
431
438
|
$time_fmt | The format for the time: "%H:%M"
|
439
|
+
$type | Does the type command operate in cooked or raw mode. Default is raw mode.
|
432
440
|
$u | The current user.
|
433
441
|
$w | The current working directory's path.
|
434
442
|
|
@@ -552,18 +560,19 @@ none | General help on mysh.
|
|
552
560
|
@ | Help on the show command.
|
553
561
|
env | Help on the show env command.
|
554
562
|
gem | Help on the show gem command.
|
555
|
-
gls | Help on gls
|
563
|
+
gls | Help on the gls command.
|
556
564
|
help | This help on the help command.
|
557
565
|
history | Help on the history command.
|
558
566
|
init | Help on mysh initialization.
|
559
567
|
kbd | Help on mysh keyboard mapping.
|
560
568
|
math | Help on math functions.
|
561
|
-
mls | Help on mls
|
569
|
+
mls | Help on the mls command.
|
562
570
|
quick | Help on quick commands.
|
563
571
|
ruby | Help on the show ruby command.
|
564
572
|
set | Help on mysh variables.
|
565
573
|
show | Help on the show command.
|
566
574
|
term | Help on the show term command.
|
575
|
+
type | Help on the type command.
|
567
576
|
types | Help on mysh file types.
|
568
577
|
usage | Help on mysh usage options.
|
569
578
|
{{ | Help on mysh handlebars.
|
@@ -708,7 +717,7 @@ pwd | Display the current working directory.
|
|
708
717
|
say <stuff> | Display the text in the command arguments.
|
709
718
|
set <$name>=value| Set/query mysh variables.
|
710
719
|
show <item> | Display information about a part of mysh.
|
711
|
-
type <file> | Display
|
720
|
+
type <file> | Display one or more text files with optional support for embedded handlebars and shell variables.
|
712
721
|
|
713
722
|
Notes:
|
714
723
|
1. The notation {x} means that x is optional.
|
@@ -907,7 +916,7 @@ on the optional parms.
|
|
907
916
|
###### "string".preprocess(context=mysh_default_context)
|
908
917
|
Process the string for embedded variables and handlebars. By default,
|
909
918
|
any embedded ruby is evaluated in the mysh global expression binding. However,
|
910
|
-
another
|
919
|
+
another binding may be passed to access an alternative execution environment.
|
911
920
|
|
912
921
|
###### "string".to_host_spec
|
913
922
|
Given a string with a file spec, to_host_spec adjusts that string so that it is
|
@@ -975,3 +984,14 @@ calling attention to some aspect that could use some TLC or a suggestion or an
|
|
975
984
|
idea or a comment.
|
976
985
|
|
977
986
|
This is a low pressure environment. All are welcome!
|
987
|
+
|
988
|
+
## License
|
989
|
+
|
990
|
+
The gem is available as open source under the terms of the
|
991
|
+
[MIT License](./LICENSE.txt).
|
992
|
+
|
993
|
+
## Code of Conduct
|
994
|
+
|
995
|
+
Everyone interacting in the fully_freeze project’s codebases, issue trackers,
|
996
|
+
chat rooms and mailing lists is expected to follow the
|
997
|
+
[code of conduct](./CODE_OF_CONDUCT.md).
|
data/lib/mysh.rb
CHANGED
@@ -1,34 +1,41 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
# mysh -- MY SHell -- a Ruby
|
3
|
+
# mysh -- MY SHell -- a Ruby inspired command line shell.
|
4
4
|
|
5
|
+
require 'pp'
|
5
6
|
require 'English'
|
6
7
|
require 'in_array'
|
8
|
+
require 'insouciant'
|
7
9
|
require 'pause_output'
|
8
10
|
require 'format_output'
|
11
|
+
require 'mini_readline'
|
12
|
+
|
13
|
+
# The path to the gem lib folder.
|
14
|
+
MYSH_LIB = (File.expand_path(File.dirname(__FILE__)) + "/").freeze
|
9
15
|
|
10
16
|
require_relative 'mysh/exceptions'
|
11
|
-
require_relative 'mysh/
|
17
|
+
require_relative 'mysh/string_helpers'
|
12
18
|
require_relative 'mysh/input_wrapper'
|
13
19
|
require_relative 'mysh/user_input'
|
14
|
-
require_relative 'mysh/
|
20
|
+
require_relative 'mysh/action'
|
21
|
+
require_relative 'mysh/action_pool'
|
15
22
|
require_relative 'mysh/internal'
|
16
23
|
require_relative 'mysh/quick'
|
17
24
|
require_relative 'mysh/external'
|
25
|
+
require_relative 'mysh/command_line'
|
18
26
|
require_relative 'mysh/system'
|
19
27
|
require_relative 'mysh/handlebars'
|
20
28
|
require_relative 'mysh/shell_variables'
|
21
|
-
require_relative 'mysh/pre_processor'
|
22
29
|
require_relative 'mysh/process'
|
23
30
|
require_relative 'mysh/globalize'
|
24
|
-
require_relative 'mysh/
|
25
|
-
|
31
|
+
require_relative 'mysh/load_init_file'
|
32
|
+
require_relative 'mysh/expression'
|
26
33
|
require_relative 'mysh/version'
|
27
34
|
|
28
|
-
#The Mysh (MY SHell) module.
|
35
|
+
# The Mysh (MY SHell) module.
|
29
36
|
module Mysh
|
30
37
|
|
31
|
-
#The actual shell method.
|
38
|
+
# The actual shell method.
|
32
39
|
def self.run(args=[])
|
33
40
|
process_command_args(args, :pre_boot)
|
34
41
|
mysh_load_init
|
@@ -41,5 +48,8 @@ module Mysh
|
|
41
48
|
end
|
42
49
|
|
43
50
|
if __FILE__ == $0
|
44
|
-
Mysh.run(ARGV) #Run a shell if this file is run directly.
|
51
|
+
Mysh.run(ARGV) # Run a shell if this file is run directly.
|
45
52
|
end
|
53
|
+
|
54
|
+
# Suppress an annoying warning during tests.
|
55
|
+
$VERBOSE = nil if defined?(Rake)
|
@@ -1,35 +1,35 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The framework of mysh internal actions.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
#The mysh internal action class.
|
6
|
+
# The mysh internal action class.
|
7
7
|
class Action
|
8
|
-
#The name of the action.
|
8
|
+
# The name of the action.
|
9
9
|
attr_reader :name
|
10
10
|
|
11
|
-
#The description of the action.
|
11
|
+
# The description of the action.
|
12
12
|
attr_reader :description
|
13
13
|
|
14
|
-
#Setup an internal action.
|
14
|
+
# Setup an internal action.
|
15
15
|
def initialize(name = "", description = "", &action)
|
16
16
|
@name, @description = name, description.in_array
|
17
17
|
|
18
18
|
define_singleton_method(:process_command, &action) if block_given?
|
19
19
|
end
|
20
20
|
|
21
|
-
#Parse the string and call the action.
|
21
|
+
# Parse the string and call the action.
|
22
22
|
def process_quick_command(input)
|
23
23
|
process_command(input.quick)
|
24
24
|
:internal
|
25
25
|
end
|
26
26
|
|
27
|
-
#Get information about the action.
|
27
|
+
# Get information about the action.
|
28
28
|
def action_info
|
29
29
|
[@name].concat(@description)
|
30
30
|
end
|
31
31
|
|
32
|
-
#Get the name without any argument descriptions.
|
32
|
+
# Get the name without any argument descriptions.
|
33
33
|
def short_name
|
34
34
|
name.split[0] || ""
|
35
35
|
end
|
@@ -1,31 +1,31 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# A managed hash of mysh actions.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
|
6
|
+
# A managed hash of mysh actions.
|
7
7
|
class ActionPool
|
8
8
|
|
9
|
-
#The name of this action pool.
|
9
|
+
# The name of this action pool.
|
10
10
|
attr_reader :pool_name
|
11
11
|
|
12
|
-
#Create a new action pool
|
12
|
+
# Create a new action pool
|
13
13
|
def initialize(pool_name, default_action = nil)
|
14
14
|
@pool_name, @pool = pool_name, {}
|
15
15
|
@pool.default = default_action
|
16
16
|
end
|
17
17
|
|
18
|
-
#Get a action.
|
18
|
+
# Get a action.
|
19
19
|
def [](index)
|
20
20
|
@pool[index]
|
21
21
|
end
|
22
22
|
|
23
|
-
#Does this action exist?
|
23
|
+
# Does this action exist?
|
24
24
|
def exists?(index)
|
25
25
|
@pool.key?(index)
|
26
26
|
end
|
27
27
|
|
28
|
-
#Add an action to the pool.
|
28
|
+
# Add an action to the pool.
|
29
29
|
def add_action(action)
|
30
30
|
short_name = action.short_name
|
31
31
|
|
@@ -36,7 +36,7 @@ module Mysh
|
|
36
36
|
@pool[short_name] = action
|
37
37
|
end
|
38
38
|
|
39
|
-
#Get information on all actions.
|
39
|
+
# Get information on all actions.
|
40
40
|
def actions_info
|
41
41
|
@pool
|
42
42
|
.values
|
@@ -1,23 +1,23 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The command line options of mysh.
|
4
4
|
module Mysh
|
5
5
|
|
6
6
|
# Action pool of command line options.
|
7
7
|
COMMAND_LINE = ActionPool.new("COMMAND_LINE")
|
8
8
|
|
9
|
-
|
9
|
+
# A mysh command line option.
|
10
10
|
class CommandOption < Action
|
11
11
|
|
12
|
-
#Execute a pre-boot command line option.
|
12
|
+
# Execute a pre-boot command line option.
|
13
13
|
def pre_boot(_args); end
|
14
14
|
|
15
|
-
#Execute a post-boot command line option.
|
15
|
+
# Execute a post-boot command line option.
|
16
16
|
def post_boot(_args); end
|
17
17
|
|
18
18
|
alias :process_command :pre_boot
|
19
19
|
|
20
|
-
#Get an argument for an option.
|
20
|
+
# Get an argument for an option.
|
21
21
|
def get_arg(read_point)
|
22
22
|
result = read_point.next
|
23
23
|
fail if COMMAND_LINE.exists?(result) #An arg should not be a command!
|
@@ -28,9 +28,8 @@ module Mysh
|
|
28
28
|
|
29
29
|
end
|
30
30
|
|
31
|
-
#Execute command line options.
|
32
|
-
|
33
|
-
#* :reek:TooManyStatements
|
31
|
+
# Execute command line options.
|
32
|
+
# Endemic Code Smells :reek:TooManyStatements
|
34
33
|
def self.process_command_args(args, phase)
|
35
34
|
read_point = args.each
|
36
35
|
|
@@ -56,5 +55,6 @@ module Mysh
|
|
56
55
|
|
57
56
|
end
|
58
57
|
|
59
|
-
#Load up the extra help actions!
|
60
|
-
|
58
|
+
# Load up the extra help actions!
|
59
|
+
path = MYSH_LIB + "mysh/command_line/*.rb"
|
60
|
+
Dir[path].each {|file| require file }
|
@@ -1,38 +1,36 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The mysh help command debug.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
|
6
|
+
# The mysh help command debug.
|
7
7
|
class DebugOption < CommandOption
|
8
8
|
|
9
|
-
#Execute the help command line option.
|
10
|
-
|
11
|
-
#* :reek:UtilityFunction
|
9
|
+
# Execute the help command line option.
|
10
|
+
# Endemic Code Smells :reek:UtilityFunction
|
12
11
|
def post_boot(_args)
|
13
12
|
MNV[:debug] = "on"
|
14
13
|
end
|
15
14
|
|
16
15
|
end
|
17
16
|
|
18
|
-
#Add the debug command line option to the library.
|
17
|
+
# Add the debug command line option to the library.
|
19
18
|
desc = 'Turn on mysh debugging.'
|
20
19
|
COMMAND_LINE.add_action(DebugOption.new('--debug', desc))
|
21
20
|
COMMAND_LINE.add_action(DebugOption.new('-d', desc))
|
22
21
|
|
23
|
-
|
22
|
+
# The mysh help command no debug.
|
24
23
|
class NoDebugOption < CommandOption
|
25
24
|
|
26
|
-
#Execute the help command line option.
|
27
|
-
|
28
|
-
#* :reek:UtilityFunction
|
25
|
+
# Execute the help command line option.
|
26
|
+
# Endemic Code Smells :reek:UtilityFunction
|
29
27
|
def post_boot(_args)
|
30
28
|
MNV[:debug] = "off"
|
31
29
|
end
|
32
30
|
|
33
31
|
end
|
34
32
|
|
35
|
-
#Add the debug command line option to the library.
|
33
|
+
# Add the debug command line option to the library.
|
36
34
|
desc = 'Turn off mysh debugging.'
|
37
35
|
COMMAND_LINE.add_action(NoDebugOption.new('--no-debug', desc))
|
38
36
|
COMMAND_LINE.add_action(NoDebugOption.new('-nd', desc))
|
@@ -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
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The mysh init and no-init commands.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
|
6
|
+
# The mysh init command.
|
7
7
|
class InitOption < CommandOption
|
8
8
|
|
9
|
-
#Skip over the argument for pre_boot.
|
9
|
+
# Skip over the argument for pre_boot.
|
10
10
|
def pre_boot(read_point)
|
11
11
|
file_name = get_arg(read_point).to_host_spec
|
12
12
|
|
@@ -19,23 +19,23 @@ module Mysh
|
|
19
19
|
mysh "load #{file_name}"
|
20
20
|
end
|
21
21
|
|
22
|
-
#Execute the init command line option.
|
22
|
+
# Execute the init command line option.
|
23
23
|
def post_boot(read_point)
|
24
24
|
get_arg(read_point)
|
25
25
|
end
|
26
26
|
|
27
27
|
end
|
28
28
|
|
29
|
-
#Add the init command line option to the library.
|
29
|
+
# Add the init command line option to the library.
|
30
30
|
desc = 'Initialize mysh by loading the specified file.'
|
31
31
|
COMMAND_LINE.add_action(InitOption.new('--init filename', desc))
|
32
32
|
COMMAND_LINE.add_action(InitOption.new('-i filename', desc))
|
33
33
|
|
34
34
|
|
35
|
-
|
35
|
+
# The mysh no init command.
|
36
36
|
class NoInitOption < CommandOption
|
37
37
|
|
38
|
-
#Skip over the argument for pre_boot.
|
38
|
+
# Skip over the argument for pre_boot.
|
39
39
|
def pre_boot(_args)
|
40
40
|
fail "The mysh is already initialized." if $mysh_init_file
|
41
41
|
$mysh_init_file = "<none>"
|
@@ -43,7 +43,7 @@ module Mysh
|
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
|
-
#Add the no init command line option to the library.
|
46
|
+
# Add the no init command line option to the library.
|
47
47
|
desc = 'Do not load a file to initialize mysh.'
|
48
48
|
COMMAND_LINE.add_action(NoInitOption.new('--no-init', desc))
|
49
49
|
COMMAND_LINE.add_action(NoInitOption.new('-ni', desc))
|