lib/index_html/cli.rb in index_html-0.0.2 vs lib/index_html/cli.rb in index_html-0.0.3

- old
+ new

@@ -1,52 +1,13 @@ require 'thor' require_relative '../index_html' module IndexHtml - #TODO: this should be re-use from the 'CodeLister' module - class BaseCLI < Thor - def self.shared_options - method_option :base_dir, - aliases: "-b", - desc: "Base directory", - default: Dir.pwd - - method_option :exts, - aliases: "-e", - desc: "List of extensions to search for", - type: :array, - default: [] - - method_option :inc_words, - aliases: "-n", - desc: "List of words to be included in the result if any", - type: :array, - default: [] - - method_option :exc_words, - aliases: "-x", - desc: "List of words to be excluded from the result if any", - type: :array, - default: [] - - method_option :ignore_case, - aliases: "-i", - desc: "Match case insensitively", - type: :boolean, - default: true - - method_option :recursive, - aliases: "-r", - desc: "Search for files recursively", - type: :boolean, - default: true - end - end - - class CLI < IndexHtml::BaseCLI + class CLI < CodeLister::BaseCLI desc 'generate', 'Generate the index.html base on simple criteria' + shared_options method_option :prefix, aliases: "-p", desc: "Prefix string to the URL", @@ -61,15 +22,9 @@ method_option :output, aliases: "-o", desc: "Output file name", type: :string, default: "index.html" - - method_option :version, - aliases: "-v", - desc: "Display version information", - type: :boolean, - default: false def generate if options[:version] puts "You are using IndexHtml Version #{IndexHtml::VERSION}" exit