Retrieve the value for the given key.
(ctx: click.Context, key: Any)
| 109 | @click.pass_context |
| 110 | @click.argument('key', required=True) |
| 111 | def get(ctx: click.Context, key: Any) -> None: |
| 112 | """Retrieve the value for the given key.""" |
| 113 | file = ctx.obj['FILE'] |
| 114 | |
| 115 | with stream_file(file) as stream: |
| 116 | values = dotenv_values(stream=stream) |
| 117 | |
| 118 | stored_value = values.get(key) |
| 119 | if stored_value: |
| 120 | click.echo(stored_value) |
| 121 | else: |
| 122 | exit(1) |
| 123 | |
| 124 | |
| 125 | @cli.command() |
nothing calls this directly
no test coverage detected