mysh 0.6.11 → 0.6.17
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 -3
- data/lib/mysh.rb +15 -6
- 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/external.rb +3 -4
- data/lib/mysh/globalize.rb +5 -14
- data/lib/mysh/handlebars.rb +1 -3
- data/lib/mysh/handlebars/{string.rb → eval_handlebars.rb} +5 -3
- 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 +0 -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 +3 -3
- 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 +1 -1
- data/lib/mysh/{internal/actions/show → show}/gem.rb +0 -0
- data/lib/mysh/{internal/actions/show → show}/ruby.rb +0 -0
- data/lib/mysh/{internal/actions/show → show}/term.rb +0 -0
- 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 +5 -4
- data/tests/my_shell_tests.rb +13 -0
- metadata +81 -68
- 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: 53da978ba58c1054ea995b8f7030b44c22aa06eb
|
4
|
+
data.tar.gz: f0a858b6b172fce3d43ef4f35582e2af3c565233
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9f02dccb1a64aeb239728458725af5d19fee2ab2ced552f27ec521d9315787958d70672fb2458d6540a3da17db28473fb66b6514d604db782e7bc1558ac2ea8
|
7
|
+
data.tar.gz: b8116e3a87959ad1edee3da08baaef5458a3d446f28dbe2c1a769076ad8b42d9d25255dd26cd649a3eefb08bee64dcaeeec7f82e05d85d58ec4fab8343e5a48d
|
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,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.
|
@@ -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
@@ -5,29 +5,37 @@
|
|
5
5
|
require 'pp'
|
6
6
|
require 'English'
|
7
7
|
require 'in_array'
|
8
|
+
require 'insouciant'
|
8
9
|
require 'pause_output'
|
9
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
|
10
15
|
|
11
16
|
require_relative 'mysh/exceptions'
|
17
|
+
require_relative 'mysh/string_helpers'
|
12
18
|
require_relative 'mysh/input_wrapper'
|
13
19
|
require_relative 'mysh/user_input'
|
20
|
+
require_relative 'mysh/action'
|
21
|
+
require_relative 'mysh/action_pool'
|
14
22
|
require_relative 'mysh/internal'
|
15
23
|
require_relative 'mysh/quick'
|
16
24
|
require_relative 'mysh/external'
|
25
|
+
require_relative 'mysh/command_line'
|
17
26
|
require_relative 'mysh/system'
|
18
27
|
require_relative 'mysh/handlebars'
|
19
28
|
require_relative 'mysh/shell_variables'
|
20
|
-
require_relative 'mysh/pre_processor'
|
21
29
|
require_relative 'mysh/process'
|
22
30
|
require_relative 'mysh/globalize'
|
23
|
-
require_relative 'mysh/
|
31
|
+
require_relative 'mysh/load_init_file'
|
24
32
|
require_relative 'mysh/expression'
|
25
33
|
require_relative 'mysh/version'
|
26
34
|
|
27
|
-
#The Mysh (MY SHell) module.
|
35
|
+
# The Mysh (MY SHell) module.
|
28
36
|
module Mysh
|
29
37
|
|
30
|
-
#The actual shell method.
|
38
|
+
# The actual shell method.
|
31
39
|
def self.run(args=[])
|
32
40
|
process_command_args(args, :pre_boot)
|
33
41
|
mysh_load_init
|
@@ -40,7 +48,8 @@ module Mysh
|
|
40
48
|
end
|
41
49
|
|
42
50
|
if __FILE__ == $0
|
43
|
-
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.
|
44
52
|
end
|
45
53
|
|
46
|
-
|
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))
|
@@ -1,24 +1,24 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The mysh load command.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
|
6
|
+
# The mysh load command.
|
7
7
|
class LoadOption < 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
|
get_arg(read_point)
|
12
12
|
end
|
13
13
|
|
14
|
-
#Execute the load command line option.
|
14
|
+
# Execute the load command line option.
|
15
15
|
def post_boot(read_point)
|
16
16
|
mysh "load #{get_arg(read_point).to_host_spec}"
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
20
20
|
|
21
|
-
#Add the load command line option to the library.
|
21
|
+
# Add the load command line option to the library.
|
22
22
|
desc = 'Load the specified file into the mysh.'
|
23
23
|
COMMAND_LINE.add_action(LoadOption.new('--load filename', desc))
|
24
24
|
COMMAND_LINE.add_action(LoadOption.new('-l filename', desc))
|