Adding in pretend options.
This commit is contained in:
@@ -7,13 +7,15 @@ class Homesick < Thor
|
|||||||
include Thor::Actions
|
include Thor::Actions
|
||||||
include Homesick::Actions
|
include Homesick::Actions
|
||||||
|
|
||||||
|
add_runtime_options!
|
||||||
|
|
||||||
|
GITHUB_NAME_REPO_PATTERN = /\A([A-Za-z_-]+)\/([A-Za-z_-]+)\Z/
|
||||||
|
|
||||||
def initialize(args=[], options={}, config={})
|
def initialize(args=[], options={}, config={})
|
||||||
super
|
super
|
||||||
self.shell = Homesick::Shell.new
|
self.shell = Homesick::Shell.new
|
||||||
end
|
end
|
||||||
|
|
||||||
GITHUB_NAME_REPO_PATTERN = /\A([A-Za-z_-]+)\/([A-Za-z_-]+)\Z/
|
|
||||||
|
|
||||||
desc "clone URI", "Clone +uri+ as a castle for homesick"
|
desc "clone URI", "Clone +uri+ as a castle for homesick"
|
||||||
def clone(uri)
|
def clone(uri)
|
||||||
empty_directory repos_dir, :verbose => false
|
empty_directory repos_dir, :verbose => false
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ class Homesick
|
|||||||
say_status :conflict, "#{destination} exists and points to #{destination.readlink}", :red
|
say_status :conflict, "#{destination} exists and points to #{destination.readlink}", :red
|
||||||
|
|
||||||
if shell.file_collision(destination) { source }
|
if shell.file_collision(destination) { source }
|
||||||
system "ln -sf #{source} #{destination}"
|
system "ln -sf #{source} #{destination}" unless options[:pretend]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
say_status :symlink, "#{source.expand_path} to #{destination.expand_path}", :green
|
say_status :symlink, "#{source.expand_path} to #{destination.expand_path}", :green
|
||||||
system "ln -s #{source} #{destination}"
|
system "ln -s #{source} #{destination}" unless options[:pretend]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user