aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShav Kinderlehrer <[email protected]>2023-04-22 15:33:08 -0400
committerShav Kinderlehrer <[email protected]>2023-04-22 15:33:08 -0400
commitd1bbadfbd69b12d107f108773d22c3a80f646829 (patch)
treeb2ec483cce2e93f902e2cadc67740a88f18cb6f0
parent69cf5566cf894fba541f6da4361f56f4ecdc0094 (diff)
downloadlat-d1bbadfbd69b12d107f108773d22c3a80f646829.tar.gz
lat-d1bbadfbd69b12d107f108773d22c3a80f646829.zip
Update README
- QOL for *.tape files
-rw-r--r--README.md68
-rw-r--r--social/binary.tape1
-rw-r--r--social/color.tape3
-rw-r--r--social/fzf_embed.tape45
-rw-r--r--social/headers.tape3
-rw-r--r--social/line_numbers.tape1
-rw-r--r--social/literal.tape3
-rw-r--r--social/name.tape37
-rw-r--r--social/pager.tape3
-rw-r--r--social/render/binary.gifbin1908045 -> 1457822 bytes
-rw-r--r--social/render/color.gifbin586786 -> 420709 bytes
-rw-r--r--social/render/fzf_embed.gifbin3905640 -> 5306485 bytes
-rw-r--r--social/render/headers.gifbin587027 -> 417238 bytes
-rw-r--r--social/render/line_numbers.gifbin556436 -> 252695 bytes
-rw-r--r--social/render/literal.gifbin418764 -> 422722 bytes
-rw-r--r--social/render/name.gifbin0 -> 107458 bytes
-rw-r--r--social/render/pager.gifbin18186791 -> 19083882 bytes
17 files changed, 72 insertions, 92 deletions
diff --git a/README.md b/README.md
index dc6e461..85587b9 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,7 @@ make
## Use
-`lat` can, for the most part, be a direct drop in for `cat`. However it really shines when embedded into another program. For example, in `fzf`, `lat` makes an excellent viewer with the command `fzf --command lat -l {}`.
+`lat` can, for the most part, be a direct drop in for `cat`. However it really shines when embedded into another program. For example, in `fzf`, `lat` makes an excellent viewer with the command `fzf --command lat -r {}`.
![Using lat in fzf](social/render/fzf_embed.gif)
@@ -64,7 +64,7 @@ For example, this should be possible in a future version of `lat`
```c
int main(void) {
- FILE *st = popen("lat -l", "w");
+ FILE *st = popen("lat -r", "w");
if (st == NULL)
exit(1);
@@ -77,37 +77,43 @@ int main(void) {
### Features and Flags
-#### `--color`
+#### `-c` color
Completely disables or enables all colored output from `lat`.
##### Example
![Color in lat](social/render/color.gif)
-> `lat` also respects [NO_COLOR](https://no-color.org/), but `--color` overrides it
+> `lat` also respects [NO_COLOR](https://no-color.org/), but `-c` overrides it
-#### `--lines`
+#### `-l` line numbers
Print numbers for each line of the file.
##### Example
![Line numbers in lat](social/render/line_numbers.gif)
-#### `--headers`
+#### `-t` file title
Shows or hides formatted file data headers.
##### Example
![Headers in lat](social/render/headers.gif)
-#### `--binary`
+#### `-b` binary mode
By default, `lat` will attempt to detect if the file is printable or not. If the file isn't (e.g. you ran `lat file.pdf`) then lat will enter *`binary mode`*. In *`binary mode`*, `lat` will skip a lot of processing in favor of speed.
You can force *`binary mode`* to be `on` or `off` with the flags `-b` and `-bb` respectively.
##### Example
![Binary Mode in lat](social/render/binary.gif)
-#### `--literal`
-`lat` is smart enough to print all non-file characters to a separate filestream. That way, the output of `lat` can be used to con**cat**enate files, the way it was originally meant to be.
+#### `-r` raw output
+`lat` is smart enough to print all non-file characters to a separate filestream. That way, the output of `lat` can be used to con**cat**enate files, the way it was originally meant to be (with `>` or `|`).
However, sometimes you want those extra symbols.
-`--literal` prints everything out to the primary filestream (usually `stdout`)
+`-r` prints everything out to the primary filestream (usually `stdout`)
##### Example
-![Literal output in lat](social/render/literal.gif)
+![Literal output in lat](social/render/raw.gif)
-#### `--pager`
+#### `-p` pager
`lat` comes with out-of-the-box support for paging in `less`. If you don't want your file messing up your terminal, just `-p` it.
+
+### `-n` name
+`lat` allows you to customize the name of the file shown. This can be useful in demonstrations or when `lat` is embedded in another program.
+#### Example
+![Custom filename in lat](social/render/name.gif)
+
##### Example
![Paging in lat](social/render/pager.gif)
@@ -115,42 +121,26 @@ However, sometimes you want those extra symbols.
## Helptext
-> `lat --help`
+> `lat -h`
```text
lat | lazy cat - a cat clone with some quality-of-life embellishments
-usage: lat [-cntblpVh] [file...]
+usage: lat [-cltbrpnVh] [file...]
options:
- -c, --color toggle color
- -n, --lines toggle line numbers
- -t, --headers toggle file info headers
- -b, --binary toggle binary mode, -b forces binary and -bb forces NOT binary
- -l, --literal print everything to stdout (or equivalent)
- -p, --pager print file with the pager (uses less)
- -V, --version show program version
- -h, --help display this help text (--help shows additional info)
+ -c toggle color
+ -l toggle line numbers
+ -t toggle file info headers
+ -b toggle binary mode, -b forces binary and -bb forces NOT binary
+ -r print everything to stdout (or equivalent)
+ -p print file with the pager (uses less)
+ -n set the name of the file in the title
+ -V show program version
+ -h display this help text
environment:
NO_COLOR, see https://no-color.org/
-
-examples:
-lat file1
- print the contents of file1 with the default formatting
-lat - file1
- read from stdin (the '-' flag reads from stdin) and then print the contents of stdin and file1
-lat -nc file1 file2
- print the contents of file1 and file2 without printing line numbers or colors
-lat --binary file.txt
- force file.txt to be treated as a binary file
-lat -bb --pager file.txt
- force file.txt to NOT be treated as a binary file and print it in the pager
-curl example.com | lat
- pipe the results of 'curl example.com' into lat
-fzf --preview 'lat -l {}'
- use lat as the file viewer in fzf
-
```
diff --git a/social/binary.tape b/social/binary.tape
index 1d72483..814738b 100644
--- a/social/binary.tape
+++ b/social/binary.tape
@@ -10,7 +10,6 @@ Set FontSize 32
Set Width 2400
Set Height 1200
Set TypingSpeed 0.2
-Set PlaybackSpeed 0.5
Type "lat src/main.c"
Sleep 2s
diff --git a/social/color.tape b/social/color.tape
index 2fbae90..f7bc94a 100644
--- a/social/color.tape
+++ b/social/color.tape
@@ -10,7 +10,6 @@ Set FontSize 32
Set Width 2400
Set Height 1200
Set TypingSpeed 0.2
-Set PlaybackSpeed 0.5
Type "lat src/main.c"
Sleep 2s
@@ -24,7 +23,7 @@ Enter
Sleep 2s
-Type "lat --color src/main.c"
+Type "lat -c src/main.c"
Sleep 2s
Enter
diff --git a/social/fzf_embed.tape b/social/fzf_embed.tape
index 1b65489..81e2367 100644
--- a/social/fzf_embed.tape
+++ b/social/fzf_embed.tape
@@ -11,7 +11,7 @@ Set Width 2400
Set Height 1200
Set TypingSpeed 0.2
-Type "fzf --preview 'lat -l {}'"
+Type "fzf --preview 'lat -r {}'"
Sleep 1s
Enter
@@ -32,49 +32,8 @@ Sleep 3s
Backspace 7
Sleep 2s
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
-
-Up
-Sleep 3s
+Up@3s 15
-Up
Sleep 3s
Enter
diff --git a/social/headers.tape b/social/headers.tape
index 2116960..4a36e6f 100644
--- a/social/headers.tape
+++ b/social/headers.tape
@@ -10,7 +10,6 @@ Set FontSize 32
Set Width 2400
Set Height 1200
Set TypingSpeed 0.2
-Set PlaybackSpeed 0.5
Type "lat src/main.c"
Sleep 2s
@@ -24,7 +23,7 @@ Enter
Sleep 2s
-Type "lat --headers src/main.c"
+Type "lat -t src/main.c"
Sleep 2s
Enter
diff --git a/social/line_numbers.tape b/social/line_numbers.tape
index 0e2a24f..ca67fe5 100644
--- a/social/line_numbers.tape
+++ b/social/line_numbers.tape
@@ -10,7 +10,6 @@ Set FontSize 32
Set Width 2400
Set Height 1200
Set TypingSpeed 0.2
-Set PlaybackSpeed 0.5
Type "lat src/main.c"
Sleep 2s
diff --git a/social/literal.tape b/social/literal.tape
index 9077018..152c8c9 100644
--- a/social/literal.tape
+++ b/social/literal.tape
@@ -10,7 +10,6 @@ Set FontSize 32
Set Width 2400
Set Height 1200
Set TypingSpeed 0.2
-Set PlaybackSpeed 0.5
Type "lat src/main.c > example.c"
Sleep 2s
@@ -30,7 +29,7 @@ Enter
Sleep 2s
-Type "lat --literal src/main.c > example.c"
+Type "lat -r src/main.c > example.c"
Sleep 2s
Enter
diff --git a/social/name.tape b/social/name.tape
new file mode 100644
index 0000000..1ce6123
--- /dev/null
+++ b/social/name.tape
@@ -0,0 +1,37 @@
+Require lat
+Output social/render/name.gif
+
+Set Theme "Gruvbox Dark"
+Set WindowBar Rings
+Set BorderRadius 10
+Set Margin 10
+
+Set FontSize 32
+Set Width 2400
+Set Height 1200
+Set TypingSpeed 0.2
+
+Type "lat"
+Sleep 2s
+Enter
+
+Type "hello, world!"
+Enter
+Sleep 3s
+
+Ctrl+d
+
+Sleep 3s
+
+Type "lat -n "custom name" src/main.c"
+Sleep 2s
+Enter
+
+Type "hello, world!"
+Enter
+Sleep 3s
+
+Ctrl+d
+
+Sleep 4s
+
diff --git a/social/pager.tape b/social/pager.tape
index 2a5ec49..604294d 100644
--- a/social/pager.tape
+++ b/social/pager.tape
@@ -10,7 +10,6 @@ Set FontSize 32
Set Width 2400
Set Height 1200
Set TypingSpeed 0.2
-Set PlaybackSpeed 0.5
Type "lat src/main.c"
Sleep 2s
@@ -24,7 +23,7 @@ Enter
Sleep 2s
-Type "lat --pager src/main.c"
+Type "lat -p src/main.c"
Sleep 2s
Enter
diff --git a/social/render/binary.gif b/social/render/binary.gif
index 0166b9a..474e103 100644
--- a/social/render/binary.gif
+++ b/social/render/binary.gif
Binary files differ
diff --git a/social/render/color.gif b/social/render/color.gif
index fcb99b5..f366a5c 100644
--- a/social/render/color.gif
+++ b/social/render/color.gif
Binary files differ
diff --git a/social/render/fzf_embed.gif b/social/render/fzf_embed.gif
index 9a49175..5263621 100644
--- a/social/render/fzf_embed.gif
+++ b/social/render/fzf_embed.gif
Binary files differ
diff --git a/social/render/headers.gif b/social/render/headers.gif
index c58a339..433ba02 100644
--- a/social/render/headers.gif
+++ b/social/render/headers.gif
Binary files differ
diff --git a/social/render/line_numbers.gif b/social/render/line_numbers.gif
index f54c9e8..0e00a02 100644
--- a/social/render/line_numbers.gif
+++ b/social/render/line_numbers.gif
Binary files differ
diff --git a/social/render/literal.gif b/social/render/literal.gif
index d2b412f..1984d0b 100644
--- a/social/render/literal.gif
+++ b/social/render/literal.gif
Binary files differ
diff --git a/social/render/name.gif b/social/render/name.gif
new file mode 100644
index 0000000..6df709e
--- /dev/null
+++ b/social/render/name.gif
Binary files differ
diff --git a/social/render/pager.gif b/social/render/pager.gif
index a17b491..f74b63b 100644
--- a/social/render/pager.gif
+++ b/social/render/pager.gif
Binary files differ