trycmd icon indicating copy to clipboard operation
trycmd copied to clipboard

Is it possible to write a multiline file in `.trycmd` tests?

Open Rigellute opened this issue 1 year ago • 2 comments

I'd like to be able to create multiline files from within the trycmd blocks to serve as test fixtures. Is it possible? I'm thinking something like this (pseudo code):

write todos.txt = """
- [x] Wash the dishes
- [ ] Mow lawn
"""
$ mytodos -f todos.txt
Mow lawn

Would be awesome if you could assign stdin like this too:

stdin = """
- [x] Wash the dishes
- [ ] Mow lawn
"""
$ mytodos -f -
Mow lawn

Rigellute avatar Apr 15 '23 08:04 Rigellute

At this time, no.

We do support <stem>.in/ directories for runnin your trycmd files within. I'm a bit hesitant to add more complexity to the trycmd file syntax and we'd need a good reason why .in/ directories wouldn't work

epage avatar Apr 17 '23 18:04 epage

@epage totally makes sense. The *.in/ directories are working well. And thank you for this amazing crate, it's making testing my cli a joy!

Rigellute avatar Apr 18 '23 08:04 Rigellute