#!/usr/bin/env ruby require 'thor' require 'colorize' module NewTerminal class CLI < Thor default_task :open desc 'version', 'version' def version puts '0.0.1'.green end desc 'open [DIR]', 'open new terminal on DIR or pwd' def open(*argv) if argv[0]==nil pwd = Dir.pwd else pwd = File.realdirpath(argv[0]) end system "osascript -e 'tell application \"Terminal\" to do script \"cd #{pwd} \" '" end end end NewTerminal::CLI.start(ARGV)