-
-
Notifications
You must be signed in to change notification settings - Fork 238
issue1158-stdin-for-single-files #1516
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| DUB accepts single file packages on STDIN | ||
|
|
||
| You can pass single file packages to dub on STDIN using dash as first argument to DUB. | ||
| All arguments after dash will be passed as runtime arguments to the application. | ||
|
|
||
| Example `cat app.d | dub - --foo=bar` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| . $(dirname "${BASH_SOURCE[0]}")/common.sh | ||
|
|
||
| cd ${CURR_DIR}/issue1158-stdin-for-single-files | ||
|
|
||
| if ! { cat stdin.d | ${DUB} - --value=v 2>&1 || true; } | grep -cF '["--value=v"]'; then | ||
| die $LINENO 'Stdin for single files failed.' | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| /+ dub.sdl: | ||
| name "hello" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name is optional since 1.6
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By removing name attribute, the file not longer compiles. I tried different formats:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah sorry. Apparently one items is needed then :/ |
||
| +/ | ||
| void main(string[] args) { | ||
| import std.stdio : writeln; | ||
| writeln(args[1..$]); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe directly use _ above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
randomUUID also returns a string containing dashes. Therefore my idea was to keep the dash and replaces all dashes in case of a d module file.