aboutsummaryrefslogtreecommitdiffstats
path: root/src/shell/atuin.nu
diff options
context:
space:
mode:
authorVladislav Stepanov <8uk.8ak@gmail.com>2023-04-14 23:18:58 +0400
committerGitHub <noreply@github.com>2023-04-14 20:18:58 +0100
commitc05d2850420a2c163b8f62c33a6cef7c0ae1ad8d (patch)
tree2c44a44eda7e76fa74e78ac1fd02f55c1ed4d804 /src/shell/atuin.nu
parentSwitch to uuidv7 (#864) (diff)
downloadatuin-c05d2850420a2c163b8f62c33a6cef7c0ae1ad8d.zip
Workspace reorder (#868)
* Try different workspace structure Move main crate (atuin) to be on the same level with other crates in this workspace * extract common dependencies to the workspace definition * fix base64 v0.21 deprecation warning * questionable: update deps & fix chrono deprecations possible panic sites are unchanged, they're just more visible now * Revert "questionable: update deps & fix chrono deprecations" This reverts commit 993e60f8dea81a1625a04285a617959ad09a0866.
Diffstat (limited to 'src/shell/atuin.nu')
-rw-r--r--src/shell/atuin.nu44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/shell/atuin.nu b/src/shell/atuin.nu
deleted file mode 100644
index d76cba91..00000000
--- a/src/shell/atuin.nu
+++ /dev/null
@@ -1,44 +0,0 @@
-# Source this in your ~/.config/nushell/config.nu
-let-env ATUIN_SESSION = (atuin uuid)
-
-# Magic token to make sure we don't record commands run by keybindings
-let ATUIN_KEYBINDING_TOKEN = $"# (random uuid)"
-
-let _atuin_pre_execution = {||
- let cmd = (commandline)
- if ($cmd | is-empty) {
- return
- }
- if not ($cmd | str starts-with $ATUIN_KEYBINDING_TOKEN) {
- let-env ATUIN_HISTORY_ID = (atuin history start -- $cmd)
- }
-}
-
-let _atuin_pre_prompt = {||
- let last_exit = $env.LAST_EXIT_CODE
- if 'ATUIN_HISTORY_ID' not-in $env {
- return
- }
- with-env { RUST_LOG: error } {
- atuin history end $'--exit=($last_exit)' -- $env.ATUIN_HISTORY_ID | null
- }
-}
-
-def _atuin_search_cmd [...flags: string] {
- [
- $ATUIN_KEYBINDING_TOKEN,
- ([
- `commandline (RUST_LOG=error run-external --redirect-stderr atuin search`,
- ($flags | append [--interactive, --] | each {|e| $'"($e)"'}),
- `(commandline) | complete | $in.stderr | str substring ..-1)`,
- ] | flatten | str join ' '),
- ] | str join "\n"
-}
-
-let-env config = (
- $env.config | upsert hooks (
- $env.config.hooks
- | upsert pre_execution ($env.config.hooks.pre_execution | append $_atuin_pre_execution)
- | upsert pre_prompt ($env.config.hooks.pre_prompt | append $_atuin_pre_prompt)
- )
-)