Class: ZergXcode::Plugins::Ls
- Inherits:
-
Object
- Object
- ZergXcode::Plugins::Ls
- Defined in:
- lib/zerg_xcode/plugins/ls.rb
Instance Method Summary collapse
Instance Method Details
#help ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/zerg_xcode/plugins/ls.rb', line 2 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
22 23 24 25 26 |
# File 'lib/zerg_xcode/plugins/ls.rb', line 22 def list_for(project_name) ZergXcode.load(project_name).all_files.map do |file| [file[:path], file[:object]['lastKnownFileType']] end end |
#run(args) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/zerg_xcode/plugins/ls.rb', line 12 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 |