Skip to content

Commit 086d91f

Browse files
committed
feat(file): added support to commit-helper.yml files
1 parent 56b65b9 commit 086d91f

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ optional arguments:
104104
Pass your commit context directly
105105
-ca CO_AUTHOR, --co-author CO_AUTHOR
106106
Make your friend an co-author to the commit
107-
-nf, --no-file Disables the creation of a commiter.yml file
107+
-nf, --no-file Disables the creation of a commiter.yml or commit-helper.yml file
108108
-c {angular,karma,tagged,symphony,message}, --convention {angular,karma,tagged,symphony,message}
109109
Selects a convention to be used for the commit.
110-
Required if there's no commiter.yml file.
110+
Required if there's no commiter.yml or commit-helper.yml file.
111111
-d, --debug Toggles debug option
112112
113113
```
@@ -124,7 +124,7 @@ Or if you are using this for the first time in your project:
124124
$ commit --convention tagged
125125
```
126126
127-
To work even more smoothly, have in your working directory a file named **commiter.yml**. In this file you must pass the commit convention that you want to use, following the example:
127+
To work even more smoothly, have in your working directory a file named **commiter.yml or commit-helper.yml**. In this file you must pass the commit convention that you want to use, following the example:
128128
129129
```yaml
130130
convention: angular # tag(context): commit message
@@ -146,7 +146,7 @@ convention: symphony # [Tag] commit message
146146
convention: none # Commit message
147147
```
148148
149-
In case that you or your organization does already have a commit convention that is not listed above, you can configure it in the commiter.yml file as following:
149+
In case that you or your organization does already have a commit convention that is not listed above, you can configure it in the commiter.yml or commit-helper.yml file as following:
150150
151151
```yaml
152152
convention: custom

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.4.13
1+
3.4.14

commit_helper/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from .utils.utils import parser_cli
55
from .utils.text_utils import debug
66
from .utils.file_handler import handle_file_based_commit
7+
from .utils.file_handler import get_file_path
78
from .utils.flag_commit_handler import convention_flag_handler
89
# convention imports
910
from .conventions.convention_help_handler import convention_help_handler
@@ -16,7 +17,7 @@ def main():
1617

1718
debug('args variable', args, debug_mode)
1819

19-
file_path = Path('commiter.yml')
20+
file_path = get_file_path()
2021

2122
debug('file_path', file_path, debug_mode)
2223

commit_helper/utils/file_handler.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from os import system
2+
from pathlib import Path
23
from yaml import safe_load
34
from yaml import YAMLError
45
# utils imports
@@ -44,3 +45,13 @@ def handle_file_based_commit(file_path, debug_mode, args):
4445

4546
except YAMLError as err:
4647
print(err)
48+
49+
50+
def get_file_path(): # pragma: no cover
51+
commiter = Path('commiter.yml')
52+
commit_h = Path('commit-helper.yml')
53+
54+
if commiter.exists():
55+
return commiter
56+
else:
57+
return commit_h

0 commit comments

Comments
 (0)