🢀︎ mzk :: cea16c6


commit cea16c62d2647e5ecb1440e16bc2701d6d8660d5
Author: acidvegas <acid.vegas@acid.vegas>
Date:   Thu Jul 25 02:10:33 2019 -0400

    added argument parsing to interact with the functions

diff --git a/mzk/main.py b/mzk/main.py
index ab013d2..e836018 100644
--- a/mzk/main.py
+++ b/mzk/main.py
@@ -2,5 +2,42 @@
 # mzk music theory helper - developed by acidvegas in python (https://acid.vegas/mzk)
 # main.py
 
-import argparser
-import sys
\ No newline at end of file
+import sys
+
+sys.dont_write_bytecode = True
+
+import constants
+import functions
+
+if len(sys.argv) != 2:
+	functions.print_help()
+else:
+	sys.argv[1] = sys.argv[1].lower()
+	if sys.argv[1].startswith('--chord='):
+		chord = sys.argv[1][8:]
+		key   = chord.split('_')[0]
+		type  = chord[len(key)+1:]
+		if key in constants.notes and type in constants.scales:
+			functions.print_chord(key, type)
+		else:
+			print('error: invalid key or chord type\n\n')
+			functions.print_help()
+	elif sys.argv[1] == '--chords':
+		functions.print_chords()
+	elif sys.argv[1] == '--circle':
+		functions.print_circle()
+	elif sys.argv[1] == '--intervals':
+		functions.print_intervals()
+	elif sys.argv[1].startswith('--scale='):
+		scale = sys.argv[1][8:]
+		key   = scale.split('_')[0]
+		type  = scale[len(key)+1:]
+		if key in constants.notes and type in constants.scales:
+			functions.print_scale(key, type)
+		else:
+			print('error: invalid key or chord type\n\n')
+			functions.print_help()
+	elif sys.argv[1] == '--scales':
+		functions.print_scales()
+	else:
+		functions.print_help()
\ No newline at end of file