na 1.2.80 → 1.2.82
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/.rubocop.yml +8 -2
 - data/.rubocop_todo.yml +33 -538
 - data/CHANGELOG.md +27 -0
 - data/Gemfile +2 -0
 - data/Gemfile.lock +27 -10
 - data/README.md +66 -21
 - data/Rakefile +6 -0
 - data/bin/commands/next.rb +4 -0
 - data/bin/commands/scan.rb +84 -0
 - data/bin/commands/update.rb +291 -14
 - data/bin/na +7 -7
 - data/lib/na/action.rb +103 -38
 - data/lib/na/actions.rb +79 -77
 - data/lib/na/array.rb +11 -7
 - data/lib/na/benchmark.rb +21 -9
 - data/lib/na/colors.rb +84 -86
 - data/lib/na/editor.rb +22 -22
 - data/lib/na/hash.rb +32 -9
 - data/lib/na/help_monkey_patch.rb +9 -1
 - data/lib/na/next_action.rb +347 -305
 - data/lib/na/pager.rb +38 -14
 - data/lib/na/project.rb +14 -1
 - data/lib/na/prompt.rb +25 -3
 - data/lib/na/string.rb +94 -133
 - data/lib/na/theme.rb +37 -31
 - data/lib/na/todo.rb +153 -132
 - data/lib/na/version.rb +3 -1
 - data/lib/na.rb +1 -0
 - data/na.gemspec +4 -2
 - data/scripts/generate-fish-completions.rb +18 -21
 - data/src/_README.md +17 -5
 - data/test_performance.rb +5 -5
 - metadata +53 -24
 
    
        data/lib/na/hash.rb
    CHANGED
    
    | 
         @@ -1,15 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            class ::Hash
         
     | 
| 
      
 4 
     | 
    
         
            +
              # Convert all keys in the hash to symbols recursively
         
     | 
| 
      
 5 
     | 
    
         
            +
              #
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @return [Hash] Hash with symbolized keys
         
     | 
| 
       4 
7 
     | 
    
         
             
              def symbolize_keys
         
     | 
| 
       5 
8 
     | 
    
         
             
                each_with_object({}) { |(k, v), hsh| hsh[k.to_sym] = v.is_a?(Hash) ? v.symbolize_keys : v }
         
     | 
| 
       6 
9 
     | 
    
         
             
              end
         
     | 
| 
       7 
10 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
               
     | 
| 
       9 
     | 
    
         
            -
               
     | 
| 
       10 
     | 
    
         
            -
               
     | 
| 
       11 
     | 
    
         
            -
               
     | 
| 
       12 
     | 
    
         
            -
              ##
         
     | 
| 
      
 11 
     | 
    
         
            +
              #
         
     | 
| 
      
 12 
     | 
    
         
            +
              # Freeze all values in a hash
         
     | 
| 
      
 13 
     | 
    
         
            +
              #
         
     | 
| 
      
 14 
     | 
    
         
            +
              # @return     Hash with all values frozen
         
     | 
| 
       13 
15 
     | 
    
         
             
              def deep_freeze
         
     | 
| 
       14 
16 
     | 
    
         
             
                chilled = {}
         
     | 
| 
       15 
17 
     | 
    
         
             
                each do |k, v|
         
     | 
| 
         @@ -19,10 +21,16 @@ class ::Hash 
     | 
|
| 
       19 
21 
     | 
    
         
             
                chilled.freeze
         
     | 
| 
       20 
22 
     | 
    
         
             
              end
         
     | 
| 
       21 
23 
     | 
    
         | 
| 
      
 24 
     | 
    
         
            +
              # Freeze all values in a hash in place
         
     | 
| 
      
 25 
     | 
    
         
            +
              #
         
     | 
| 
      
 26 
     | 
    
         
            +
              # @return [Hash] Hash with all values frozen
         
     | 
| 
       22 
27 
     | 
    
         
             
              def deep_freeze!
         
     | 
| 
       23 
28 
     | 
    
         
             
                replace deep_thaw.deep_freeze
         
     | 
| 
       24 
29 
     | 
    
         
             
              end
         
     | 
| 
       25 
30 
     | 
    
         | 
| 
      
 31 
     | 
    
         
            +
              # Recursively duplicate all values in a hash
         
     | 
| 
      
 32 
     | 
    
         
            +
              #
         
     | 
| 
      
 33 
     | 
    
         
            +
              # @return [Hash] Hash with all values duplicated
         
     | 
| 
       26 
34 
     | 
    
         
             
              def deep_thaw
         
     | 
| 
       27 
35 
     | 
    
         
             
                chilled = {}
         
     | 
| 
       28 
36 
     | 
    
         
             
                each do |k, v|
         
     | 
| 
         @@ -32,12 +40,27 @@ class ::Hash 
     | 
|
| 
       32 
40 
     | 
    
         
             
                chilled.dup
         
     | 
| 
       33 
41 
     | 
    
         
             
              end
         
     | 
| 
       34 
42 
     | 
    
         | 
| 
      
 43 
     | 
    
         
            +
              # Recursively duplicate all values in a hash in place
         
     | 
| 
      
 44 
     | 
    
         
            +
              #
         
     | 
| 
      
 45 
     | 
    
         
            +
              # @return [Hash] Hash with all values duplicated
         
     | 
| 
       35 
46 
     | 
    
         
             
              def deep_thaw!
         
     | 
| 
       36 
47 
     | 
    
         
             
                replace deep_thaw
         
     | 
| 
       37 
48 
     | 
    
         
             
              end
         
     | 
| 
       38 
49 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
      
 50 
     | 
    
         
            +
              # Recursively merge two hashes, combining arrays and preferring non-nil values
         
     | 
| 
      
 51 
     | 
    
         
            +
              #
         
     | 
| 
      
 52 
     | 
    
         
            +
              # @param second [Hash] The hash to merge with
         
     | 
| 
      
 53 
     | 
    
         
            +
              # @return [Hash] The merged hash
         
     | 
| 
      
 54 
     | 
    
         
            +
              def deep_merge(second)
         
     | 
| 
      
 55 
     | 
    
         
            +
                merger = proc { |_, v1, v2|
         
     | 
| 
      
 56 
     | 
    
         
            +
                  if v1.is_a?(Hash) && v2.is_a?(Hash)
         
     | 
| 
      
 57 
     | 
    
         
            +
                    v1.merge(v2, &merger)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  elsif v1.is_a?(Array) && v2.is_a?(Array)
         
     | 
| 
      
 59 
     | 
    
         
            +
                    v1 | v2
         
     | 
| 
      
 60 
     | 
    
         
            +
                  else
         
     | 
| 
      
 61 
     | 
    
         
            +
                    [:undefined, nil, :nil].include?(v2) ? v1 : v2
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
                }
         
     | 
| 
      
 64 
     | 
    
         
            +
                merge(second.to_h, &merger)
         
     | 
| 
      
 65 
     | 
    
         
            +
              end
         
     | 
| 
       43 
66 
     | 
    
         
             
            end
         
     | 
    
        data/lib/na/help_monkey_patch.rb
    CHANGED
    
    | 
         @@ -4,7 +4,15 @@ module GLI 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Commands
         
     | 
| 
       5 
5 
     | 
    
         
             
                # Help Command Monkeypatch for paginated output
         
     | 
| 
       6 
6 
     | 
    
         
             
                class Help < Command
         
     | 
| 
       7 
     | 
    
         
            -
                   
     | 
| 
      
 7 
     | 
    
         
            +
                  # Show help output for GLI commands with paginated output
         
     | 
| 
      
 8 
     | 
    
         
            +
                  #
         
     | 
| 
      
 9 
     | 
    
         
            +
                  # @param global_options [Hash] Global CLI options
         
     | 
| 
      
 10 
     | 
    
         
            +
                  # @param options [Hash] Command-specific options
         
     | 
| 
      
 11 
     | 
    
         
            +
                  # @param arguments [Array] Command arguments
         
     | 
| 
      
 12 
     | 
    
         
            +
                  # @param out [IO] Output stream
         
     | 
| 
      
 13 
     | 
    
         
            +
                  # @param error [IO] Error stream
         
     | 
| 
      
 14 
     | 
    
         
            +
                  # @return [void]
         
     | 
| 
      
 15 
     | 
    
         
            +
                  def show_help(_global_options, options, arguments, out, error)
         
     | 
| 
       8 
16 
     | 
    
         
             
                    NA::Pager.paginate = true
         
     | 
| 
       9 
17 
     | 
    
         | 
| 
       10 
18 
     | 
    
         
             
                    command_finder = HelpModules::CommandFinder.new(@app, arguments, error)
         
     |