importpw / import

`import` is a simple and fast module system for Bash and other Unix shells
https://import.sh
MIT License
338 stars 10 forks source link

Add `import_file` function to separate download from sourcing #44

Closed isotes closed 4 years ago

isotes commented 4 years ago

I first tried to have import_file as a separate function that is used by import, but sourcing requires access to a couple of other local variables. Therefore, this basically just makes the print=1 trick explicit, as you proposed.

TooTallNate commented 4 years ago

Can we keep backwards compat for print=1?

isotes commented 4 years ago

Can we keep backwards compat for print=1?

Updated

isotes commented 4 years ago

I would like to have a working example for import_file as well. I've tested it with this Gist on my account. However, I would prefer if you could create a Gist in the importpw organization (or host the file on import.pw) for URL consistency. I would then update the example in api.md.

TooTallNate commented 4 years ago

@isotes Put the file in the test dir and then you can reference the file such as https://import.pw/importpw/import/test/static/foo.sh (or a regular github raw link if you prefer).

isotes commented 4 years ago

Sounds good! Updated.