Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
danthelion committed Nov 25, 2023
1 parent 2ae0923 commit 34c079e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions git_genie/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import io
import argparse
import subprocess
import sys

Expand Down Expand Up @@ -275,7 +275,7 @@ def main(


def update_commit_message(filename, mode):
with io.open(filename, "r+") as fd:
with open(filename, "r+") as fd:
contents = fd.readlines()
commit_msg = contents[0].rstrip("\r\n")

Expand All @@ -299,8 +299,12 @@ def update_commit_message(filename, mode):
replace = "replace"


def pre_commit(pre_commit_filename: str = ""):
update_commit_message(pre_commit_filename, mode="append")
def pre_commit(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument("filenames", nargs="+")
parser.add_argument("--mode", nargs="?", const=append, default=append, choices=[append, replace])
args = parser.parse_args(argv)
update_commit_message(args.filenames[0], mode="append")


if __name__ == "__main__":
Expand Down

0 comments on commit 34c079e

Please sign in to comment.