-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Fix handling comments in multiline cmds #225
Fix handling comments in multiline cmds #225
Conversation
f1eeb73
to
16a71b2
Compare
54b2aea
to
f267c87
Compare
Now regarding the test case with multiple comments - it actually evaluates to an invalid command if it's read literally (a comment between two flags does not make any sense). Do you see any value in supporting this kind of thing? We could potentially pre-parse the command and ignore all comments altogether. |
Found via `typos --hidden --format brief` and `codespell -H -L cant`
To do with we now track how a line in cmd conent was terminated on the ast.Line class so that lines terminated by a comment can be implicitly merged.
Your assessment is correct. Allowing a cmd to be split over multiple lines (with escaping the line break) with comments on multiple lines is a little bit weird... but harmless and IMO potentially a nice thing to be able to do. I think the root cause of the issue here is that although I made the AST implementation faithful to a subset of bash, when actually used in the cmd task it's configured to only treat So to resolve this I just pushed a tweak to the cmd AST that allows tracking on the |
This looks good to me now. Thanks for working on it @snejus |
Amazing, thanks for finishing this up! |
Fixes #224