rust-shell-script/rust_cmd_lib

is there any way to access Cmd or arguments from the result?

horacimacias opened this issue · 2 comments

specially when commands fail, it would be good if it was possible to access the Cmd or the arguments from the error result.

For example, when running something arg1 arg2 fails, I see the following in the logs:

Running ["something", "arg1", "arg2"] exited with error; status code: 255

this is ok, but it would be great if we could customize this output or even access the commands and the arguments.
For example:

Running "something arg1 arg2" exited with error; status code: 255

so at least users can copy-paste the same command on the shell without having to delete all the extra quotes and array syntax.
Same thing applies to Ok results; perhaps I want to show something like Running "something arg1 arg2" succeeded in debug mode for example.

You should define your own error message, and the above proposal will not work if arguments contain spaces.

fixed after commit 739946e