INNER CODE UNIT · Python
startup
idoavrah/terraform-tui · src/tftui/app.py:169
async def startup(self) -> None:
"""Initialise Terraform if asked to, then load the state."""
if self.settings.run_init:
self.state_tree.loading = True
self.notify(f"Running {self.client.executable} init")
result = await self.client.init(var_files=self.settings.var_files)
if not result.ok:
self.state_tree.loading = False
self._fail(TftuiError(result.output))
return
await self._load_state()
self.refresh_workspace()
@work(exclusive=True, group="workspace")
async def refresh_workspace(self) -> None:
workspace = await self.client.current_workspace()
self.query_one("#header", AppHeader).workspace = workspace or "unknown"