Skip to content

Commit

Permalink
[IMP] commitcli: validaciones git
Browse files Browse the repository at this point in the history
se agregan validaciones de el estado del repositorio y si existe un repositorio en el directorio
  • Loading branch information
marco-gallegos committed Jan 1, 2021
1 parent 90ed8f9 commit 8dfecd5
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions commitcli/commitcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def get_questions(self):
def get_commit_string(self):
if self.format == "odoo" or self.format not in self.formats:
return f"[{self.tag}] {self.module}: {self.header}\n\n{self.body}"
return None


def set_answers(self, answers:dict):
Expand All @@ -82,10 +83,27 @@ def get_answers(self):



def main():
def main()->bool:
commit_msg = CommitMessage()
are_there_changes = os.system("git status --short -uno")
if are_there_changes == 32768:
print("no existe un repositorio git")
return False

if are_there_changes != 0:
print("no hay cambios por ser rastreados")
return False


commit_msg.get_answers()
os.system(f"git commit -m '{commit_msg.get_commit_string()}'")
commit_string = commit_msg.get_commit_string()



if commit_string:
os.system(f"git commit -m '{commit_string}'")

return True


if __name__ == '__main__':
Expand Down

0 comments on commit 8dfecd5

Please sign in to comment.