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
@@ -1,15 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
#* mysh/internal/actions/actions_path.rb -- A convenient hook to the actions folder.
|
4
|
-
module Mysh
|
5
|
-
|
6
|
-
#* mysh/internal/actions/actions_path.rb -- A convenient hook to the actions folder.
|
7
|
-
class Action
|
8
|
-
|
9
|
-
#Capture this folder's name.
|
10
|
-
ACTIONS_PATH = File.dirname(__FILE__) + "/"
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
#* mysh/internal/actions/command_line/quit.rb -- The mysh quit command.
|
4
|
-
module Mysh
|
5
|
-
|
6
|
-
#* mysh/internal/actions/command_line/quit.rb -- The mysh quit command.
|
7
|
-
class QuitOption < CommandOption
|
8
|
-
|
9
|
-
#Execute the quit command line option.
|
10
|
-
def post_boot(_args)
|
11
|
-
exit
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
#Add the quit command line option to the library.
|
17
|
-
desc = "Exit a nested mysh file or command."
|
18
|
-
COMMAND_LINE.add_action(QuitOption.new('--quit', desc))
|
19
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
#* mysh/internal/actions/load.rb -- The mysh load command.
|
4
|
-
module Mysh
|
5
|
-
|
6
|
-
#Add the load command to the library.
|
7
|
-
desc = "Load a ruby program, mysh script, " +
|
8
|
-
"or text file into the mysh environment."
|
9
|
-
|
10
|
-
action = lambda do |input|
|
11
|
-
args = input.args
|
12
|
-
file_name = args.shift
|
13
|
-
|
14
|
-
if file_name
|
15
|
-
file_ext = File.extname(file_name)
|
16
|
-
|
17
|
-
if file_ext == '.mysh'
|
18
|
-
Mysh.process_file(file_name)
|
19
|
-
:internal
|
20
|
-
elsif file_ext == '.txt'
|
21
|
-
show_handlebar_file(file_name, binding)
|
22
|
-
:internal
|
23
|
-
elsif file_ext == '.rb'
|
24
|
-
load file_name
|
25
|
-
:internal
|
26
|
-
else
|
27
|
-
fail "Error: Unknown file type: #{file_name.inspect}"
|
28
|
-
end
|
29
|
-
|
30
|
-
else
|
31
|
-
fail "Error: A load file must be specified."
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
COMMANDS.add_action(Action.new('load <file>', desc, &action))
|
36
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
#* mysh/internal/actions/type.rb -- The mysh type command.
|
4
|
-
module Mysh
|
5
|
-
|
6
|
-
#Add the type command to the library.
|
7
|
-
desc = 'Display a text file with support for optional embedded ' +
|
8
|
-
'handlebars and mysh variables.'
|
9
|
-
|
10
|
-
action = lambda do |input|
|
11
|
-
args = input.args
|
12
|
-
file_name = args.shift
|
13
|
-
|
14
|
-
if file_name
|
15
|
-
show_handlebar_file(file_name, binding)
|
16
|
-
else
|
17
|
-
fail "A text file must be specified."
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
COMMANDS.add_action(Action.new('type <file>', desc, &action))
|
22
|
-
end
|
data/lib/mysh/internal/manage.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
#* mysh/internal/manage.rb -- Manage mysh internal commands.
|
4
|
-
module Mysh
|
5
|
-
|
6
|
-
#Set up the command action pool.
|
7
|
-
COMMANDS = ActionPool.new("COMMANDS")
|
8
|
-
|
9
|
-
#Try to execute the string as an internal action.
|
10
|
-
def self.try_execute_internal(input)
|
11
|
-
unless input.quick_command == ' '
|
12
|
-
if (action = COMMANDS[input.raw_command])
|
13
|
-
action.process_command(input)
|
14
|
-
:internal
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
#* mysh/internal/to_host_spec.rb -- mysh internal file name beauty treatments.
|
4
|
-
class String
|
5
|
-
|
6
|
-
#Make the file name fit the local system.
|
7
|
-
def to_host_spec
|
8
|
-
self.dress_up_slashes
|
9
|
-
.dress_up_quotes
|
10
|
-
end
|
11
|
-
|
12
|
-
#Dress up slashes and backslashes.
|
13
|
-
def dress_up_slashes
|
14
|
-
MiniTerm.windows? ? self.gsub("/", "\\") : self
|
15
|
-
end
|
16
|
-
|
17
|
-
#Dress up in quotes if needed.
|
18
|
-
def dress_up_quotes
|
19
|
-
self[' '] ? "\"#{self}\"" : self
|
20
|
-
end
|
21
|
-
|
22
|
-
#Make the file name fit the standard notation.
|
23
|
-
def to_std_spec
|
24
|
-
self.gsub("\\", "/")
|
25
|
-
end
|
26
|
-
end
|
data/lib/mysh/pre_processor.rb
DELETED