scripts: zephyr_flash_debug: refactor Nios II runner

Prep work for adding debug and debugserver support. No significant
functional differences.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
diff --git a/scripts/support/zephyr_flash_debug.py b/scripts/support/zephyr_flash_debug.py
index 343775b..2c463aa 100755
--- a/scripts/support/zephyr_flash_debug.py
+++ b/scripts/support/zephyr_flash_debug.py
@@ -542,7 +542,7 @@
         return command == 'flash' and shell_script == 'nios2.sh'
 
     def create_from_env(command, debug):
-        '''Create flasher from environment.
+        '''Create runner from environment.
 
         Required:
 
@@ -559,9 +559,15 @@
         return Nios2BinaryRunner(hex_, cpu_sof, zephyr_base, debug=debug)
 
     def run(self, command, **kwargs):
-        if command != 'flash':
-            raise ValueError('only flash is supported')
+        if command not in {'flash', 'debug', 'debugserver'}:
+            raise ValueError('{} is not supported'.format(command))
 
+        if command == 'flash':
+            self.flash(**kwargs)
+        else:
+            self.debug_debugserver(command, **kwargs)
+
+    def flash(self, **kwargs):
         cmd = [path.join(self.zephyr_base, 'scripts', 'support',
                          'quartus-flash.py'),
                '--sof', self.cpu_sof,
@@ -569,6 +575,9 @@
 
         check_call(cmd, self.debug)
 
+    def debug_debugserver(command, **kwargs):
+        raise NotImplementedError()
+
 
 class NrfJprogBinaryRunner(ZephyrBinaryRunner):
     '''Runner front-end for nrfjprog.'''