Description
I was wondering if there was any functionality that would allow using command output to bind a variable, such that it could be used to test a subsequent command? For example, given a command to generate some key and list generated keys:
Generate two keys:
$ gen-key
yD0zydG611bl6RzwLutdnGd7zfgj6fdNDDreI786
$ gen-key
0zydG611bl6RzwLutdnGd7zfgj6fdNDDreI786UH
Then list all your keys:
$ list-keys
yD0zydG611bl6RzwLutdnGd7zfgj6fdNDDreI786
0zydG611bl6RzwLutdnGd7zfgj6fdNDDreI786UH
One way I imagine this could work is if we could bind variables in the output, for example:
$ gen-key
[KEY1]
$ gen-key
[KEY2]
$ list-keys
[KEY1]
[KEY2]
The first [KEY1]
and [KEY2]
would bind new variables. The second [KEY1]
and [KEY2]
(in list-keys) would expect the value to equal the bound variables.
Without any way to use command output in the test, it requires the tests to be implemented partly in rust and partly in .md
files, which is cumbersome, whenever there is output that can't be known in advance.
Thoughts? I'm happy to help implement something like this if it makes sense for this project.