Class: ZergXcode::Plugins::Ls
- Inherits:
-
Object
- Object
- ZergXcode::Plugins::Ls
- Defined in:
- lib/zerg_xcode/plugins/ls.rb
Overview
Lists the files in an Xcode project.
Instance Method Summary collapse
Instance Method Details
#help ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/zerg_xcode/plugins/ls.rb', line 13 def help {:short => 'shows the files in a project', :long => <<"END" } Usage: ls [path] Lists all the files in the project at the given path. If no path is given, looks for a project in the current directory. END end |
#list_for(project_name) ⇒ Object
33 34 35 36 37 |
# File 'lib/zerg_xcode/plugins/ls.rb', line 33 def list_for(project_name) ZergXcode.load(project_name).all_files.map do |file| [file[:path], file[:object]['lastKnownFileType']] end end |
#run(args) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/zerg_xcode/plugins/ls.rb', line 23 def run(args) list = list_for(args.shift || '.') output = "" list.each do |entry| output << "%-20s %s\n" % [entry.last, entry.first] end print output output end |