carloscuesta / gitmoji-cli

A gitmoji interactive cli tool for using emojis on commits. 💻
https://www.npmjs.com/package/gitmoji-cli
MIT License
4.61k stars 206 forks source link

Warn the user if they are not in a git repo - bail out gracefully #1275

Closed mikelinhas closed 7 months ago

mikelinhas commented 7 months ago

Description of the problem

When the tool is used outside a repo, it breaks and prints out the stdout from the caught error.

Solution

Before running the create commit command (for example), first check if the user is in a git repository.

Alternatives

This could be done before asking the user for input, since we know the tool will fail outside a repo.

Additional context

I saw there is a Typescript migration proposal for this repo. I programmed it with Flow, or at least I think I did, since I have no prior knowledge of Flow.

Validations