This file is indexed.

/usr/bin/tilt is in ruby-tilt 2.0.0+really1.4.1-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 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
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env ruby
require 'ostruct'
require 'optparse'
require 'tilt'

usage = <<USAGE
Usage: tilt <options> <file>
Process template <file> and write output to stdout. With no <file> or
when <file> is '-', read template from stdin and use the --type option
to determine the template's type.

Options
  -l, --list           List template engines + file patterns and exit
  -t, --type=<pattern> Use this template engine; required if no <file>
  -y, --layout=<file>  Use <file> as a layout template

  -D<name>=<value>     Define variable <name> as <value>
  --vars=<ruby>        Evaluate <ruby> to Hash and use for variables

  -h, --help           Show this help message

Convert markdown to HTML:
  $ tilt foo.markdown > foo.html

Process ERB template:
  $ echo "Answer: <%= 2 + 2 %>" | tilt -t erb
  Answer: 4

Define variables:
  $ echo "Answer: <%= 2 + n %>" | tilt -t erb --vars="{:n=>40}"
  Answer: 42
  $ echo "Answer: <%= 2 + n.to_i %>" | tilt -t erb -Dn=40
  Answer: 42
USAGE

script_name = File.basename($0)
pattern = nil
layout = nil
locals = {}

ARGV.options do |o|
  o.program_name = script_name

  # list all available template engines
  o.on("-l", "--list") do
    groups = {}
    Tilt.mappings.each do |pattern,engines|
      engines.each do |engine|
        key = engine.name.split('::').last.sub(/Template$/, '')
        (groups[key] ||= []) << pattern
      end
    end
    groups.sort { |(k1,v1),(k2,v2)| k1 <=> k2 }.each do |engine,files|
      printf "%-15s %s\n", engine, files.sort.join(', ')
    end
    exit
  end

  # the template type / pattern
  o.on("-t", "--type=PATTERN", String) do |val|
    abort "unknown template type: #{val}" if Tilt[val].nil?
    pattern = val
  end

  # pass template output into the specified layout template
  o.on("-y", "--layout=FILE", String)  do |file|
    paths = [file, "~/.tilt/#{file}", "/etc/tilt/#{file}"]
    layout = paths.
      map  { |p| File.expand_path(p) }.
      find { |p| File.exist?(p) }
    abort "no such layout: #{file}" if layout.nil?
  end

  # define a local variable
  o.on("-D", "--define=PAIR", String) do |pair|
    key, value = pair.split(/[=:]/, 2)
    locals[key.to_sym] = value
  end

  # define local variables using a Ruby hash
  o.on("--vars=RUBY") do |ruby|
    hash = eval(ruby)
    abort "vars must be a Hash, not #{hash.inspect}" if !hash.is_a?(Hash)
    hash.each { |key, value| locals[key.to_sym] = value }
  end

  o.on_tail("-h", "--help") { puts usage; exit }

  o.parse!
end

file = ARGV.first || '-'
pattern = file if pattern.nil?
abort "template type not given. see: #{$0} --help" if ['-', ''].include?(pattern)

engine = Tilt[pattern]
abort "template engine not found for: #{pattern}" if engine.nil?

template =
  engine.new(file) {
    if file == '-'
      $stdin.read
    else
      File.read(file)
    end
  }
output = template.render(self, locals)

# process layout
output = Tilt.new(layout).render(self, locals) { output } if layout

$stdout.write(output)