Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert user that they must setup git user name (git config user.name) #35

Merged
merged 2 commits into from Dec 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/cp8_cli/current_user.rb
Expand Up @@ -5,6 +5,7 @@ class CurrentUser
include Github::Api::Client

def initials
raise_error("please configure your git user.name using git config user.name Jane Doe") unless git_user_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe use
https://github.com/cookpad/cp8_cli/blob/master/lib/cp8_cli/command.rb#L36 here instead?

That will abort the program as well as showing a message to avoid the exception happening in the next line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah for sure, I don't why I didn't notice that line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in #36

git_user_name.parameterize(separator: " ").split.map(&:first).join
end

Expand All @@ -21,5 +22,9 @@ def git_user_name
def github_user
@_github_user ||= client.user
end

def raise_error(error)
Command.say("Error running: #{error}")
end
end
end