#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
from ubitflashtool.cli import main
from ubitflashtool.gui import open_editor


if __name__ == "__main__":
    if len(sys.argv) > 1 and (sys.argv[1] == '-g' or sys.argv[1] == '--gui'):
        open_editor()
    else:
        main(sys.argv[1:])

@@ -85,17 +85,29 @@
 ort main
+ as cli_main
 %0A
-
 from ubi
@@ -145,34 +145,18 @@
 or%0A%0A
-%0Aif __name__ == %22__
+def 
 main
-__%22
+()
 :%0A  
@@ -271,16 +271,20 @@
         
+cli_
 main(sys
@@ -294,8 +294,47 @@
 gv%5B1:%5D)%0A
+%0Aif __name__ == %22__main__%22:%0A    main()%0A

Fix command line entry point