Skip to content

Commit

Permalink
Merge pull request #5 from tokejepsen/#4
Browse files Browse the repository at this point in the history
List/Load Projects
  • Loading branch information
mottosso authored May 31, 2018
2 parents f2341e2 + b66db78 commit ab211ed
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
36 changes: 32 additions & 4 deletions avalon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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([
Expand All @@ -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([
Expand Down
2 changes: 1 addition & 1 deletion git/avalon-core
Submodule avalon-core updated 105 files

0 comments on commit ab211ed

Please sign in to comment.