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

Use eval $(resh-init) instead of . ~/.resh/shellrc #186

Open
curusarn opened this issue Jan 4, 2023 · 3 comments
Open

Use eval $(resh-init) instead of . ~/.resh/shellrc #186

curusarn opened this issue Jan 4, 2023 · 3 comments

Comments

@curusarn
Copy link
Owner

curusarn commented Jan 4, 2023

This way we won't need the special ~/.resh location.
It's more standard and robust.
It will help with #73

@curusarn
Copy link
Owner Author

curusarn commented Jan 6, 2023

We should make sure that people can still do something like this.

https://code.visualstudio.com/docs/terminal/shell-integration ->

PORTABILITY VERSUS PERFORMANCE
The recommended approach above to install shell integration relies on executing our CLI
to find the path to the shell integration script. This is great as it works cross-platform and
also with all install types, provided code in on the $PATH. This currently launches Node.js
in order to fetch the path, which can add a small delay to shell startup. To reduce this, you
can inline the script above by resolving the path ahead of time and adding it directly into
your init script.

# Output the executable's path first:
code --locate-shell-integration-path bash

# Add the result of the above to the source statement:
[[ "$TERM_PROGRAM" == "vscode" ]] && . "/path/to/shell/integration/script.sh"

@curusarn
Copy link
Owner Author

curusarn commented Jan 6, 2023

This should also work: source "$(resh-get-shellrc-path)"
PRO's: no eval, no need to pack shell scripts into go
CON's: resh needs to know the shellrc location, possibly slower than outputting and eval'ing the shell directly

@curusarn
Copy link
Owner Author

Related: #193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant