Sha256: 3e1f1446d732c9eec7d40c0903974f7ed426ef32c1b9587db7827b5bbac8a82f

Contents?: true

Size: 1013 Bytes

Versions: 3

Compression:

Stored size: 1013 Bytes

Contents

#!/usr/bin/env ruby

-> { its -> { a } }
trap('INT') { exit! }

if ARGV.include?('autocomplete')
  command = ARGV.delete_if { |a| a == 'autocomplete' }
  %w{add cleanup config default init move refresh
     show status version}.select { |e| /^#{command}/ =~ e }
                         .map    { |c| puts c }
elsif ARGV.include?('init')
  require 'fileutils'

  source      = File.dirname(__FILE__) + '/../config/trooconf.yml'
  destination = Dir.home + '/.trooconf'

  if File.exist?(destination)
    puts "\nA configuration file already exists in your home " \
         "directory.\n\n"
  else
    print "\nCreating a configuration file in your home directory..."

    FileUtils.cp(source, destination)

    sleep 1 # simulate work being done
    print " done.\n\n"

    help = File.read(File.dirname(__FILE__) + '/../config/help')
    print help
  end
elsif ARGV.include?('path')
  puts File.expand_path File.dirname(__FILE__)
else
  require_relative '../lib/troo'
  Troo::Launcher.new(ARGV.dup).execute!
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troo-0.0.12 bin/troo
troo-0.0.11 bin/troo
troo-0.0.10 bin/troo