Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions golioth/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,24 @@ async def delete(config, tag_id):
sys.exit(1)


@cli.group()
def projects():
"""Projects related commands."""
pass


@projects.command()
@pass_config
async def list(config):
"""List projects."""
with console.status('Getting projects...'):
client = Client(api_url = config.api_url, api_key = config.api_key, access_token = config.access_token)
projects = await client.get_projects()

for p in projects:
print(p)


def main():
cli(_anyio_backend='trio')

Expand Down
3 changes: 3 additions & 0 deletions golioth/golioth.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def __init__(self, client: Client, info: dict[str, Any]):
self.ota_events: ProjectOTAEvents = ProjectOTAEvents(self)
self.tags: ProjectTags = ProjectTags(self)

def __repr__(self) -> str:
return f'Project <id={self.id}, organization={self.organization}>'

@property
def headers(self) -> Dict[str, str]:
return self.client.headers
Expand Down