-
Notifications
You must be signed in to change notification settings - Fork 10
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
Snippet for automatic installation of import
itself
#38
Comments
There actually was previously a more verbose bootstrapping snippet included in the readme that tried to achieve the same advantage. I came to the conclusion that having to copy+paste the snippet in every script was inconvenient (and also impractical, because for example the old snippet wasn't even taking into consideration the Having a simple and memorizable one-liner to bootstrap is what I want to focus on. Since this is basically just a documentation change, feel free to open a PR and perhaps you can convince me otherwise, but like I mentioned I think it's difficult to get a snippet that will be 100% future-proof. |
What I like most about this project is that it (almost) solves the problem of giving a bash script to someone else while still being able to use and build a library of bash functions. The one step missing from the scripts being fully self-contained is the automatic provision of the I was not aware of the older snippet. I like the approach of looking in multiple directories (although the current form won't work on Windows with ':' as the separator). However, for me the key idea is to automatically cache the script itself. Future-proof: certainly, no solution would be 100% future-proof, but as noted this snippet does not have to be compatible regarding the cache location. I prefer having it in the same place, but even if it is downloaded somewhere else, it would still work. It just would not reside in the cache. I'll take a stab at a PR. |
It would be great to have a further alternative installation method: a snippet that uses a locally installed
import
script if available but also downloads and installs it if necessary. I would prefer to have theimport
script at a predefined location - probably in the cache itself - rather than as a global command. This would also solve name clashes such as #22.It looks to me like finding out the cache location is the biggest part of this snippet, especially if OS-specific default locations for the cache folder are taken into account (#36 (comment)). I.e., with support for
XDG_CACHE_HOME
, the following (not very pretty) one-liner works (at least in bash):This provides the zero-configuration convenience of the
curl
+eval
method without incurring the HTTP request overhead on each script invocation.I assume some
uname
wrangling is necessary to take OS-specific default folders into account, which would require an even bigger snippet. However, for the provided convenience, I could live with a 10-liner.This approach works also with different locations for the cache and the script, but I would prefer having one common directory. I would be happy to take a stab at a PR for the installation docs, but #36 should be decided first and its logic should be duplicated for this snippet.
Small side note: I would also propose changing the cache directory name from
import-cache
toimportpw
in order to have a clearer association with the project.The text was updated successfully, but these errors were encountered: