Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add path per line output for db list #530

Merged
merged 5 commits into from
Dec 16, 2024
Merged

Add path per line output for db list #530

merged 5 commits into from
Dec 16, 2024

Conversation

ecooper
Copy link
Contributor

@ecooper ecooper commented Dec 16, 2024

Problem

fauna db list only outputs JSON. When running the command without the --database flag, it's pretty verbose without providing a ton of value.

Solution

If we update the output to be a path per line by default, we can simplify the output and shrink it down. --json can then output the JSON parsable version.

Because we sometimes use the account API and sometimes use FQL directly, we can only really output a shape that looks like:

{
  name: string;
  path?: string;
}

When path is unavailable, we'll output a warning message to stderr to let folks know the full path is not retrievable when using a secret.

Result

When using --database:
Screenshot 2024-12-16 at 10 03 59 AM

When using --secret:
Screenshot 2024-12-16 at 9 45 21 AM

Testing

Updated the tests for list to prove the new output formats.

@ecooper ecooper requested a review from jrodewig December 16, 2024 20:28
@jrodewig
Copy link
Contributor

Maybe not in scope here, but we may want to output a message if there are no databases in the current scope. Right now, it's just nothing — which makes sense — but I always wonder if I messed up the command.

@ecooper ecooper merged commit d04a487 into v3 Dec 16, 2024
4 checks passed
@ecooper ecooper deleted the v3-list-databases branch December 16, 2024 21:58
@mwilde345 mwilde345 mentioned this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants