Make sure castle dir exists before trying to link from it, preventing empty dirs from being created.
This commit is contained in:
@@ -41,6 +41,12 @@ class Homesick < Thor
|
|||||||
|
|
||||||
desc "link NAME", "Symlinks all dotfiles from the specified castle"
|
desc "link NAME", "Symlinks all dotfiles from the specified castle"
|
||||||
def link(home)
|
def link(home)
|
||||||
|
unless castle_dir(home).exist?
|
||||||
|
say_status :error, "Castle #{home} did not exist in #{repos_dir}", :red
|
||||||
|
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
else
|
||||||
inside castle_dir(home) do
|
inside castle_dir(home) do
|
||||||
files = Pathname.glob('.*').reject{|a| [".",".."].include?(a.to_s)}
|
files = Pathname.glob('.*').reject{|a| [".",".."].include?(a.to_s)}
|
||||||
files.each do |path|
|
files.each do |path|
|
||||||
@@ -55,6 +61,8 @@ class Homesick < Thor
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
desc "list", "List cloned castles"
|
desc "list", "List cloned castles"
|
||||||
def list
|
def list
|
||||||
inside repos_dir do
|
inside repos_dir do
|
||||||
|
|||||||
Reference in New Issue
Block a user