Skip to content

Commit

Permalink
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/compiler/crystal/tools/init.cr
Original file line number Diff line number Diff line change
@@ -44,20 +44,27 @@ module Crystal
end

def self.fetch_author
return "[your-name-here]" unless system(WHICH_GIT_COMMAND)
`git config --get user.name`.strip
if system(WHICH_GIT_COMMAND)
user_name = `git config --get user.name`.strip
user_name = nil if user_name.empty?
end
user_name || "your-name-here"
end

def self.fetch_email
return "[your-email-here]" unless system(WHICH_GIT_COMMAND)
`git config --get user.email`.strip
if system(WHICH_GIT_COMMAND)
user_email = `git config --get user.email`.strip
user_email = nil if user_email.empty?
end
user_email || "your-email-here"
end

def self.fetch_github_name
default = "[your-github-name]"
return default unless system(WHICH_GIT_COMMAND)
github_user = `git config --get github.user`.strip
github_user.empty? ? default : github_user
if system(WHICH_GIT_COMMAND)
github_user = `git config --get github.user`.strip
github_user = nil if github_user.empty?
end
github_user || "your-github-user"
end

def self.fetch_name(opts, args)

0 comments on commit 2bff41d

Please sign in to comment.