code_lister 0.0.4 → 0.0.5
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 +4 -0
 - data/lib/code_lister/cli.rb +43 -38
 - data/lib/code_lister/main.rb +1 -2
 - data/lib/code_lister/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: dd7f9ad0380a230d4dccd591b283d0fed360832b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b4165437330aff861d9af903ec77e15d4e1ad3dc
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: bf2527f11af7c5b6d9f2363c2a52f859db786a2c74776db90f561bb0b680ee1596623056a6f72de5d65e597b418c4942bb919a266117f9293f04ef042b733c58
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: bae0153c61986aa011960c60552a60b91e2a75d9edad2f2f12bc3b8e3a9f767c164dcdb260b66c86e0bd73c4ab29b4e9f698963e49a0e88da8613f315bc2e67f
         
     | 
    
        data/README.md
    CHANGED
    
    
    
        data/lib/code_lister/cli.rb
    CHANGED
    
    | 
         @@ -2,57 +2,62 @@ require 'thor' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require_relative 'core_ext/hash'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            module CodeLister
         
     | 
| 
       5 
     | 
    
         
            -
              class  
     | 
| 
      
 5 
     | 
    
         
            +
              class BaseCLI < Thor
         
     | 
| 
      
 6 
     | 
    
         
            +
                def self.shared_options
         
     | 
| 
      
 7 
     | 
    
         
            +
                  method_option :base_dir,
         
     | 
| 
      
 8 
     | 
    
         
            +
                                aliases: "-b",
         
     | 
| 
      
 9 
     | 
    
         
            +
                                desc: "Base directory",
         
     | 
| 
      
 10 
     | 
    
         
            +
                                default: Dir.pwd
         
     | 
| 
       6 
11 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
                  method_option :exts,
         
     | 
| 
      
 13 
     | 
    
         
            +
                                aliases: "-e",
         
     | 
| 
      
 14 
     | 
    
         
            +
                                desc: "List of extensions to search for",
         
     | 
| 
      
 15 
     | 
    
         
            +
                                type: :array,
         
     | 
| 
      
 16 
     | 
    
         
            +
                                default: []
         
     | 
| 
       8 
17 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
                  method_option :inc_words,
         
     | 
| 
      
 19 
     | 
    
         
            +
                                aliases: "-n",
         
     | 
| 
      
 20 
     | 
    
         
            +
                                desc: "List of words to be included in the result if any",
         
     | 
| 
      
 21 
     | 
    
         
            +
                                type: :array,
         
     | 
| 
      
 22 
     | 
    
         
            +
                                default: []
         
     | 
| 
       13 
23 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
                  method_option :exc_words,
         
     | 
| 
      
 25 
     | 
    
         
            +
                                aliases: "-x",
         
     | 
| 
      
 26 
     | 
    
         
            +
                                desc: "List of words to be excluded from the result if any",
         
     | 
| 
      
 27 
     | 
    
         
            +
                                type: :array,
         
     | 
| 
      
 28 
     | 
    
         
            +
                                default: []
         
     | 
| 
       19 
29 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 30 
     | 
    
         
            +
                  method_option :ignore_case,
         
     | 
| 
      
 31 
     | 
    
         
            +
                                aliases: "-i",
         
     | 
| 
      
 32 
     | 
    
         
            +
                                desc: "Match case insensitively",
         
     | 
| 
      
 33 
     | 
    
         
            +
                                type: :boolean,
         
     | 
| 
      
 34 
     | 
    
         
            +
                                default: true
         
     | 
| 
       25 
35 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 36 
     | 
    
         
            +
                  method_option :recursive,
         
     | 
| 
      
 37 
     | 
    
         
            +
                                aliases: "-r",
         
     | 
| 
      
 38 
     | 
    
         
            +
                                desc: "Search for files recursively",
         
     | 
| 
      
 39 
     | 
    
         
            +
                                type: :boolean,
         
     | 
| 
      
 40 
     | 
    
         
            +
                                default: true
         
     | 
| 
       31 
41 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
      
 42 
     | 
    
         
            +
                  method_option :version,
         
     | 
| 
      
 43 
     | 
    
         
            +
                                aliases: "-v",
         
     | 
| 
      
 44 
     | 
    
         
            +
                                desc: "Display version information",
         
     | 
| 
      
 45 
     | 
    
         
            +
                                type: :boolean,
         
     | 
| 
      
 46 
     | 
    
         
            +
                                default: false
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
            end
         
     | 
| 
       37 
50 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                              desc: "Search for files recursively",
         
     | 
| 
       41 
     | 
    
         
            -
                              type: :boolean,
         
     | 
| 
       42 
     | 
    
         
            -
                              default: true
         
     | 
| 
      
 51 
     | 
    
         
            +
            module CodeLister
         
     | 
| 
      
 52 
     | 
    
         
            +
              class CLI < CodeLister::BaseCLI
         
     | 
| 
       43 
53 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                 
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                              desc: "Display version information",
         
     | 
| 
       47 
     | 
    
         
            -
                              type: :boolean,
         
     | 
| 
       48 
     | 
    
         
            -
                              default: false
         
     | 
| 
      
 54 
     | 
    
         
            +
                desc "find", "List files by extensions, patterns, and simple criteria"
         
     | 
| 
      
 55 
     | 
    
         
            +
                shared_options
         
     | 
| 
       49 
56 
     | 
    
         
             
                def find
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
57 
     | 
    
         
             
                  if options[:version]
         
     | 
| 
       52 
58 
     | 
    
         
             
                    puts "You are using CodeLister Version #{CodeLister::VERSION}"
         
     | 
| 
       53 
59 
     | 
    
         
             
                    exit
         
     | 
| 
       54 
60 
     | 
    
         
             
                  end
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
61 
     | 
    
         
             
                  CodeLister::Main.run(options.symbolize_keys)
         
     | 
| 
       57 
62 
     | 
    
         
             
                end
         
     | 
| 
       58 
63 
     | 
    
         | 
    
        data/lib/code_lister/main.rb
    CHANGED
    
    | 
         @@ -4,10 +4,9 @@ module CodeLister 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
                  def run(options = {})
         
     | 
| 
       6 
6 
     | 
    
         
             
                    args = default_options.merge(options)
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
7 
     | 
    
         
             
                    files = CodeLister.files(args)
         
     | 
| 
       9 
8 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
                     
     | 
| 
      
 9 
     | 
    
         
            +
                    # Now filter out the list if any
         
     | 
| 
       11 
10 
     | 
    
         
             
                    inc_words = args.fetch(:inc_words, [])
         
     | 
| 
       12 
11 
     | 
    
         
             
                    exc_words = args.fetch(:exc_words, [])
         
     | 
| 
       13 
12 
     | 
    
         | 
    
        data/lib/code_lister/version.rb
    CHANGED