Skip to content

Commit a4cd7c2

Browse files
authored
merge(#9): added no convention option and rewrite main decision structure
Adds the no convention 'convention'
2 parents 9016565 + a0379a2 commit a4cd7c2

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

generator.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from utils import angular_convention
77
from utils import changelog_convention
88
from utils import symphony_convention
9+
from utils import just_message
910

1011
tag = ''
1112
tag_is_lowercase = False
@@ -20,34 +21,38 @@
2021
try:
2122
config = safe_load(stream)
2223
tag, tag_is_capitalized, tag_is_lowercase, tag_is_uppercase, convention = run_config(config, tag, tag_is_capitalized, tag_is_lowercase, tag_is_uppercase, convention)
23-
if convention != '' or convention != 'custom':
24-
if convention == 'angular':
25-
print('You are using the %s convention' % convention)
26-
angular_convention()
27-
elif convention == 'changelog':
28-
print('You are using the %s convention' % convention)
29-
changelog_convention()
30-
elif convention == 'symphony':
31-
print('You are using the %s convention' % convention)
32-
symphony_convention()
33-
else:
24+
if convention == 'angular':
25+
print('You are using the %s convention' % convention)
26+
angular_convention()
27+
elif convention == 'changelog':
28+
print('You are using the %s convention' % convention)
29+
changelog_convention()
30+
elif convention == 'symphony':
31+
print('You are using the %s convention' % convention)
32+
symphony_convention()
33+
elif convention == 'none':
34+
just_message()
35+
elif convention == 'custom':
3436
custom_convention()
3537
except YAMLError as exc:
3638
print(exc)
3739

3840
else:
3941
print("No config files found!\nRunning default script...")
40-
opt = int(input("""
42+
opt = int(raw_input("""
4143
what type of commit convention are you using?
4244
43-
1- Karma/Angular
44-
2- Conventional changelog
45-
3- Symfony CMF
46-
"""))
45+
default: Just the message
46+
1: Karma/Angular
47+
2: Conventional changelog
48+
3: Symfony CMF
49+
""") or 4)
4750

4851
if opt == 1:
4952
angular_convention()
5053
elif opt == 2:
5154
changelog_convention()
5255
elif opt == 3:
5356
symphony_convention()
57+
elif opt == 4:
58+
just_message()

utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,10 @@ def symphony_convention():
5050
tag = tag.capitalize()
5151
os.system("git commit -m '[%s] %s'" % (tag, msg))
5252

53+
def just_message():
54+
msg = str(input("commit message: "))
55+
os.system("git commit -m '%s'" % msg.capitalize())
56+
57+
# FUTURE: implement
5358
def custom_convention():
5459
pass

0 commit comments

Comments
 (0)