Comments (6)
I understand where you're coming from, but I wonder if that isn't less intuitive behavior 🤔
from vhs.
A new keyword definitely shouldn't be added without careful consideration, but what do you think about OutputRelative
or something similar?
While it's definitely far more common for paths to be relative to the directory that the process is executed in, not the current file, many tools will have some way to get the file's directory (dirname $0
in Bash, __dir__
in Ruby, etc.). Not arguing for that added complexity, but I'm just saying that there's almost always some way to build paths relative to the currently interpreted file.
I should note that my initial issue is actually that vhs new tape.tape
doesn't work immediately unless I either create an examples/
directory or change the path in the new tape. I think it's a bit awkward that vhs new tape.tape
might not be enough to be a runnable file, and an additional step might be required. This proposal is inspired by that, as I was thinking of a way to allow examples/demo.tape
to continue to work as both an example in this repo and as the source for the new
command, and allow the newly created tape to always work without additional steps.
from vhs.
I'll note that, while checking out behavior, my initial assumption was that output.gif
would be relative to the current directory, and ./output.gif
would be relative to the file's directory. Not sure how common that assumption is, though.
from vhs.
It isn't possible to get a relative output file if vhs gets input through stdin
(like vhs < path.tape
), since vhs doesn't "see" that path at all. Tapes with relative outputs must be loaded as an argument, like vhs path.tape
.
Here are a few thoughts:
- Relative paths will be very helpful if we add an
Include
keyword, or another feature that pulls extra files. Those are input files, though, not output files. - Relative output paths would be pretty counterintuitive. Maybe a cli argument, like
--output-relative
? A.tape
keyword wouldn't really make sense, because we can't get relative output if we load the file through stdin.
As for vhs new
, we'd better fix the fact that the file it creates doesn't work. We could do this by putting relative paths in all the demo files, and cd
ing into the examples directories before giving them to vhs.
from vhs.
- Maybe a cli argument, like
--output-relative
?
An --out-dir
or similar argument could be useful (taking some inspiration from TypeScript).
$ cat file.tape
Output "out.gif"
...
$ vhs --out-dir /path/to/context file.tape
$ ls /path/to/context
out.gif ...
This by itself wouldn't resolve the new tape not working out-of-the-box, but maybe that should be a separate issue. But maybe all of the examples could use --out-dir examples
instead of all referencing examples/name.format
.
from vhs.
because we can't get relative output if we load the file through stdin.
By the way, interpreted languages like Ruby and JavaScript (Node) allow one to reference paths relative to the current file:
require_relative '../path/to/file'
require('../path/to/file')
Both of these languages support interpretation from stdin AFAIK.
Right now I think that --out-dir
is a better solution (I'm happy to change the issue title 🙂), but it might be worth looking into what these languages/interpreters do when the code referencing relative paths comes from stdin.
Edit: Just to give further context to how other tools resolve relative paths, Node will interpret paths relative to the current file, but use the working directory if interpreting from stdin. For example
$ echo "console.log('hello, world');" > greet.js
$ echo "require('../greet.js');" > subdir/index.js
$ node subdir/index.js
hello, world
$ node < subdir/index.js
(stacktrace)
$ cd subdir
$ node index.js
hello, world
$ node < index.js
hello, world
from vhs.
Related Issues (20)
- On-demand frame capture
- How can I change Shell Prompt HOT 18
- Changing the FontSize affects what is captured on Hide/Show HOT 2
- Outputs ignored if specifying more than one golden file format
- Source 1_example.tape raises "Expected path after Source" HOT 1
- Add option for split terminal HOT 6
- Padding and FontSize not applied via Source
- Add Command to "Set Title" for Window
- vhs freezes when i try to load a file HOT 6
- Automatic download and execution of browser from Google should be noted in README HOT 1
- serve mode not working HOT 10
- Unable to send and record some alt modifier sequences HOT 5
- Output frames don't do anything
- Hide `vhs publish` info when exiting with tape errors HOT 1
- Escaped prompt when running VHS in a nix shell
- Support customizing Padding and Margin.
- Make VHS available as a library to be used in test suites and make possible programmatically detect golden file changes
- Show what is being entered HOT 3
- Publish command stalls (server unresponsive?) HOT 3
- Show output in real-time HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vhs.