charmbracelet / charmbracelet/vhs

Make output relative to tape file

Open
#121 6 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
20.9k
Forks
480
Avg merge
4d 1h
Merged PRs (30d)
2

Description

```bash
# in directory called demo
mkdir -p subdir
cat < tape.tape
Output ./subdir/tape.gif
Type "Hello, World!"
Enter
Sleep 5s
EOF
cd ..
vhs ./demo/tape.tape
```
Currently this usage would write to `demo/../subdir/tape.gif` instead of `demo/subdir/tape.gif`, because it seems that the output is currently relative to the current directory, not the tape's directory.

I thought this would be useful because I noticed the output of `vhs new demo.tape` doesn't work "out of the box", because the `examples/` directory must exist. If the output could be relative to the tape file, then `examples/demo.tape` could use `./demo.gif`, and the file would also work "out of the box" as the [embedded output of `vhs new`](https://github.com/charmbracelet/vhs/blob/e4ac44a1cd8c54efafe5554e08dfd119f2ccb2fc/embed.go#L8). Making outputs relative to the tape would make results easier to reproducible.

Contributor guide

Open the contributing guide

Research direction

Reproduce the example from the issue with vhs ./demo/tape.tape and inspect how the CLI resolves Output paths relative to the working directory and tape file. Read embed.go and the vhs new output path described in the issue. Done means ./subdir/tape.gif is written under demo and the embedded examples/demo.tape output works without creating examples/ first.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.