Sha256: 2e5a82f5d667007f672ab41629b3365bb4cf1767bde6030792e4482b0179ffb0

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

require 'thor'
require 'agile_utils'
module CodeLister
  class CLI < Thor
    desc 'find', 'List files by extensions, patterns, and simple criteria'
    method_option *AgileUtils::Options::BASE_DIR
    method_option *AgileUtils::Options::EXTS
    method_option *AgileUtils::Options::NON_EXTS
    method_option *AgileUtils::Options::INC_WORDS
    method_option *AgileUtils::Options::EXC_WORDS
    method_option *AgileUtils::Options::IGNORE_CASE
    method_option *AgileUtils::Options::RECURSIVE
    method_option *AgileUtils::Options::VERSION
    def find
      opts = options.symbolize_keys
      if opts[:version]
        puts "You are using CodeLister Version #{CodeLister::VERSION}"
        exit
      end
      CodeLister::Main.run(opts)
    end

    # Note: we don't use help so that we can run :r !./bin/code_lister help find
    # to see the update help if we have to without commenting out
    desc 'usage', 'Display help screen'
    def usage
      puts <<-EOS
Usage:
  code_lister find [OPTIONS]

Options:
  -b, [--base-dir=BASE_DIR]                # Base directory
                                           # Default: . (current directory)
  -e, [--exts=one two three]               # List of extensions to search for
  -f, [--non-exts=one two three]           # List of extensions to search for
  -n, [--inc-words=one two three]          # List of words to be included in the result
  -x, [--exc-words=one two three]          # List of words to be excluded from the result
  -i, [--ignore-case], [--no-ignore-case]  # Match case insensitively
                                           # Default: true
  -r, [--recursive], [--no-recursive]      # Search for files recursively
                                           # Default: true
  -v, [--version], [--no-version]          # Display version information

List files by extensions, patterns, and simple criteria
      EOS
    end

    default_task :usage
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
code_lister-0.1.0 lib/code_lister/cli.rb
code_lister-0.0.9 lib/code_lister/cli.rb