From fe49a419d836f514c756be5211558de9b8859511 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Fri, 7 Jan 2022 18:27:05 +0100 Subject: Added main function to CLI, fixed CLI test mocks --- solo_tool_cli.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'solo_tool_cli.py') diff --git a/solo_tool_cli.py b/solo_tool_cli.py index b6e7817..8d53a33 100644 --- a/solo_tool_cli.py +++ b/solo_tool_cli.py @@ -1,3 +1,5 @@ +import sys + from solo_tool import SoloTool from midi_controller_launchpad_mini import MidiController @@ -5,7 +7,7 @@ class SoloToolCLI: def __init__(self, sessionJson, soloToolOverride=None, midiOverride=None): self._soloTool = SoloTool() if soloToolOverride is None else soloToolOverride self._soloTool.loadSession(sessionJson) - self._midiController = MidiController() if midiOverride is None else midiOverride + self._midiController = MidiController(self._soloTool) if midiOverride is None else midiOverride self._commands = { "song" : self._song, "midi" : self._midi @@ -32,3 +34,15 @@ class SoloToolCLI: else: print("Supported device: Novation Launchpad Mini MkII") +def main(args): + if len(args) == 0: + print("Please provide path to session file") + sys.exit(1) + + soloToolCli = SoloToolCLI(args[0]) + while(True): + commandString = input("> ") + soloToolCli.input(commandString) + +if __name__ == '__main__': + main(sys.argv[1:]) -- cgit v1.2.3