Display all the stored key/value.
(ctx: click.Context, output_format: str)
| 91 | "which displays name=value without quotes.", |
| 92 | ) |
| 93 | def list_values(ctx: click.Context, output_format: str) -> None: |
| 94 | """Display all the stored key/value.""" |
| 95 | file = ctx.obj["FILE"] |
| 96 | |
| 97 | with stream_file(file) as stream: |
| 98 | values = dotenv_values(stream=stream) |
| 99 | |
| 100 | if output_format == "json": |
| 101 | click.echo(json.dumps(values, indent=2, sort_keys=True)) |
| 102 | else: |
| 103 | prefix = "export " if output_format == "export" else "" |
| 104 | for k in sorted(values): |
| 105 | v = values[k] |
| 106 | if v is not None: |
| 107 | if output_format in ("export", "shell"): |
| 108 | v = shlex.quote(v) |
| 109 | click.echo(f"{prefix}{k}={v}") |
| 110 | |
| 111 | |
| 112 | @cli.command(name="set") |
nothing calls this directly
no test coverage detected
searching dependent graphs…