An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# [TerminalGat](https://github.com/AtelierArith/TerminalGat.jl) [![Build Status](https://github.com/AtelierArith/TerminalGat.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/AtelierArith/TerminalGat.jl/actions/workflows/CI.yml?query=branch%3Amain) [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://AtelierArith.github.io/TerminalGat.jl/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://AtelierArith.github.io/TerminalGat.jl/dev/) [![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

## TL;DR

[![Typing SVG](https://readme-typing-svg.demolab.com?font=Fira+Code&size=16&duration=1500&pause=200&color=10F748&multiline=true&width=700&height=200&lines=julia%3E+%23+How+to+use;julia%3E+using+TerminalGat;julia%3E+gat(%22main.jl%22)+;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.

image

The `@code` extracts a method definition from the source code that defines the method.

The `@gode` macro works like `@code`, but highlights Julia code.

image

### `@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