Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running commands from strings #26

Open
carolynvs opened this issue Jul 17, 2022 · 1 comment
Open

Support running commands from strings #26

carolynvs opened this issue Jul 17, 2022 · 1 comment

Comments

@carolynvs
Copy link
Owner

It would be nice to not have to specify the arguments as a string slice and instead pass a single space separated string.

shx.Run("go test ./...")

There is a library that can help with this, https://github.com/mattn/go-shellwords

You could extend this further and support newline separated commands

shx.Run(`
go build -o bin/stuff .
go test ./...
./bin/stuff --version
`)

If you were feeling really spicy, you could define a parser for a simplified Makefile syntax and then execute the Makefile in the same directory.

magefile.go
Makefile

magefile.go

//go:generate magic command to generate a magefile with extra targets based on the Makefile 
@justaugustus
Copy link

Carried to uwu-tools/magex#11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants