class RubyNext::Commands::Base
Attributes
dry_run[R]
dry_run?[R]
Public Class Methods
new(args)
click to toggle source
# File lib/ruby-next/commands/base.rb, line 17 def initialize(args) parse! args end
run(args)
click to toggle source
# File lib/ruby-next/commands/base.rb, line 9 def run(args) new(args).run end
Public Instance Methods
base_parser() { |opts| ... }
click to toggle source
# File lib/ruby-next/commands/base.rb, line 39 def base_parser OptionParser.new do |opts| yield opts opts.on("-V", "Turn on verbose mode") do CLI.verbose = true end opts.on("--dry-run", "Print verbose output without generating files") do CLI.dry_run = true CLI.verbose = true end end end
log(msg)
click to toggle source
# File lib/ruby-next/commands/base.rb, line 29 def log(msg) return unless CLI.verbose? if CLI.dry_run? $stdout.puts "[DRY RUN] #{msg}" else $stdout.puts msg end end
parse!(*)
click to toggle source
# File lib/ruby-next/commands/base.rb, line 21 def parse!(*) raise NotImplementedError end
run()
click to toggle source
# File lib/ruby-next/commands/base.rb, line 25 def run raise NotImplementedError end