mysh 0.6.13 → 0.6.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da3781a854769fe73c280fd78399ddb6d26cdd64
4
- data.tar.gz: 8e70d3df6a194b26e639deefdff63f9cc871fe1a
3
+ metadata.gz: fe9b45ccfc710b2113e95390238826cae35710df
4
+ data.tar.gz: 14d43ffdab4f053ee59e20b09a635b35ffb5864b
5
5
  SHA512:
6
- metadata.gz: '099048a82d4c3f4e4f1f6951ec5d3bc90ad8229f22158308b2bcf1fc6a90d0f365c42a31c5fe9fa1f9c32ad609fb9c12d3a9a8d3d594128f10fbb7615902addd'
7
- data.tar.gz: bdda1b66bfa676b915be21f8a6c4b1cf20212ec8ad0e4209ac1119a2e02a5b39c6539dc2f1b8c90342a707d24be5303fc34dbea17d31e8cde7567bea8012c321
6
+ metadata.gz: 28b1ea21b39bf38530eb7a0ca8950e2b047064402f03eb23243a1e69bc1b9321f682ba9bb705d9a3096e8cebc493a819cfcf8973539c730ee9f9c86cfbf746be
7
+ data.tar.gz: a8f42fe904833ed0069ffdd20cc64e16b34877fde38eec1924b2d55ad049b99343e9e508d37a4297398589f664f141877c0e10152128483487ad024a65691f95
data/README.md CHANGED
@@ -984,3 +984,14 @@ calling attention to some aspect that could use some TLC or a suggestion or an
984
984
  idea or a comment.
985
985
 
986
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).
@@ -5,6 +5,7 @@
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'
10
11
  require 'mini_readline'
@@ -1,38 +1,36 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/command_line/debug.rb -- The mysh help command debug.
3
+ # The mysh help command debug.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/command_line/debug.rb -- The mysh help command debug.
6
+ # The mysh help command debug.
7
7
  class DebugOption < CommandOption
8
8
 
9
- #Execute the help command line option.
10
- #<br>Endemic Code Smells
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
- #* mysh/internal/actions/command_line/debug.rb -- The mysh help command no debug.
22
+ # The mysh help command no debug.
24
23
  class NoDebugOption < CommandOption
25
24
 
26
- #Execute the help command line option.
27
- #<br>Endemic Code Smells
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))
@@ -1,12 +1,12 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/command_line/init.rb -- The mysh init and no-init commands.
3
+ # The mysh init and no-init commands.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/command_line/init.rb -- The mysh init command.
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
- #* mysh/internal/actions/command_line/init.rb -- The mysh no init command.
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
- #* mysh/internal/actions/command_line/load.rb -- The mysh load command.
3
+ # The mysh load command.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/command_line/load.rb -- The mysh load command.
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))
@@ -5,9 +5,8 @@ module Mysh
5
5
  # The page pause option.
6
6
  class PauseOption < CommandOption
7
7
 
8
- #Execute the help command line option.
9
- #<br>Endemic Code Smells
10
- #* :reek:UtilityFunction
8
+ # Execute the help command line option.
9
+ # Endemic Code Smells :reek:UtilityFunction
11
10
  def post_boot(_args)
12
11
  MNV[:page_pause] = "on"
13
12
  end
@@ -18,16 +17,15 @@ module Mysh
18
17
 
19
18
  end
20
19
 
21
- #Add the pause command line option to the library.
20
+ # Add the pause command line option to the library.
22
21
  desc = 'Turn on page pauses.'
23
22
  COMMAND_LINE.add_action(PauseOption.new('--pause', desc))
24
23
 
25
24
  # The no page pause option.
26
25
  class NoPauseOption < CommandOption
27
26
 
28
- #Execute the help command line option.
29
- #<br>Endemic Code Smells
30
- #* :reek:UtilityFunction
27
+ # Execute the help command line option.
28
+ # Endemic Code Smells :reek:UtilityFunction
31
29
  def post_boot(_args)
32
30
  MNV[:page_pause] = "off"
33
31
  end
@@ -38,7 +36,7 @@ module Mysh
38
36
 
39
37
  end
40
38
 
41
- #Add the no pause command line option to the library.
39
+ # Add the no pause command line option to the library.
42
40
  desc = 'Turn off page pauses.'
43
41
  COMMAND_LINE.add_action(NoPauseOption.new('--no-pause', desc))
44
42
  end
@@ -1,43 +1,41 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/command_line/prompt.rb -- The mysh post prompt command.
3
+ # The mysh post prompt command.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/command_line/post_prompt.rb -- The mysh post prompt command.
6
+ # The mysh post prompt command.
7
7
  class PostpromptOption < 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 prompt command line option.
15
- #<br>Endemic Code Smells
16
- #* :reek:UtilityFunction
14
+ # Execute the prompt command line option.
15
+ # Endemic Code Smells :reek:UtilityFunction
17
16
  def post_boot(read_point)
18
17
  MNV[:post_prompt] = get_arg(read_point)
19
18
  end
20
19
 
21
20
  end
22
21
 
23
- #Add the post prompt command line option to the library.
22
+ # Add the post prompt command line option to the library.
24
23
  desc = 'Set the mysh line continuation prompt to "str".'
25
24
  COMMAND_LINE.add_action(PostpromptOption.new('--post-prompt "str"', desc))
26
25
  COMMAND_LINE.add_action(PostpromptOption.new('-pp "str"', desc))
27
26
 
28
- #* mysh/internal/actions/command_line/post_prompt.rb -- The mysh command no post prompt.
27
+ # The mysh command no post prompt.
29
28
  class NoPostpromptOption < CommandOption
30
29
 
31
- #Execute the no post prompt command line option.
32
- #<br>Endemic Code Smells
33
- #* :reek:UtilityFunction
30
+ # Execute the no post prompt command line option.
31
+ # Endemic Code Smells :reek:UtilityFunction
34
32
  def post_boot(_args)
35
33
  MNV[:post_prompt] = ""
36
34
  end
37
35
 
38
36
  end
39
37
 
40
- #Add the prompt command line option to the library.
38
+ # Add the prompt command line option to the library.
41
39
  desc = 'Turn off mysh post prompting.'
42
40
  COMMAND_LINE.add_action(NoPostpromptOption.new('--no-post-prompt', desc))
43
41
  COMMAND_LINE.add_action(NoPostpromptOption.new('-npp', desc))
@@ -1,43 +1,41 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/command_line/prompt.rb -- The mysh pre_prompt command.
3
+ # The mysh pre_prompt command.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/command_line/pre_prompt.rb -- The mysh pre_prompt command.
6
+ # The mysh pre_prompt command.
7
7
  class PrepromptOption < 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 prompt command line option.
15
- #<br>Endemic Code Smells
16
- #* :reek:UtilityFunction
14
+ # Execute the prompt command line option.
15
+ # Endemic Code Smells :reek:UtilityFunction
17
16
  def post_boot(read_point)
18
17
  MNV[:pre_prompt] = get_arg(read_point)
19
18
  end
20
19
 
21
20
  end
22
21
 
23
- #Add the pre prompt command line option to the library.
22
+ # Add the pre prompt command line option to the library.
24
23
  desc = 'Set the mysh pre prompt to "str".'
25
24
  COMMAND_LINE.add_action(PrepromptOption.new('--pre-prompt "str"', desc))
26
25
  COMMAND_LINE.add_action(PrepromptOption.new('-pr "str"', desc))
27
26
 
28
- #* mysh/internal/actions/command_line/pre_prompt.rb -- The mysh command no pre_prompt.
27
+ # The mysh command no pre_prompt.
29
28
  class NoPrepromptOption < CommandOption
30
29
 
31
- #Execute the no pre_prompt command line option.
32
- #<br>Endemic Code Smells
33
- #* :reek:UtilityFunction
30
+ # Execute the no pre_prompt command line option.
31
+ # Endemic Code Smells :reek:UtilityFunction
34
32
  def post_boot(_args)
35
33
  MNV[:pre_prompt] = ""
36
34
  end
37
35
 
38
36
  end
39
37
 
40
- #Add the prompt command line option to the library.
38
+ # Add the prompt command line option to the library.
41
39
  desc = 'Turn off mysh pre prompting.'
42
40
  COMMAND_LINE.add_action(NoPrepromptOption.new('--no-pre-prompt', desc))
43
41
  COMMAND_LINE.add_action(NoPrepromptOption.new('-npr', desc))
@@ -1,41 +1,40 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/command_line/prompt.rb -- The mysh prompt command.
3
+ # The mysh prompt command.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/command_line/prompt.rb -- The mysh prompt command.
6
+ # The mysh prompt command.
7
7
  class PromptOption < 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 prompt command line option.
14
+ # Execute the prompt command line option.
15
15
  def post_boot(read_point)
16
16
  MNV[:prompt] = get_arg(read_point)
17
17
  end
18
18
 
19
19
  end
20
20
 
21
- #Add the prompt command line option to the library.
21
+ # Add the prompt command line option to the library.
22
22
  desc = 'Set the mysh prompt to "str".'
23
23
  COMMAND_LINE.add_action(PromptOption.new('--prompt "str"', desc))
24
24
  COMMAND_LINE.add_action(PromptOption.new('-p "str"', desc))
25
25
 
26
- #* mysh/internal/actions/command_line/prompt.rb -- The mysh prompt command no prompt.
26
+ # The mysh prompt command no prompt.
27
27
  class NoPromptOption < CommandOption
28
28
 
29
- #Execute the no prompt command line option.
30
- #<br>Endemic Code Smells
31
- #* :reek:UtilityFunction
29
+ # Execute the no prompt command line option.
30
+ # Endemic Code Smells :reek:UtilityFunction
32
31
  def post_boot(_args)
33
32
  MNV[:prompt] = ""
34
33
  end
35
34
 
36
35
  end
37
36
 
38
- #Add the prompt command line option to the library.
37
+ # Add the prompt command line option to the library.
39
38
  desc = 'Turn off mysh prompting.'
40
39
  COMMAND_LINE.add_action(NoPromptOption.new('--no-prompt', desc))
41
40
  COMMAND_LINE.add_action(NoPromptOption.new('-np', desc))
@@ -1,19 +1,19 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/command_line/quit.rb -- The mysh quit command.
3
+ # The mysh quit command.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/command_line/quit.rb -- The mysh quit command.
6
+ # The mysh quit command.
7
7
  class QuitOption < CommandOption
8
8
 
9
- #Execute the quit command line option.
9
+ # Execute the quit command line option.
10
10
  def post_boot(_args)
11
11
  exit
12
12
  end
13
13
 
14
14
  end
15
15
 
16
- #Add the quit command line option to the library.
16
+ # Add the quit command line option to the library.
17
17
  desc = "Exit a nested mysh file or command."
18
18
  COMMAND_LINE.add_action(QuitOption.new('--quit', desc))
19
19
  end
@@ -1,19 +1,19 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/command_line/usage.rb -- The mysh help command usage.
3
+ # The mysh help command usage.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/command_line/usage.rb -- The mysh help command usage.
6
+ # The mysh help command usage.
7
7
  class UsageOption < CommandOption
8
8
 
9
- #Execute the help command line option. (Punt to error handler with no msg)
9
+ # Execute the help command line option. (Punt to error handler with no msg)
10
10
  def pre_boot(_args)
11
11
  raise MyshUsage
12
12
  end
13
13
 
14
14
  end
15
15
 
16
- #Add the usage command line option to the library.
16
+ # Add the usage command line option to the library.
17
17
  desc = 'Display mysh usage info and exit.'
18
18
 
19
19
  USAGE = UsageOption.new('--help', desc)
@@ -19,13 +19,6 @@ class Object
19
19
  raise MyshExit
20
20
  end
21
21
 
22
- # Run some code with no wuccas.
23
- def insouciant
24
- yield
25
- rescue => err
26
- err.to_s
27
- end
28
-
29
22
  # Get the latest version for the named gem. Patched code.
30
23
  def latest_version_for(name, fetcher=nil)
31
24
  dependency = Gem::Dependency.new(name)
@@ -4,7 +4,7 @@ In mysh, variables are kept that control the behavior of the shell. This simple
4
4
  command is used to set, delete, and display these variables. The basic method
5
5
  for setting a variable is:
6
6
 
7
- set $name=value
7
+ set \$name=value
8
8
 
9
9
  Where:
10
10
  * name is a word matching the regex: /[a-z][a-z0-9_]*/. Lower case only.
@@ -14,7 +14,7 @@ To erase the value of a variable, use: set $$name=
14
14
  To display the name/value of a variable, use: set $$name
15
15
  To display all variable names/values use: set
16
16
 
17
- As an escapement, the string $$$$ maps to a single $$.
17
+ As an escapement, the strings $$$$ or \\$ map to a single $$.
18
18
 
19
19
  Some variables that are used in mysh are:
20
20
 
@@ -23,8 +23,8 @@ $$date_fmt The format for the date: "%Y-%m-%d". ie: 2017-01-09
23
23
  $$debug Does the shell display additional debugging info (true/false)
24
24
  $$h The home folder's path
25
25
  $$name The name given to this mysh session.
26
- $$post_prompt The prompt used when a line is continued with a trailing \\
27
- character.
26
+ $$post_prompt The prompt used when a line is continued with a trailing \
27
+ character. By default this just a single \
28
28
  $$pre_prompt A prompt string displayed before the actual command prompt.
29
29
  Delete the pre_prompt variable to disable pre-prompting.
30
30
  $$prompt The user prompt.
@@ -1,9 +1,9 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/cd.rb -- The mysh internal cd command.
3
+ # The mysh internal cd command.
4
4
  module Mysh
5
5
 
6
- #Add the cd command to the library.
6
+ # Add the cd command to the library.
7
7
  desc = 'Change directory to the optional <dir> parameter ' +
8
8
  'or display the current working directory.'
9
9
 
@@ -1,9 +1,9 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/comment.rb -- A mysh internal comment.
3
+ # A mysh internal comment.
4
4
  module Mysh
5
5
 
6
- #Add comments to the library.
6
+ # Add comments to the library.
7
7
  desc = 'A mysh comment. No action taken'
8
8
  action = lambda {|_input| :internal}
9
9
 
@@ -1,9 +1,9 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/elapsed.rb -- The mysh internal elapsed command.
3
+ # The mysh internal elapsed command.
4
4
  module Mysh
5
5
 
6
- #Add the elapsed commands to the library.
6
+ # Add the elapsed commands to the library.
7
7
  desc = 'Execute a command and then display the elapsed time. See ?% for more.'
8
8
 
9
9
  action = lambda do |input|
@@ -1,18 +1,18 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/gls.rb -- The mysh gls (gem ls) command.
3
+ # The mysh gls (gem ls) command.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/gls.rb -- The mysh gls (gem ls) command.
6
+ # The mysh gls (gem ls) command.
7
7
  class GlsCommand < Action
8
8
 
9
- #Set up this command.
9
+ # Set up this command.
10
10
  def initialize(*args)
11
11
  super
12
12
  @report = @mask = @specs = nil
13
13
  end
14
14
 
15
- #Execute the gls command.
15
+ # Execute the gls command.
16
16
  def process_command(input)
17
17
  process_args(input.args)
18
18
  gather_gems
@@ -57,9 +57,8 @@ module Mysh
57
57
  report.puts_format_output_bullets
58
58
  end
59
59
 
60
- #Get detailed information on a gem specification.
61
- #<br>Endemic Code Smells
62
- #* :reek:UtilityFunction
60
+ # Get detailed information on a gem specification.
61
+ # Endemic Code Smells :reek:UtilityFunction
63
62
  def info(spec)
64
63
  [["name", spec.name],
65
64
  ["version", spec.version],
@@ -1,9 +1,9 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/history.rb -- The mysh internal history command.
3
+ # The mysh internal history command.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/history.rb -- The mysh internal history command.
6
+ # The mysh internal history command.
7
7
  class HistoryCommand < Action
8
8
 
9
9
  #Set up this command.
@@ -12,11 +12,11 @@ module Mysh
12
12
  @args = @history = nil
13
13
  end
14
14
 
15
- #Execute the history command.
15
+ # Execute the history command.
16
16
  def process_command(input)
17
17
  @args, @history = input.args, Mysh.input.history
18
18
 
19
- #The history command should not be part of the history.
19
+ # The history command should not be part of the history.
20
20
  @history.pop
21
21
 
22
22
  pull_index || clear_history || show_history
@@ -24,7 +24,7 @@ module Mysh
24
24
 
25
25
  private
26
26
 
27
- #Deal with history index arguments
27
+ # Deal with history index arguments
28
28
  def pull_index
29
29
  index = @args[0].to_i
30
30
 
@@ -35,7 +35,7 @@ module Mysh
35
35
  end
36
36
  end
37
37
 
38
- #Clear the history buffer.
38
+ # Clear the history buffer.
39
39
  def clear_history
40
40
  if @args[0] == 'clear'
41
41
  @history.clear
@@ -44,7 +44,7 @@ module Mysh
44
44
  end
45
45
  end
46
46
 
47
- #Just show the history.
47
+ # Just show the history.
48
48
  def show_history
49
49
  pattern = Regexp.new(@args[0] || /./)
50
50
 
@@ -55,10 +55,11 @@ module Mysh
55
55
 
56
56
  end
57
57
 
58
- #Add the history commands to the library.
58
+ # Add the history commands to the library.
59
59
  desc = 'Display the mysh command history. See ?! for more.'
60
60
  COMMANDS.add_action(HistoryCommand.new('history <arg>', desc))
61
- #The history command action object.
61
+
62
+ # The history command action object.
62
63
  HISTORY_COMMAND = HistoryCommand.new('!<arg>', desc)
63
64
  COMMANDS.add_action(HISTORY_COMMAND)
64
65
  end
@@ -1,9 +1,9 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/load.rb -- The mysh load command.
3
+ # The mysh load command.
4
4
  module Mysh
5
5
 
6
- #Add the load command to the library.
6
+ # Add the load command to the library.
7
7
  desc = "Load ruby programs, mysh scripts, " +
8
8
  "or text files into the mysh environment."
9
9
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  require 'vls'
4
4
 
5
- #* mysh/internal/actions/mls.rb -- The mysh module ls command.
5
+ # The mysh module ls command.
6
6
  module Mysh
7
7
 
8
- #Add the mls command to the library.
8
+ # Add the mls command to the library.
9
9
  desc = 'Display modules with version info. See ?mls for more.'
10
10
 
11
11
  action = lambda do |input|
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/pwd.rb -- The mysh internal pwd command.
3
+ # The mysh internal pwd command.
4
4
  module Mysh
5
5
 
6
6
  desc = 'Display the current working directory.'
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/say.rb -- A mysh internal say command.
3
+ # The mysh internal say command.
4
4
  module Mysh
5
5
 
6
6
  #Add says to the library.
@@ -1,9 +1,9 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/type.rb -- The mysh type command.
3
+ # The mysh type command.
4
4
  module Mysh
5
5
 
6
- #Add the type command to the library.
6
+ # Add the type command to the library.
7
7
  desc = 'Display one or more text files with optional support for ' +
8
8
  'embedded handlebars and shell variables. See ?type for more.'
9
9
 
@@ -1,24 +1,24 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/internal/actions/vars.rb -- The mysh internal variables commands.
3
+ # The mysh internal variables commands.
4
4
  module Mysh
5
5
 
6
- #* mysh/internal/actions/vars.rb -- The mysh internal variable commands.
6
+ # The mysh internal variable commands.
7
7
  class VarsCommand < Action
8
8
 
9
- #The mysh variable parsing regex.
9
+ # The mysh variable parsing regex.
10
10
  VAR_EXP = %r{(?<name> [a-z][a-z0-9_]*){0}
11
11
  (?<equals> =){0}
12
12
  (?<value> \S.*){0}
13
13
  \$ (\g<name> \s* (\g<equals> \s* \g<value>?)?)?}x
14
14
 
15
- #Setup an internal action.
15
+ # Setup an internal action.
16
16
  def initialize(name, description)
17
17
  @var_name = @equals = @value = nil
18
18
  super(name, description)
19
19
  end
20
20
 
21
- #Execute a command against the internal mysh variables.
21
+ # Execute a command against the internal mysh variables.
22
22
  def process_command(input)
23
23
  if (match = VAR_EXP.match(input.raw_body))
24
24
  @var_name, @equals, @value = match[:name], match[:equals], match[:value]
@@ -30,7 +30,7 @@ module Mysh
30
30
  :internal
31
31
  end
32
32
 
33
- #Do the actual work here.
33
+ # Do the actual work here.
34
34
  def do_command
35
35
  sym = @var_name.to_sym if @var_name
36
36
 
@@ -45,7 +45,7 @@ module Mysh
45
45
  end
46
46
  end
47
47
 
48
- #Display all variables neatly.
48
+ # Display all variables neatly.
49
49
  def show_all_values
50
50
  puts (MNV.keys - ['$'.to_sym])
51
51
  .sort
@@ -55,7 +55,7 @@ module Mysh
55
55
 
56
56
  end
57
57
 
58
- #The show command action object.
58
+ # The set command action object.
59
59
  desc = 'Set/query mysh variables. See ?set for more.'
60
60
  COMMANDS.add_action(VarsCommand.new('set <$name>=value', desc))
61
61
  end
@@ -19,7 +19,6 @@ module Mysh
19
19
  MNV[:page_width] = "{{ MiniTerm.width }}"
20
20
  MNV[:page_height] = "{{ MiniTerm.height }}"
21
21
  MNV[:page_pause] = "on"
22
- MNV[:page_msg] = "Press a key, a space, or q:"
23
22
 
24
23
  MNV[:history] = "on"
25
24
  MNV[:no_dups] = "on"
@@ -1,17 +1,17 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/shell_variables/shell_variable_keeper.rb -- The keeper of mysh values.
3
+ # The keeper of mysh values.
4
4
  module Mysh
5
5
 
6
- #The keeper of mysh variable values.
6
+ # The keeper of mysh variable values.
7
7
  class Keeper
8
8
 
9
- #Set up this variable
9
+ # Set up this variable
10
10
  def initialize(value="")
11
11
  @value = value
12
12
  end
13
13
 
14
- #Get the value of this variable.
14
+ # Get the value of this variable.
15
15
  def get_value(loop_check={})
16
16
  my_id = self.object_id
17
17
  fail "Mysh variable looping error." if loop_check[my_id]
@@ -21,12 +21,12 @@ module Mysh
21
21
  loop_check.delete(my_id)
22
22
  end
23
23
 
24
- #Get the source code of this variable.
24
+ # Get the source code of this variable.
25
25
  def get_source
26
26
  @value
27
27
  end
28
28
 
29
- #Set the value of this variable.
29
+ # Set the value of this variable.
30
30
  def set_value(value)
31
31
  @value = value
32
32
  end
@@ -34,4 +34,3 @@ module Mysh
34
34
  end
35
35
 
36
36
  end
37
-
@@ -1,19 +1,18 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/shell_variables/shell_variable_store.rb -- Storage for mysh variables.
3
+ # Storage for mysh variables.
4
4
  module Mysh
5
5
 
6
- #The holder of mysh variables.
6
+ # The holder of mysh variables.
7
7
  module MNV
8
- #Set up the storage hash.
8
+ # Set up the storage hash.
9
9
  @store = Hash.new { |_hash, _key| Keeper.new }
10
10
 
11
- #The shared loop checker for programmatic access.
11
+ # The shared loop checker for programmatic access.
12
12
  @loop_check = nil
13
13
 
14
- #Get the value of a variable.
15
- #<br>Endemic Code Smells
16
- #* :reek:TooManyStatements
14
+ # Get the value of a variable.
15
+ # Endemic Code Smells :reek:TooManyStatements
17
16
  def self.[](index)
18
17
  keeper = get_keeper(index)
19
18
 
@@ -28,7 +27,7 @@ module Mysh
28
27
  end
29
28
  end
30
29
 
31
- #Set the value of a variable.
30
+ # Set the value of a variable.
32
31
  def self.[]=(index, value)
33
32
  unless value.empty?
34
33
  keeper = get_keeper(index)
@@ -41,32 +40,32 @@ module Mysh
41
40
  value
42
41
  end
43
42
 
44
- #Get the value keeper of a variable.
43
+ # Get the value keeper of a variable.
45
44
  def self.get_keeper(index)
46
45
  @store[index]
47
46
  end
48
47
 
49
- #Set the value keeper of a variable.
48
+ # Set the value keeper of a variable.
50
49
  def self.set_keeper(index, keeper)
51
50
  @store[index] = keeper
52
51
  end
53
52
 
54
- #Delete the value keeper of a variable.
53
+ # Delete the value keeper of a variable.
55
54
  def self.delete_keeper(index)
56
55
  @store.delete(index)
57
56
  end
58
57
 
59
- #Get the source code of a variable.
58
+ # Get the source code of a variable.
60
59
  def self.get_source(index)
61
60
  @store[index].get_source
62
61
  end
63
62
 
64
- #Does this entry exist?
63
+ # Does this entry exist?
65
64
  def self.key?(index)
66
65
  @store.key?(index)
67
66
  end
68
67
 
69
- #Get all the keys
68
+ # Get all the keys
70
69
  def self.keys
71
70
  @store.keys
72
71
  end
@@ -1,11 +1,10 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/sources/parse.rb -- mysh general parser.
3
+ # mysh general parser.
4
4
  module Mysh
5
5
 
6
- #Parse a string into components.
7
- #<br>Endemic Code Smells
8
- #* :reek:TooManyStatements
6
+ # Parse a string into components.
7
+ # Endemic Code Smells :reek:TooManyStatements
9
8
  def self.parse_args(input)
10
9
  result, read_point = [], input.chars.each
11
10
 
@@ -24,9 +23,8 @@ module Mysh
24
23
 
25
24
  private
26
25
 
27
- #Get a string parameter.
28
- #<br>Endemic Code Smells
29
- #* :reek:TooManyStatements
26
+ # Get a string parameter.
27
+ # Endemic Code Smells :reek:TooManyStatements
30
28
  def self.get_string(read_point)
31
29
  result = ""
32
30
 
@@ -41,9 +39,8 @@ module Mysh
41
39
  [result]
42
40
  end
43
41
 
44
- #Get a parameter.
45
- #<br>Endemic Code Smells
46
- #* :reek:TooManyStatements
42
+ # Get a parameter.
43
+ # Endemic Code Smells :reek:TooManyStatements
47
44
  def self.get_parameter(first_char, read_point)
48
45
  result = first_char
49
46
 
@@ -1,12 +1,12 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/sources/smart_auto_complete.rb - An adaptive source for auto-complete.
3
+ # An adaptive source for auto-complete.
4
4
  module Mysh
5
5
 
6
- #* array_source.rb - An array as the source for auto-complete.
6
+ # An array as the source for auto-complete.
7
7
  class SmartSource
8
8
 
9
- #Create a new file/folder auto-data source. NOP
9
+ # Create a new file/folder auto-data source. NOP
10
10
  def initialize(options)
11
11
  @prefix = options[:prefix]
12
12
  @auto_source = MiniReadline::AutoFileSource.new(options)
@@ -14,7 +14,7 @@ module Mysh
14
14
  @active_source = nil
15
15
  end
16
16
 
17
- #Construct a new data list for auto-complete
17
+ # Construct a new data list for auto-complete
18
18
  def rebuild(str)
19
19
  if /(?<=\s|^)\$[a-z][a-z0-9_]*\z/ =~ str
20
20
  sym = $MATCH[1..-1].to_sym
@@ -26,7 +26,7 @@ module Mysh
26
26
  @active_source.rebuild(str)
27
27
  end
28
28
 
29
- #Get the next string for auto-complete
29
+ # Get the next string for auto-complete
30
30
  def next
31
31
  @active_source ? @active_source.next : @str
32
32
  end
@@ -1,18 +1,18 @@
1
1
  # coding: utf-8
2
2
 
3
- #* mysh/sources/string.rb -- The mysh string command source.
3
+ # The mysh string command source.
4
4
  module Mysh
5
5
 
6
- #A wrapper for a string with mysh commands.
6
+ # A wrapper for a string with mysh commands.
7
7
  class StringSource
8
8
 
9
- #Setup the string source.
9
+ # Setup the string source.
10
10
  def initialize(str)
11
11
  @eoi = false
12
12
  @read_pt = str.lines.each
13
13
  end
14
14
 
15
- #Get the initial line of command input.
15
+ # Get the initial line of command input.
16
16
  def get_command(_str="")
17
17
  @read_pt.next
18
18
  rescue StopIteration
@@ -20,10 +20,10 @@ module Mysh
20
20
  "\n"
21
21
  end
22
22
 
23
- #Set up an alias as these two are identical.
23
+ # Set up an alias as these two are identical.
24
24
  alias :get_command_extra :get_command
25
25
 
26
- #Have we reached the end of input?
26
+ # Have we reached the end of input?
27
27
  def eoi?
28
28
  @eoi
29
29
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Mysh
4
4
  # The version string of MY SHell.
5
- VERSION = "0.6.13".freeze
5
+ VERSION = "0.6.19".freeze
6
6
 
7
7
  # A brief summary of this gem.
8
8
  DESCRIPTION = "mysh -- a Ruby inspired command line shell.".freeze
@@ -23,17 +23,17 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.required_ruby_version = '>= 1.9.3'
25
25
 
26
- spec.add_development_dependency "rake", "~> 12.0"
26
+ spec.add_development_dependency "rake", ">= 12.3.3"
27
27
  spec.add_development_dependency "bundler", "~> 1.11"
28
28
  spec.add_development_dependency 'minitest', "~> 5.7"
29
- spec.add_development_dependency 'minitest_visible', "~> 0.1"
30
29
  spec.add_development_dependency 'rdoc', "~> 5.0"
31
30
  spec.add_development_dependency 'reek', "~> 5.0.2"
32
31
 
33
32
  spec.add_runtime_dependency 'mini_readline', "~> 0.9.1"
34
33
  spec.add_runtime_dependency 'mini_term', "~> 0.1.0"
35
- spec.add_runtime_dependency 'pause_output', "~> 0.1.0"
34
+ spec.add_runtime_dependency 'pause_output', "~> 0.2.0"
36
35
  spec.add_runtime_dependency 'format_output', "~> 0.1.0"
37
36
  spec.add_runtime_dependency 'vls', "~> 0.4.1"
38
- spec.add_runtime_dependency 'in_array', "~> 0.1.8"
37
+ spec.add_runtime_dependency 'in_array', ">= 1.0"
38
+ spec.add_runtime_dependency 'insouciant', "~> 0.1.0"
39
39
  end
@@ -3,14 +3,10 @@
3
3
  require_relative '../lib/mysh'
4
4
  gem 'minitest'
5
5
  require 'minitest/autorun'
6
- require 'minitest_visible'
7
6
 
8
7
  #Test the monkey patches applied to the Object class.
9
8
  class MyShellTester < Minitest::Test
10
9
 
11
- #Track mini-test progress.
12
- include MinitestVisible
13
-
14
10
  def test_that_it_has_a_version_number
15
11
  refute_nil(::Mysh::VERSION)
16
12
  assert(::Mysh::VERSION.frozen?)
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.13
4
+ version: 0.6.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-30 00:00:00.000000000 Z
11
+ date: 2020-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '12.0'
19
+ version: 12.3.3
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '12.0'
26
+ version: 12.3.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.7'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest_visible
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.1'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.1'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rdoc
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +114,14 @@ dependencies:
128
114
  requirements:
129
115
  - - "~>"
130
116
  - !ruby/object:Gem::Version
131
- version: 0.1.0
117
+ version: 0.2.0
132
118
  type: :runtime
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - "~>"
137
123
  - !ruby/object:Gem::Version
138
- version: 0.1.0
124
+ version: 0.2.0
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: format_output
141
127
  requirement: !ruby/object:Gem::Requirement
@@ -166,18 +152,32 @@ dependencies:
166
152
  version: 0.4.1
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: in_array
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '1.0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '1.0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: insouciant
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 0.1.8
173
+ version: 0.1.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 0.1.8
180
+ version: 0.1.0
181
181
  description: mysh -- a Ruby inspired command shell for CLI and application use.
182
182
  email:
183
183
  - peter.c.camilleri@gmail.com