Method: Fgit::CLI#ls

Defined in:
lib/fgit/cli.rb

#ls(source_branch = nil, file_name) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fgit/cli.rb', line 8

def ls(source_branch=nil, file_name)
  branch = source_branch.nil? ? "HEAD" : "#{source_branch}"

  real_file_paths = `#{ls_command(branch, file_name)}`

  if real_file_paths.empty?
    $stderr.puts "[Error] #{file_name} can not be found!<branch: #{branch}>"
  else
    puts real_file_paths
  end
  real_file_paths
end