1 | commit cea16c62d2647e5ecb1440e16bc2701d6d8660d5 |
2 | Author: acidvegas <acid.vegas@acid.vegas> |
3 | Date: Thu Jul 25 02:10:33 2019 -0400 |
4 | |
5 | added argument parsing to interact with the functions |
6 | --- |
7 | mzk/main.py | 41 +++++++++++++++++++++++++++++++++++++++-- |
8 | 1 file changed, 39 insertions(+), 2 deletions(-) |
9 | |
10 | diff --git a/mzk/main.py b/mzk/main.py |
11 | index ab013d2..e836018 100644 |
12 | --- a/mzk/main.py |
13 | +++ b/mzk/main.py |
14 | @@ -2,5 +2,42 @@ |
15 | # mzk music theory helper - developed by acidvegas in python (https://acid.vegas/mzk) |
16 | # main.py |
17 | |
18 | -import argparser |
19 | -import sys |
20 | +import sys |
21 | + |
22 | +sys.dont_write_bytecode = True |
23 | + |
24 | +import constants |
25 | +import functions |
26 | + |
27 | +if len(sys.argv) != 2: |
28 | + functions.print_help() |
29 | +else: |
30 | + sys.argv[1] = sys.argv[1].lower() |
31 | + if sys.argv[1].startswith('--chord='): |
32 | + chord = sys.argv[1][8:] |
33 | + key = chord.split('_')[0] |
34 | + type = chord[len(key)+1:] |
35 | + if key in constants.notes and type in constants.scales: |
36 | + functions.print_chord(key, type) |
37 | + else: |
38 | + print('error: invalid key or chord type\n\n') |
39 | + functions.print_help() |
40 | + elif sys.argv[1] == '--chords': |
41 | + functions.print_chords() |
42 | + elif sys.argv[1] == '--circle': |
43 | + functions.print_circle() |
44 | + elif sys.argv[1] == '--intervals': |
45 | + functions.print_intervals() |
46 | + elif sys.argv[1].startswith('--scale='): |
47 | + scale = sys.argv[1][8:] |
48 | + key = scale.split('_')[0] |
49 | + type = scale[len(key)+1:] |
50 | + if key in constants.notes and type in constants.scales: |
51 | + functions.print_scale(key, type) |
52 | + else: |
53 | + print('error: invalid key or chord type\n\n') |
54 | + functions.print_help() |
55 | + elif sys.argv[1] == '--scales': |
56 | + functions.print_scales() |
57 | + else: |
58 | + functions.print_help() |