exe/technologist in technologist-0.4.0 vs exe/technologist in technologist-0.5.0

- old
+ new

@@ -1,22 +1,53 @@ #!/usr/bin/env ruby require "technologist" +require "slop" def framework_report(title, frameworks) return if frameworks.empty? puts title frameworks.each do |framework| puts "* #{framework}" end end -path = ARGV[0] || Dir.pwd +def main(path) + result = Technologist::Repository.new(path) -result = Technologist::Repository.new(path) + if result.primary_frameworks.empty? && result.secondary_frameworks.empty? + puts "No known frameworks could be detected." + puts <<-END.gsub(/^ {4}/, '') -if result.primary_frameworks.empty? && result.secondary_frameworks.empty? - puts "No known frameworks could be detected." -else - framework_report('Primary Frameworks', result.primary_frameworks) - framework_report('Secondary Frameworks', result.secondary_frameworks) + If you think that a framework should be detected for this repository + you could add a new rule by creating a pull request on Github + (see https://github.com/koffeinfrei/technologist#contributing) + or report an issue https://github.com/koffeinfrei/technologist/issues/new. + Thanks! + END + else + framework_report('Primary Frameworks', result.primary_frameworks) + framework_report('Secondary Frameworks', result.secondary_frameworks) + end +end + +Slop.parse do + banner "Usage: #{File.basename($0)} [options] [repository_path]" + + run do |opts, args| + if args.empty? + args << Dir.pwd + end + + main(args.join(' ')) + end + + on '-v', '--version', 'print the version' do + puts Technologist::VERSION + exit + end + + on '-h', '--help' do + puts help + exit + end end