@@ -46,10 +46,48 @@ import xdgappdir
4646import commands
4747import threading
4848import glob
49+ import colors
50+
51+ def usage ():
52+ print "Usage:"
53+ print " " , colors .BOLD , "--pack, --package" , colors .END , "<input AppDir>" , "<output AppImage>"
54+ print " " * 6 , "Create an AppImage from an AppDir"
55+ print " " , colors .BOLD , "--unpack, --extract" , colors .END , "<input AppImage>" , "<output AppDir>"
56+ print " " * 6 , "Extract an AppImage to an AppDir"
57+ print " " , colors .BOLD , "-h, --help" , colors .END
58+ print " " * 6 , "Show this help message"
59+ print " " , colors .BOLD , "<no arguments>" , colors .END
60+ print " " * 6 , "Start AppImage creation wizard"
61+
62+ for arg in sys .argv :
63+ if arg in ["--pack" , "--package" ]:
64+ if len (sys .argv ) < 4 :
65+ usage ()
66+ elif not os .path .exists (sys .argv [2 ]):
67+ print sys .argv [2 ], "doesn't exist"
68+ elif not os .path .isdir (sys .argv [2 ]):
69+ print sys .argv [2 ], "is not a directory"
70+ elif os .path .exists (sys .argv [3 ]):
71+ print sys .argv [3 ], "already exists"
72+ else :
73+ os .system (os .path .dirname (__file__ ) + "/package '%s' '%s'" % (sys .argv [2 ], sys .argv [3 ]))
74+ exit (0 )
75+ elif arg in ["--unpack" , "--extract" ]:
76+ if len (sys .argv ) < 4 :
77+ usage ()
78+ elif not os .path .exists (sys .argv [2 ]):
79+ print sys .argv [2 ], "doesn't exist"
80+ elif not os .path .isfile (sys .argv [2 ]):
81+ print sys .argv [2 ], "is not a file"
82+ elif os .path .exists (sys .argv [3 ]):
83+ print sys .argv [3 ], "already exists"
84+ else :
85+ os .system (os .path .dirname (__file__ ) + "/extract '%s' '%s'" % (sys .argv [2 ], sys .argv [3 ]))
86+ exit (0 )
87+ elif arg in ["-h" , "--help" ]:
88+ usage ()
89+ exit (0 )
4990
50- if len (sys .argv ) == 3 :
51- os .system (os .path .dirname (__file__ ) + "/package %s %s" % (sys .argv [1 ], sys .argv [2 ]))
52- exit (0 )
5391
5492import gtk , vte
5593import xdgappdir # bundled with this app
0 commit comments