-
Notifications
You must be signed in to change notification settings - Fork 112
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
Export module file #447
Comments
Hi, Such feature is somehow already available as module is composed of:
So calling directly the $ $MODULES_CMD bash load dot
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:.; export PATH;
_LMFILES_=/usr/share/Modules/modulefiles/dot; export _LMFILES_;
LOADEDMODULES=dot; export LOADEDMODULES;
test 0; Based on that, some shell script could easily be crafted to create shell scripts from modulefiles in desired location. Here is an example to dump all available modulefiles into bash scripts: module avail -t -o "" | while read mod; do
mkdir -p scripts/$(dirname $mod)
$MODULES_CMD bash load $mod >scripts/$mod.sh
done |
That is pretty nice. And it works really nice here too, thanks for sharing this @xdelaruelle |
Yup this works, but maybe having a dedicated module command the performs
that and writes it to a file named modulemame.shell would be great.
Of course no high priority for that, just something to remember fir future
features.
Roberto
…On Wed, Mar 2, 2022, 20:55 Leandro Heck ***@***.***> wrote:
That is pretty nice. And it works really nice here too, thanks for sharing
this @xdelaruelle <https://github.com/xdelaruelle>
—
Reply to this email directly, view it on GitHub
<#447 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABEJ6O2JH4NSSLMMNZ6P3G3U57BUXANCNFSM5PXZFQZA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Nice, wise words @RobyB. Well, since this can have a simple implementation, and also since its use is not regular, it could be implemented as a function inside the init scripts as an alternative I created this with @xdelaruelle code
It does not allow to pass the path, but it is working already (tested on zsh)
|
@RobyB It would mean to add a I would prefer outputting shell code directly on stdout, then let people choose where to save that code with I/O redirection.
|
@xdelaruelle may I ask why this is better in this case? I think it is a good approach. But it is going to do half of the work since I think most of the time people want to have a file. But having the command that outputs to a shell it is easy to create the one that redirects to a file. Ah, and fix the typo in your preview example (you mentioned |
I do not see a clear consensus on where to save such file with what file name. People will want different file location, different filename extension. So it seems simpler to output the content to stdout then let people decide what they do with that (either just look at the produced code, pipe it to another process or save it into a file)
I do not understand this part of your comment. There is no typo, this is about introducing a new sub-command on the module command. This sub-command could be named |
Alright, it makes sense.
It is not a big deal, but you are proposing this command |
Got it. Thanks. I have fixed the comment. |
Hi, I would like to suggest something like a module export feature if we don't have such thing of course. This would export the
modulefile
to a simpleenv.sh
script that you can share and use in other computers that do not have a module environment configured.For instance, I used to manage modules and software/tools in my research group. And most of the time, students would like to have a set of tools in their own computers. The easiest way for me to do that was to copy the tool folder as it is, and then port the
modulefile
to a script liketool-env.sh
to be loaded directly. It would be nice to have such functionality wheremodulefiles
could be exported and converted easily to this bash format instead.Also, a flag would be good to set the output path, but the default option would be to create the file where the command was executed.
The text was updated successfully, but these errors were encountered: