Skip to content

Commit

Permalink
docs: Add more in depth sessions shell function
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin Blackman committed Dec 18, 2023
1 parent 51266b2 commit c160fdb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,33 @@ nicely using [Ripgrep](https://github.com/BurntSushi/ripgrep) and [FZF](https://

```bash
function oatmeal-sessions() {
current=$(pwd)
(
cd "$(oatmeal sessions dir)"
id=$(rg --color always -n . | fzf --ansi | awk -F ':' '{print $1}' | head -n1 | awk -F '.' '{print $1}')
oatmeal sessions open --id "$id"
)
}
```

cd "$(oatmeal sessions dir)"
id=$(rg --color always -n . | fzf --ansi | awk -F ':' '{print $1}' | head -n1 | awk -F '.' '{print $1}')
oatmeal sessions open --id "$id"
Or something a little more in depth (while hacky) that additionally uses [yq](https://github.com/mikefarah/yq) and [jq](https://github.com/jqlang/jq).

cd $current
```bash
function oatmeal-sessions() {
(
cd "$(oatmeal sessions dir)"
id=$(
ls | \
(while read f; do echo "$(cat $f)\n---\n"; done;) | \
yq -p=yaml -o=json - 2> /dev/null | \
jq -s . | \
jq -rc '. |= sort_by(.timestamp) | .[] | "\(.id):\(.timestamp):\(.state.backend_model):\(.state.editor_language):\(.state.messages[] | .text | tojson)"' | \
fzf --ansi | \
awk -F ':' '{print $1}' | \
head -n1 | \
awk -F '.' '{print $1}'
)
oatmeal sessions open --id "$id"
)
}
```

Expand Down
1 change: 1 addition & 0 deletions tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ tools/yum.sh "$OM_VERSION" "$(realpath dist)"
tools/choco.sh "$OM_VERSION" "$(realpath dist)"

# Archive and upload debug packages
ls dist-gh | while read f; do cp LICENSE THIRDPARTY.html "dist-gh/$f/"; done
tar --strip-components=2 -czf "dist/DEBUG-${OM_VERSION}_darwin_arm64.tar.gz" dist-gh/aarch64-apple-darwin/
tar --strip-components=2 -czf "dist/DEBUG-${OM_VERSION}_windows_arm64.tar.gz" dist-gh/aarch64-pc-windows-msvc/
tar --strip-components=2 -czf "dist/DEBUG-${OM_VERSION}_linux_arm64.tar.gz" dist-gh/aarch64-unknown-linux-gnu/
Expand Down

0 comments on commit c160fdb

Please sign in to comment.