location of modules to PWD when calling ash, etc
Closed this issue · 3 comments
Hi,
I am a big fan of reading your project docs. Great work! One thing bothered me, though: I have nowhere found the instructions on how to place your modules if you do not place them into the global modules folder or install via apm.
From digging through ash's main code (again, super clean code, my compliments!), I gather that when calling ash, it looks for other modules in the $PWD/ash-modules
subfolder for local modules. I was a bit baffled that nowhere it seemed to look for a module in the $PWD
itself, but ok. I thought I had somehow overlooked it and it would work anyways.
I tried it out then -- checked out slugify into ash_modules/slugify
somewhere on my machine, and tried to call ash slugify:help
from either within the slugify folder itself, then from the parent directory of "ash_modules". To no avail: Either it did not recognize the module altogether, or, on top of ash_modules
Cannot import github.com/ash-shell/slugify, no module with that package is installed
It seems to have found the .yaml file detailing the package name, but failed loading it subsequently.
From this I gather that only packages that are installed hard into the ash subfolder structure are meant to be executed -- right?
I realize this project is dormant for some time, at least judging from the commits. Any chance you could clarify on that point, though? Thank you very much :) The code seems too great to not use it.
Thoughts on the following matters would be appreciated:
- How would you judge the chance to establish something like a
ASH_MODULE_PATH
to look for packages on the local machine? Would that bee hard to accomplish? - Any ideas on how to easily develop a callable module without installing it hard via apm?
- suggestion for best-practice when using the project as-is in a quick selfmade module without apm: Where to locate the module folder, how to call / import it from anywhere, etc
Thanks :)
Hey @simlei, glad to have piqued your interest.
Honestly the reason why development has stopped is because it is completed for my needs, and I've not run into any bugs. Even though there has been a lack of commits, Ash is still very much part of my day-to-day workflow, so I'm still using it -- and MORE than willing to support it if anyone finds any issues.
In short, modules can either be called from global_modules
, or from your local ./ash_modules/
directory. What you have said is correct, with the exception that you don't actually need to install the module via apm
to get it wired up in the ./ash_modules
directory. You can set this up manually as I did this this file:
I've included a bare-bones example of how you can call a module from the current directory. Download this, unzip it, and go into that directory and run ash sample
.
I think the above will answer most of your questions, but I will answer them specifically here:
How would you judge the chance to establish something like a ASH_MODULE_PATH to look for packages on the local machine? Would that bee hard to accomplish?
This would be no different than the way the current global_modules structure is set up, would it?
I think what you really want is what I provided in the zip file.
Any ideas on how to easily develop a callable module without installing it hard via apm?
See my example, which is a bare bones version of this!
suggestion for best-practice when using the project as-is in a quick selfmade module without apm: Where to locate the module folder, how to call / import it from anywhere, etc
If you want to call it from anywhere, develop it within your global_modules
directory! Just be sure to remember to update the module_aliases.yaml
file to wire up the alias to the actual folder.
Let me know if you need any more help, and I'll be glad to assist.
Thank you very much! It is very helpful that you replied so timely as I will have the chance to include ash into my new bash environment right from the start. Thanks also for this awesome level of detail and for the offer to assist on further quedtions!
I'll study it some time for now. I'm actually quite convinced that no further questions will really come up thatI can't answer myself because of the quality of code I was able to observe and the above clarifications and example. Cheers :)
Awesome 😄!