https://github.com/atelierarith/terminalgat.jl
Wrapper of Go implementation `gat` (🐱 cat alternative written in Go.) for Julian
https://github.com/atelierarith/terminalgat.jl
golang julia julialang
Last synced: 8 months ago
JSON representation
Wrapper of Go implementation `gat` (🐱 cat alternative written in Go.) for Julian
- Host: GitHub
- URL: https://github.com/atelierarith/terminalgat.jl
- Owner: AtelierArith
- License: mit
- Created: 2024-12-01T09:16:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-23T00:00:38.000Z (over 1 year ago)
- Last Synced: 2025-01-20T22:51:15.864Z (over 1 year ago)
- Topics: golang, julia, julialang
- Language: Julia
- Homepage: https://atelierarith.github.io/TerminalGat.jl/
- Size: 230 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [TerminalGat](https://github.com/AtelierArith/TerminalGat.jl) [](https://github.com/AtelierArith/TerminalGat.jl/actions/workflows/CI.yml?query=branch%3Amain) [](https://AtelierArith.github.io/TerminalGat.jl/stable/) [](https://AtelierArith.github.io/TerminalGat.jl/dev/) [](https://github.com/JuliaTesting/Aqua.jl)
## TL;DR
[+;julia%3E+gess(%22main.jl%22)+%23+gat+%2B+less;julia%3E+%40less+%40show+x+%23+InteractiveUtils.jl;julia%3E+%40gess+%40show+x+%23+gat+%2B+%40less;julia%3E+%40code+%40show+x;julia%3E+%40gode+%40show+x+%23+gat+%2B+%40code)](https://git.io/typing-svg)
## Description
This package [TerminalGat.jl](https://github.com/AtelierArith/TerminalGat.jl) provides Julia interface for [`gat`](https://github.com/koki-develop/gat). It allows to display files and images in the Julia's REPL.
## Setup
- Install Julia. Once you've done, you can use `julia` command in your terminal.
```sh
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.10.3 (2024-04-30)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using Pkg; Pkg.add("TerminalGat")
```
## How to use
https://github.com/user-attachments/assets/6c251619-7669-4170-afe0-dbb699f39390
Our Julia package `TerminalGat.jl` exports
- `gat`
- `gess`
- `@gess`
- `@code`
- `@gode`
- `@search`
- `@gearch`
### `gat`
```julia
julia> using TerminalGat
julia> gat("Project.toml")
```
Internally, our package uses [JuliaDocs/IOCapture.jl](https://github.com/JuliaDocs/IOCapture.jl) to capture the standard output generated by the go binary `gat`.
If your terminal supports Sixel, you can print images.
```julia
julia> using TerminalGat
julia> using Plots; plot(sin); savefig("sin.png")
julia> gat("sin.png")
```
### `gess`
`gess` works something like `gat` + `less`:
```julia
julia> using TerminalGat
julia> gess("Project.toml")
```
Internally, our package uses [`ronisbr/TerminalPager.jl`](https://github.com/ronisbr/TerminalPager.jl) to scroll through content that does not fit in the screen.
### `@gess`, `@code`, `@gode`
The `@gess` macro works like `InteractiveUtils.@less`, but highlights Julia code.

The `@code` extracts a method definition from the source code that defines the method.
The `@gode` macro works like `@code`, but highlights Julia code.

### `@search`, `@gearch`
The `@search` works like [tkf/InteractiveCodeSearch.jl](https://github.com/tkf/InteractiveCodeSearch.jl) allowing us to choose the code we want to read.
The `@gearch` macro works `@seach` with `gat` feature; allowing us to read syntax highlighted code by gat.
https://github.com/user-attachments/assets/fef6b270-1ec3-4a04-a3a8-9213cb4883ee