Sha256: fff82f5b33b8185d203110a303f9ab78f1b0497145544d3337cc245b8921b667

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 Bytes

Contents

#!/usr/bin/env ruby
require 'fileutils'

USAGE = <<-end
Usage:
dayone --set location <PATH>
end

def usage
  puts USAGE
  exit 1
end

# Put your code here
case ARGV[0]
when '--set'
  case ARGV[1]
  when 'location'
    # Make sure location store folder exists
    dayone_folder = File.join(ENV['HOME'], '.rb-dayone')
    FileUtils::mkdir_p dayone_folder
    
    # Put our location in it
    new_dayone_location = File.expand_path(ARGV[2])
    File.open(File.join(dayone_folder, 'location'),'w'){ |io| io.puts new_dayone_location }
    
    # Let the user know
    puts "DayOne journal now located at: #{new_dayone_location}"
  else
    usage
  end
else
  usage
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rb-dayone-0.1.5 bin/dayone
rb-dayone-0.1.3 bin/dayone