Add 'x' command argument for tracing#761
Closed
ashermancinelli wants to merge 2 commits intoamoffat:developfrom
Closed
Add 'x' command argument for tracing#761ashermancinelli wants to merge 2 commits intoamoffat:developfrom
ashermancinelli wants to merge 2 commits intoamoffat:developfrom
Conversation
Similar to `set -x` in bash, echos the command to stdout before executing anything.
Author
Unrelated FWIW:adding this section to pyproject.toml would make it easier to develop this with uv diff --git a/pyproject.toml b/pyproject.toml
index 0e8bb2f..eac408e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,7 @@
+[project]
+name = "sh"
+version = "2.2.2"
+
[tool.poetry]
name = "sh"
version = "2.2.2"uv complains with |
Contributor
|
@amoffat may have a different opinion, but in my opinion If you want to print commands before execution, you can enable logging: https://sh.readthedocs.io/en/latest/sections/faq.html#how-do-i-see-the-commands-sh-is-running |
Author
|
That works for me, thank you! |
Author
|
If someone comes across this in the future, this gist might be useful. with SetX: # prints commands from 'sh' module like 'set -x' does
sh.opt('foo.ll', '-S', '-o', '-', passes='instcombine') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similar to
set -xin bash, echos the command to stdout before executing anything.One of my biggest complaints about using sh in place of shell scripting is that I can't bake-in something that echos the commands that are about to be run, so my scripts are littered with prints. I would love to be able to add
_x=Trueto my bake arguments and see what's going to be run.Given that
set -xis specific to the shells I'm used to, I could also imagine_trace=Trueor_explicit=Truebeing more approachable. Thanks in advance for any suggestions!