Sha256: 710eb9239916a3d171353d37cd9ca174eaa6ef45683b4093cadce1523b97feb6

Contents?: true

Size: 1.83 KB

Versions: 1

Compression:

Stored size: 1.83 KB

Contents

#!/usr/bin/env ruby

require 'thor'
require 'xcodeproj_utils'

class CLI < Thor
  desc "xcp_utils lines PROJECT_PATH TARGET_NAME", "Count source lines of files"
  option :header_only, :type => :boolean, :default => false, :desc => 'Count only header files'
  option :source_only, :type => :boolean, :default => false, :desc => 'Count only source files'
  def lines(proj_name, target_name)
    header_only = options[:header_only]
    source_only = options[:source_only]
    proj = XcodeprojUtils::Project.new(proj_name, target_name)
    if header_only or source_only
      puts proj.wc(header_only=header_only, source_only=source_only)
    else
      puts proj.wc()
    end
  end

  desc "xcp_utils show PROJECT_PATH TARGET_NAME", "Show files in specified target"
  option :kind, :type => :string, :default => 'source', :desc => 'source or resource'
  option :fullpath, :type => :boolean, :default => false, :desc => 'full paths will be shown if specified'
  def show(proj_name, target_name)
    kind = options[:kind]
    fullpath = options[:fullpath]
    proj = XcodeprojUtils::Project.new(proj_name, target_name)
    proj.show(kind, fullpath)
  end

  desc "xcp_utils unused_images PROJECT_PATH TARGET_NAME", "Show unused images"
  option :html, :type => :boolean, :default => false, :desc => 'output as html'
  def unused_images(proj_name, target_name)
    proj = XcodeprojUtils::Project.new(proj_name, target_name)
    output_html = options[:html]

    if not output_html
      for image in proj.search_unused_images
        puts image.display_name
      end
    else
      rows = ''
      for image in proj.search_unused_images
        rows += "<tr><td>#{image.path}</td><td><img src=\"#{image.real_path}\"></td></tr>\n"
      end
      html = "<html><body bgcolor=\"#eeeeee\"><table>#{rows}</table></body></html>"
      puts html
    end
  end

end

CLI.start(ARGV)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xcodeproj_utils-0.2.3 bin/xcp_utils