new script: atuin-context
This commit is contained in:
parent
e4f4601484
commit
f546b49599
1 changed files with 17 additions and 0 deletions
17
misc/atuin-context
Executable file
17
misc/atuin-context
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/zsh
|
||||
#dep:atuin fzf
|
||||
zparseopts -D -E A:=after_minutes B:=before_minutes C:=context_minutes
|
||||
|
||||
if [[ $context_minutes ]]; then
|
||||
after_minutes=${context_minutes[2]}
|
||||
before_minutes=${context_minutes[2]}
|
||||
else
|
||||
after_minutes=${after_minutes[2]:-5}
|
||||
before_minutes=${before_minutes[2]:-0}
|
||||
fi
|
||||
|
||||
command_timestamp=$(atuin search | fzf --tac | awk '{ print $1, $2 }' | xargs -I{} -0 date --date={} +%s)
|
||||
start_time=$(date --date=@$(( command_timestamp - before_minutes * 60)) --iso-8601=seconds)
|
||||
end_time=$(date --date=@$(( command_timestamp + after_minutes * 60)) --iso-8601=seconds)
|
||||
|
||||
atuin search --after=$start_time--before=$end_time
|
||||
Loading…
Add table
Add a link
Reference in a new issue