class Bootsnap::CLI

def parser

def parser
  @parser ||= OptionParser.new do |opts|
    opts.banner = "Usage: bootsnap COMMAND [ARGS]"
    opts.separator ""
    opts.separator "GLOBAL OPTIONS"
    opts.separator ""
    help = <<~EOS
      Path to the bootsnap cache directory. Defaults to tmp/cache
    EOS
    opts.on('--cache-dir DIR', help.strip) do |dir|
      self.cache_dir = dir
    end
    help = <<~EOS
      Print precompiled paths.
    EOS
    opts.on('--verbose', '-v', help.strip) do
      self.verbose = true
    end
    help = <<~EOS
      Number of workers to use. Default to number of processors, set to 0 to disable multi-processing.
    EOS
    opts.on('--jobs JOBS', '-j', help.strip) do |jobs|
      self.jobs = Integer(jobs)
    end
    opts.separator ""
    opts.separator "COMMANDS"
    opts.separator ""
    opts.separator "    precompile [DIRECTORIES...]: Precompile all .rb files in the passed directories"
    help = <<~EOS
      Precompile the gems in Gemfile
    EOS
    opts.on('--gemfile', help) { self.compile_gemfile = true }
    help = <<~EOS
      Path pattern to not precompile. e.g. --exclude 'aws-sdk|google-api'
    EOS
    opts.on('--exclude PATTERN', help) { |pattern| exclude_pattern(pattern) }
    help = <<~EOS
      Disable ISeq (.rb) precompilation.
    EOS
    opts.on('--no-iseq', help) { self.iseq = false }
    help = <<~EOS
      Disable YAML precompilation.
    EOS
    opts.on('--no-yaml', help) { self.yaml = false }
  end
end