Skip to content
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

--interactive with --require #4661

Closed
pannous opened this issue Jan 13, 2016 · 4 comments
Closed

--interactive with --require #4661

pannous opened this issue Jan 13, 2016 · 4 comments
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.

Comments

@pannous
Copy link

pannous commented Jan 13, 2016

Is there any way to make the repl console start with an included script?
Neither --interactive --eval nor --require worked here (v5.3.0)

@mscdex mscdex added repl Issues and PRs related to the REPL subsystem. feature request Issues that request new features to be added to Node.js. labels Jan 13, 2016
@Fishrock123
Copy link
Contributor

What you are looking for should be -ir <module>, I think.

Why doesn't that work? Because our current options parsing is a bunch of garbage if-else statements.

@evanlucas Tried to make it use getopt a while ago but that had some edge cases. See: #1862

@pannous
Copy link
Author

pannous commented Jan 13, 2016

Here is what I tried last:

$> cat test.js 
console.log("OK")
a=1
exports.a=2
module.exports.a=3

$> NODE_PATH=. node -i -r test.js 
> // nada 
> a
ReferenceError: a is not defined

@Fishrock123
Copy link
Contributor

Why doesn't that work? Because our current options parsing is a bunch of garbage if-else statements.

Again, that doesn't currently work, but we know about it. :/

@Fishrock123 Fishrock123 changed the title repl startup script .noderc --interactive with --require Jan 15, 2016
evanlucas added a commit that referenced this issue Jan 18, 2016
This gives us the ability to preload when using the node repl. This can
be useful for doing things like creating aliases.

Fixes: #4661
PR-URL: #4696
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@pannous
Copy link
Author

pannous commented Jan 18, 2016

nice!

scovetta pushed a commit to scovetta/node that referenced this issue Apr 2, 2016
This gives us the ability to preload when using the node repl. This can
be useful for doing things like creating aliases.

Fixes: nodejs#4661
PR-URL: nodejs#4696
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants