Skip to content

Commit

Permalink
bin/tau: add export and import
Browse files Browse the repository at this point in the history
  • Loading branch information
Dastan-glitch committed Oct 27, 2023
1 parent 66349d3 commit 3c6f8d8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/tau/tau-python/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,9 @@ async def fetch_archive_task(task_refid, month_ts, server_name, port):
async def add_task_comment(refid, comment, server_name, port):
await query("set_comment", [refid, comment], server_name, int(port))
return True

async def export_to(path, server_name, port):
return await query("export", [path], server_name, int(port))

async def import_from(path, server_name, port):
return await query("import", [path], server_name, int(port))
16 changes: 16 additions & 0 deletions bin/tau/tau-python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,22 @@ async def main():
else:
print(f"You are now on \"{sys.argv[2]}\" workspace.")
return 0
elif sys.argv[1] == "export":
if len(sys.argv) == 2:
path = "~/.local/darkfi"
else:
path = sys.argv[2]
if await api.export_to(path, server_name, port):
print(f"Exported tasks successfuly to {path}")
return 0
elif sys.argv[1] == "import":
if len(sys.argv) == 2:
path = "~/.local/darkfi"
else:
path = sys.argv[2]
if await api.import_from(path, server_name, port):
print(f"Imported tasks successfuly from {path}")
return 0

try:
id = int(sys.argv[1])
Expand Down

0 comments on commit 3c6f8d8

Please sign in to comment.