Class: VimPrinter::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/vim_printer/cli.rb

Instance Method Summary collapse

Instance Method Details



32
33
34
35
36
37
38
39
# File 'lib/vim_printer/cli.rb', line 32

def print
  opts = options.symbolize_keys
  if opts[:version]
    puts "You are using VimPrinter version #{VimPrinter::VERSION}"
    exit
  end
  execute(opts)
end

#usageObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/vim_printer/cli.rb', line 42

def usage
  puts <<-EOS
Usage:
  vim_printer

Options:
  -b, [--base-dir=BASE_DIR]                # Base directory
                                       # Default: . (current directory)
  -e, [--exts=one two three]               # List of extension to search for
                                       # e.g. -e rb md
  -f, [--non-exts=one two three]           # List of file without extension to be included in the result (optional)
                                       # e.g. -f Gemfile LICENSE
  -n, [--inc-words=one two three]          # List of word that must be part of the name to be included in the result (optional)
                                       # If this option is not specified then
                                       # all files having the extension specified by -e or all file specified by -f will be included
  -x, [--exc-words=one two three]          # List of words to be excluded from the result if any (optional)
                                       # Use this option to filter out files that contain some word in the name
                                       # e.g. -x '_spec' to exclude files that end with '*_spec.rb' in the name
  -i, [--ignore-case], [--no-ignore-case]  # Match case insensitively apply to both -f, n, and -x options (optional)
                                       # Default: --ignore-case
  -r, [--recursive], [--no-recursive]      # Search for files recursively (optional)
                                       # Default: --recursive
  -v, [--version]                          # Display version information
                                       #
  -t, [--theme=THEME]                      # Vim colorscheme to use (optional)
                                       # Default: 'default'
  -c, [--index], [--no-index]              # Generate the index.html file for the result (optional)
                                       # Default: --index
  -s, [--command]                          # Use the input file list from the result of the given shell command
                                       # Note: the command must return the list of file to be valid
                                       # This option ignore any of the following options -e, -f, -n, -x, -i if specified
                                       # e.g. --command 'git diff --name-only HEAD~2 | grep -v test'
                                       # e.g. --command 'find . -type f -iname "*.rb" | grep -v test | grep -v _spec'
Print files to (x)html using Vim
  EOS
end