class Dotfiler::CLI::Commands::Remove
Public Instance Methods
call(name:)
click to toggle source
# File lib/dotfiler/cli/commands/remove.rb, line 11 def call(name:) handle_errors do validate_name!(name) dotfile = dotfiles.find(name) info("Removing symlink (#{dotfile.link})...") remover.call(dotfile.link) info("Restoring dotfile (#{dotfile.path}) to its original location (#{dotfile.link})...") mover.call(dotfile.path, dotfile.link) info("Removing '#{name}' from dotfiles...") dotfiles.remove!(name) end end
Private Instance Methods
validate_name!(name)
click to toggle source
# File lib/dotfiler/cli/commands/remove.rb, line 31 def validate_name!(name) return if dotfiles.exists?(name) shell.terminate(:error, message: "Dotfile with the name '#{name}' does not exist") end