diff --git a/avalon.py b/avalon.py index 198d644..dc25134 100644 --- a/avalon.py +++ b/avalon.py @@ -227,6 +227,9 @@ def main(): import argparse parser = argparse.ArgumentParser(usage=__doc__) + parser.add_argument( + "--ls", help="List available projects.", action="store_true" + ) parser.add_argument("--root", help="Projects directory") parser.add_argument("--import", dest="import_", action="store_true", help="Import an example project into the database") @@ -239,7 +242,7 @@ def main(): parser.add_argument("--init", action="store_true", help="Establish a new project in the " "current working directory") - parser.add_argument("--load", action="store_true", + parser.add_argument("--load", nargs="?", default=False, help="Load project at the current working directory") parser.add_argument("--save", action="store_true", help="Save project from the current working directory") @@ -278,9 +281,21 @@ def main(): "avalon.inventory", "--init"]) elif kwargs.load: - returncode = forward([ - sys.executable, "-u", "-m", - "avalon.inventory", "--load"]) + returncode = forward( + [ + sys.executable, + "-u", + "-m", + "avalon.inventory", + "--load", + kwargs.load + ] + ) + + elif kwargs.load is None: + returncode = forward( + [sys.executable, "-u", "-m", "avalon.inventory", "--load"] + ) elif kwargs.save: returncode = forward([ @@ -301,6 +316,19 @@ def main(): sys.executable, "-u", "-m", "pyblish", "gui" ] + args, silent=True) + elif kwargs.ls: + print("Projects in database:") + returncode = subprocess.call( + [ + sys.executable, + "-u", + "-c", + "from avalon import io;" + "io.install();" + "print([project[\"name\"] for project in io.projects()])" + ] + ) + else: root = os.environ["AVALON_PROJECTS"] returncode = forward([ diff --git a/git/avalon-core b/git/avalon-core index ce9de34..eb14b31 160000 --- a/git/avalon-core +++ b/git/avalon-core @@ -1 +1 @@ -Subproject commit ce9de34794f05359000f4c452ce47b278b56af80 +Subproject commit eb14b317ea81fe26032ce65320ebb5f58a2d4900