Sha256: 1bad1935235b884cc1fd8975dd2a0d6c2d8d82e831de1a86d15f4f8f9a4ac250

Contents?: true

Size: 1.53 KB

Versions: 2

Compression:

Stored size: 1.53 KB

Contents

module FoldersRenamer
  class CLI < Thor
    desc "rename", "Cleanup and rename folders"
    method_option "base_dir",
                  aliases: "-b",
                  desc: "Starting directory",
                  default: Dir.pwd,
                  required: true
    method_option "sep_string",
                  aliases: "-s",
                  desc: "Separtor string to use",
                  default: ".",
                  required: true
    method_option :commit,
                  type: :boolean,
                  aliases: "-c",
                  desc: "Commit your changes",
                  default: false
    method_option "version",
                  aliases: "-v",
                  desc: "Display version number"
    def rename
      opts = options.deep_symbolize_keys
      if opts[:version]
        puts "You are using FoldersRenamer version #{FoldersRenamer::VERSION}"
        exit
      end
      puts "Your options #{opts}"
      FoldersRenamer.rename(opts)
    end

    desc "usage", "Display help screen"
    def usage
      puts <<-EOS
Usage:
  folders_renamer -b, --base-dir=BASE_DIR -s, --sep-string=SEP_STRING

Options:
  -b, --base-dir=BASE_DIR        # Starting directory
                                 # Default: . (current directory)
  -s, --sep-string=SEP_STRING    # Separtor string to use
                                 # Default: .
  -c, [--commit], [--no-commit]  # Commit your changes
  -v, [--version=VERSION]        # Display version number

Cleanup and rename folders
      EOS
    end
    default_task :usage
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
folders_renamer-0.2.5 lib/folders_renamer/cli.rb
folders_renamer-0.2.4 lib/folders_renamer/cli.rb