Sha256: 929b6e93b231c9ff5b65922754f8042b52a34fccb823f3870dc9d52064a604b5

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

module Dots
  class Command < Thor
    include FileUtils

    default_task :usage

    desc :usage, "Show usage information"
    def usage
      say <<-TEXT

The DOTS Project

DOTS is a ZSH Framework for managing your dotfiles and other shell configuration.
It also gives you some nice, sensible defaults and time-saver aliases to better
work with and understand your shell environment.

The following tasks are meant to help you use the shell more efficiently...

      TEXT

      help
    end

    desc :update, "Update DOTS to the latest version"
    def update
      %x(cd ~/.dots && git pull origin master)
    end

    desc :version, "Show the current version of DOTS"
    def version
      say "DOTS version #{Dots::VERSION} - http://tubbo.github.com/dots"
    end

    desc :persist, "Copy a dotfile to .dots/config and symlink the original location"
    def persist file_name
      dot_file = Dots::DotFile.new file_name

      if dot_file.save
        say "#{dot_file} saved to DOTS!"
      else
        say "Error: #{dot_file} could not be symlinked:"
        dot_file.errors.full_messages.each { |msg| say "- #{msg}" }
      end
    end

    desc :forget, "Remove the symlink and restore a dotfile back to its original location"
    def forget file_name
      dot_file = Dots::DotFile.find file_name

      if dot_file.destroy
        say "#{dot_file} is no longer being persisted."
      else
        say "Error: #{dot_file} could not be forgotten:"
        dot_file.errors.full_messages.each { |msg| say "- #{msg}" }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zsh_dots-0.5.0 lib/ruby/dots/command.rb