Class: BulldozeRenamer::Shell
- Inherits:
-
Object
- Object
- BulldozeRenamer::Shell
- Defined in:
- lib/bulldoze_renamer/shell.rb
Constant Summary collapse
- BANNER =
"usage: \#{$0} path CurrentNameInCamelCase TargetName\n\nWill do a crude renaming of everything in the current directory. It\nuses `git ls-files` to find the files so only things checked into\ngit are subject to change.\n\nThis script is still potentially dangerous, use with caution.\n\nBy default only an overview is shown of what changes will be made\nin what files. To actually perform those changes, pass the '-p'\noption.\n"
Class Method Summary collapse
Class Method Details
.start(argv, out: STDOUT, err: STDERR) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bulldoze_renamer/shell.rb', line 24 def self.start(argv, out: STDOUT, err: STDERR) = { current_name: nil, target_name: nil, perform: false } OptionParser.new do |parser| parser. = BANNER parser.on("-p", "--perform", "Perform the substitutions on the files") do |perform| [:perform] = perform end end.parse! argv unless argv.size == 3 self.usage(err: err) end [:path] = argv[0] [:current_name] = argv[1] [:target_name] = argv[2] RenamingOrchestrator.(, out: out, err: err) end |
.usage(err: STDERR) ⇒ Object
19 20 21 22 |
# File 'lib/bulldoze_renamer/shell.rb', line 19 def self.usage(err: STDERR) err.puts BANNER exit 1 end |