-
Notifications
You must be signed in to change notification settings - Fork 842
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 multiline script interpreter directive for better readability #1394
Comments
I agree, this would be nice. Feel free to open a PR implementing it. |
I am assuming we are keeping the current comment format starting with "--" as well. This is useful for the common case of shorter commands. A few minor points regarding the interpreter implementation:
When used as interpreter no other output is desirable other than the script's output itself. In fact this should hold true for any stack exec command. That might interfere with the processing of the script output.
|
Agreed on both points.
It may be problematic to support this given
So far, stack hasn't added much interactivity, in order to make it easily scriptable. We don't necessarily need to stick to this principle everywhere, though, this seems like a reasonable thing to have. |
Regarding |
I agree completely. |
@soenkehahn Yup, sounds good to me! |
Another problem that I found with the implementation - if we have a file in the current directory whose name matches any of the stack commands then instead of running the command stack will execute the file as an interpreter. Here is an example: cueball $ cat build main = putStrLn "Hello there!" |
@harendra-kumar Whoah, yeah, that should be fixed. |
Multi line block comments can now be used for additional stack arguments when stack is used as script interpreter. Like this: {- stack --verbosity silent --resolver lts-3.14 --install-ghc runghc --package random --package system-argv0 -} Newlines are ignored in the block comments. This allows for better formatting of longer commands. Previous single line format is supported as usual. The single line syntax now allows a missing space between comment marker and the start of command i.e. "--stack ..." too works now. Updated the guide with complete syntax and semantics. Closes commercialhaskell#1394
When we have many packages to be specified on the embedded stack command the comment line can become too long. It would be nice to support a multiline comment so that it can formatted for better readability. Like this:
Further comments from the stack mailing list:
The text was updated successfully, but these errors were encountered: