Skip to content

Commit

Permalink
feat(nushell): enable set_poshcontext
Browse files Browse the repository at this point in the history
resolves #5095
  • Loading branch information
Nibodhika authored and JanDeDobbeleer committed Jun 18, 2024
1 parent 0e45aa5 commit 8eb8d88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/shell/scripts/omp.nu
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ $env.PROMPT_COMMAND = { ||
$clear = (history | is-empty) or ((history | last 1 | get 0.command) == "clear")
}

if ($env.SET_POSHCONTEXT? | is-not-empty) {
do --env $env.SET_POSHCONTEXT
}

^::OMP:: print primary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)" $"--execution-time=(posh_cmd_duration)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=(posh_width)" $"--cleared=($clear)"
}

Expand Down
9 changes: 9 additions & 0 deletions website/docs/configuration/templates.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ function set_poshcontext
end
```

</TabItem>
<TabItem value="nu">

```bash
$env.SET_POSHCONTEXT = {
$env.POSH = ( date now );
}
```

</TabItem>
</Tabs>

Expand Down

0 comments on commit 8eb8d88

Please sign in to comment.