antmicro / tuttest

A simple Python utility for extracting documentation snippets from tutorials.
Apache License 2.0
13 stars 2 forks source link

Add "--wrap" type option #10

Closed mithro closed 3 years ago

mithro commented 3 years ago

Frequently you want to run the commands inside a docker container but you don't want to install tuttest inside the docker container. It would be good if tuttest had a --wrap or --prefix type option which would prefix / run the commands with the option.

For example;

tuttest --wrap "docker run --abc 1234" XYZ

Would prefix all the commands with docker run --abc 1234.

mithro commented 3 years ago

@mgielda - This should probably be assigned to @kamilrakoczy so he can finish https://github.com/SymbiFlow/symbiflow-examples/pull/46

mgielda commented 3 years ago

I actually added a variant of this functionality some time ago within https://github.com/antmicro/tuttest/blob/master/bin/tuttest, where using +something will prepend the next snippet to be executed with a command, but this has not been battle tested ;-)

also this prefixes the entire snippet, whereas I assume you mean to prefix each command with something.

So concluding, I think we could add the --prefix-lines-with option (I would prefer a more descriptive name here to explain what it does) which does exactly what you need.

mgielda commented 3 years ago

@kgugala please assign as needed. Also, please implement what best fits the practical use cases, such as SF's documentation ;-) 'cos my discussion here is purely theoretical, and I'd rather tuttest made sense for real users.