mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-26 13:41:02 +02:00
Rename tg-update-collection to tg-set-collection
This commit is contained in:
parent
a28e5651e6
commit
397bc50289
1 changed files with 7 additions and 7 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
"""
|
"""
|
||||||
Update collection metadata
|
Set collection metadata (creates if doesn't exist)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
@ -10,7 +10,7 @@ from trustgraph.api import Api
|
||||||
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
|
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
|
||||||
default_user = "trustgraph"
|
default_user = "trustgraph"
|
||||||
|
|
||||||
def update_collection(url, user, collection, name, description, tags):
|
def set_collection(url, user, collection, name, description, tags):
|
||||||
|
|
||||||
api = Api(url).collection()
|
api = Api(url).collection()
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@ def update_collection(url, user, collection, name, description, tags):
|
||||||
)
|
)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
print(f"Collection '{collection}' updated successfully.")
|
print(f"Collection '{collection}' set successfully.")
|
||||||
|
|
||||||
table = []
|
table = []
|
||||||
table.append(("Collection", result.collection))
|
table.append(("Collection", result.collection))
|
||||||
|
|
@ -39,18 +39,18 @@ def update_collection(url, user, collection, name, description, tags):
|
||||||
maxcolwidths=[None, 67],
|
maxcolwidths=[None, 67],
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
print(f"Failed to update collection '{collection}'.")
|
print(f"Failed to set collection '{collection}'.")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog='tg-update-collection',
|
prog='tg-set-collection',
|
||||||
description=__doc__,
|
description=__doc__,
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'collection',
|
'collection',
|
||||||
help='Collection ID to update'
|
help='Collection ID to set'
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|
@ -86,7 +86,7 @@ def main():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
update_collection(
|
set_collection(
|
||||||
url = args.api_url,
|
url = args.api_url,
|
||||||
user = args.user,
|
user = args.user,
|
||||||
collection = args.collection,
|
collection = args.collection,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue