From: Fredrik Tolf Date: Mon, 2 Apr 2018 01:43:48 +0000 (+0200) Subject: Added `list' command. X-Git-Url: http://dolda2000.com/gitweb/?p=tpkg.git;a=commitdiff_plain;h=215990533d5eccc9e8a8b571114ea6e1925b4900 Added `list' command. --- diff --git a/tpkg b/tpkg index 140ed2f..319d248 100755 --- a/tpkg +++ b/tpkg @@ -318,6 +318,23 @@ def cmd_uninstall(argv): uninstall(prefix.use, pkgname) cmds["uninstall"] = cmd_uninstall +def cmd_list(argv): + def usage(out): + out.write("usage: tpkg list NAME\n") + opts, args = getopt.getopt(argv, "") + if len(args) < 1: + usage(sys.stderr) + sys.exit(1) + pkgname = args[0] + try: + files = prefix.use.pkgfiles(pkgname) + except KeyError: + sys.stderr.write("tpkg: %s: no such package\n" % (pkgname)) + sys.exit(1) + for fn in files: + sys.stdout.write("%s\n" % pj(prefix.use.root, fn)) +cmds["list"] = cmd_list + def usage(file): file.write("usage:\ttpkg help\n") cmds["help"] = lambda argv: usage(sys.stdout)