Method: JDC::App::Files#file

Defined in:
lib/jdc/cli/app/files.rb

#fileObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jdc/cli/app/files.rb', line 12

def file
  app = input[:app]
  path = input[:path]

  file =
    with_progress("Getting file contents") do
      app.file(*path.split("/"))
    end

  if quiet?
    print file
  else
    line

    file.split("\n").each do |l|
      line l
    end
  end
rescue JFoundry::NotFound
  fail "Invalid path #{b(path)} for app #{b(app.name)}"
rescue JFoundry::FileError => e
  fail e.description
end