tuna: Don't start the gui if a display is not available

This is intended for the getopt branch of tuna

Don't start the gui if a display is not available.

Signed-off-by: John Kacur <jkacur@redhat.com>
diff --git a/tuna-cmd.py b/tuna-cmd.py
index 38e7017..ff2920f 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -821,6 +821,12 @@
         sys.exit(2)
 
     if run_gui:
+        # Don't try to start the gui if no display is available
+        display = os.getenv("DISPLAY")
+        if not display:
+            usage()
+            return
+
         try:
             from tuna import tuna_gui
         except ImportError: