Skip to content

Commit c6db535

Browse files
committed
doc: add manual page for "envml" command
Fixes #190 Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent a5c83b0 commit c6db535

File tree

14 files changed

+136
-18
lines changed

14 files changed

+136
-18
lines changed

.hunspell.en.dic

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,3 +1238,5 @@ RenvModule
12381238
tablelist
12391239
haveDynamicMPATH
12401240
settarg
1241+
ACTIONs
1242+
arg2

INSTALL-win.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,6 @@ a modulepath and contains few modulefile examples::
104104
------- C:/Program Files/Environment Modules/modulefiles --------
105105
module-git module-info null
106106

107-
Documentation of the :ref:`module(1)` and :ref:`ml(1)` commands and
108-
:ref:`modulefile(5)` syntax can be found in the ``doc`` directory in
109-
installation directory.
107+
Documentation of the :ref:`module(1)`, :ref:`ml(1)` and :ref:`envml(1)`
108+
commands and :ref:`modulefile(5)` syntax can be found in the ``doc`` directory
109+
in installation directory.

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,8 @@ dist-tar: ChangeLog.gz share/rpm/environment-modules.spec pkgdoc
815815
lib/configure lib/config.h.in $(DIST_AUTORECONF_EXTRA) ChangeLog.gz \
816816
doc/build/MIGRATING.txt doc/build/changes.txt doc/build/INSTALL.txt \
817817
doc/build/INSTALL-win.txt doc/build/NEWS.txt doc/build/CONTRIBUTING.txt \
818-
doc/build/module.1.in doc/build/ml.1 doc/build/modulefile.5 \
819-
share/rpm/environment-modules.spec
818+
doc/build/module.1.in doc/build/ml.1 doc/build/envml.1 \
819+
doc/build/modulefile.5 share/rpm/environment-modules.spec
820820

821821
dist-gzip: dist-tar
822822
$(ECHO_GEN2) $(DIST_PREFIX).tar.gz
@@ -847,6 +847,8 @@ dist-win: modulecmd.tcl ChangeLog.gz README pkgdoc
847847
$(INSTALL_DATA) doc/build/NEWS.txt $(DIST_WIN_PREFIX)/doc/
848848
$(INSTALL_DATA) doc/build/CONTRIBUTING.txt $(DIST_WIN_PREFIX)/doc/
849849
$(INSTALL_DATA) doc/build/module.txt $(DIST_WIN_PREFIX)/doc/
850+
$(INSTALL_DATA) doc/build/ml.txt $(DIST_WIN_PREFIX)/doc/
851+
$(INSTALL_DATA) doc/build/envml.txt $(DIST_WIN_PREFIX)/doc/
850852
$(INSTALL_DATA) doc/build/modulefile.txt $(DIST_WIN_PREFIX)/doc/
851853
$(MAKE) --no-print-directory -C init dist-win DIST_WIN_PREFIX=../$(DIST_WIN_PREFIX)
852854
$(INSTALL_PROGRAM) script/INSTALL.bat $(DIST_WIN_PREFIX)/

NEWS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Modules 5.6.0 (not yet released)
154154
* Add :mfcmd:`haveDynamicMPATH` modulefile command
155155
* Fix ``use.own`` example modulefile to report when creating local modulefiles
156156
directory. (fix issue #576)
157+
* Doc: add manual page for :ref:`envml(1)` command. (fix issue #190)
157158

158159
.. _Security policy: https://github.com/envmodules/modules/blob/main/SECURITY.md
159160
.. _Modules chat room: https://matrix.to/#/#modules:matrix.org

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ type:
110110

111111
The following man pages are provided:
112112

113-
module(1), ml(1), modulefile(5)
113+
module(1), ml(1), envml(1), modulefile(5)
114114

115115

116116
Test suite

configure

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,8 @@ if [ -e "${builddocdir}/changes.txt" ] && [ -e "${builddocdir}/MIGRATING.txt" ]
998998
&& [ -e "${builddocdir}/INSTALL.txt" ] && [ -e "${builddocdir}/INSTALL-win.txt" ] \
999999
&& [ -e "${builddocdir}/NEWS.txt" ] && [ -e "${builddocdir}/CONTRIBUTING.txt" ] \
10001000
&& [ -e "${builddocdir}/module.1.in" ] && [ -e "${builddocdir}/ml.1" ] \
1001-
&& [ -e "${builddocdir}/modulefile.5" ] && [ "$oldbuilddoc" != 'y' ]; then
1001+
&& [ -e "${builddocdir}/envml.1" ] && [ -e "${builddocdir}/modulefile.5" ] \
1002+
&& [ "$oldbuilddoc" != 'y' ]; then
10021003
builddoc=p
10031004
# test sphinx availability otherwise
10041005
else

doc/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ ALL_RST := $(wildcard $(SOURCE_DIR)/*.rst $(SOURCE_DIR)/cookbook/*.rst\
3737
$(SOURCE_DIR)/design/*.rst)
3838
ALL_TXT := $(patsubst $(SOURCE_DIR)/%,$(BUILD_DIR)/%,$(patsubst %.rst,%.txt,$(ALL_RST)))
3939
ALL_HTML := $(patsubst $(SOURCE_DIR)/%,$(BUILD_DIR)/%,$(patsubst %.rst,%.html,$(ALL_RST)))
40-
ALL_MAN := $(BUILD_DIR)/module.1 $(BUILD_DIR)/ml.1 $(BUILD_DIR)/modulefile.5
40+
ALL_MAN := $(BUILD_DIR)/module.1 $(BUILD_DIR)/ml.1 $(BUILD_DIR)/envml.1\
41+
$(BUILD_DIR)/modulefile.5
4142

4243
all: man txt
4344

@@ -100,7 +101,8 @@ $(BUILD_DIR)/%.txt: $(SOURCE_DIR)/%.rst $(SOURCE_DIR)/version.py
100101
$(ECHO_GEN2) $(ECHO_DIR_PREFIX)$(BUILD_DIR)/*.txt
101102
$(SPHINXBUILD) $(SPHINXOPTS) -b text "$(SOURCE_DIR)" "$(BUILD_DIR)"
102103

103-
$(BUILD_DIR)/module.1.in $(BUILD_DIR)/modulefile.5 $(BUILD_DIR)/ml.1: $(ALL_RST) $(SOURCE_DIR)/version.py
104+
$(BUILD_DIR)/module.1.in $(BUILD_DIR)/modulefile.5 $(BUILD_DIR)/ml.1 $(BUILD_DIR)/envml.1: $(ALL_RST) $(SOURCE_DIR)/version.py
105+
$(ECHO_GEN2) $(ECHO_DIR_PREFIX)$(BUILD_DIR)/envml.1
104106
$(ECHO_GEN2) $(ECHO_DIR_PREFIX)$(BUILD_DIR)/ml.1
105107
$(ECHO_GEN2) $(ECHO_DIR_PREFIX)$(BUILD_DIR)/module.1.in
106108
$(ECHO_GEN2) $(ECHO_DIR_PREFIX)$(BUILD_DIR)/modulefile.5
@@ -124,6 +126,7 @@ ifeq ($(docinstall),y)
124126
endif
125127
$(INSTALL_DATA) $(BUILD_DIR)/module.1 '$(DESTDIR)$(mandir)/man1/'
126128
$(INSTALL_DATA) $(BUILD_DIR)/ml.1 '$(DESTDIR)$(mandir)/man1/'
129+
$(INSTALL_DATA) $(BUILD_DIR)/envml.1 '$(DESTDIR)$(mandir)/man1/'
127130
$(INSTALL_DATA) $(BUILD_DIR)/modulefile.5 '$(DESTDIR)$(mandir)/man5/'
128131

129132
uninstall:
@@ -138,6 +141,7 @@ ifeq ($(docinstall),y)
138141
endif
139142
rm -f '$(DESTDIR)$(mandir)/man1/module.1'
140143
rm -f '$(DESTDIR)$(mandir)/man1/ml.1'
144+
rm -f '$(DESTDIR)$(mandir)/man1/envml.1'
141145
rm -f '$(DESTDIR)$(mandir)/man5/modulefile.5'
142146
rmdir '$(DESTDIR)$(mandir)/man1' '$(DESTDIR)$(mandir)/man5'
143147
rmdir '$(DESTDIR)$(mandir)'

doc/source/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ def get_version_release_from_git():
305305
man_pages = [
306306
('module', 'module', u'command interface to the Modules package', [], 1),
307307
('ml', 'ml', u'handy command interface to the Modules package', [], 1),
308-
('modulefile', 'modulefile', u'files containing Tcl code for the Modules package', [], 5)
308+
('modulefile', 'modulefile', u'files containing Tcl code for the Modules package', [], 5),
309+
('envml', 'envml', u'run a command in an environment setting up by Modules', [], 1)
309310
]
310311

311312

doc/source/envml.rst

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
.. _envml(1):
2+
3+
envml
4+
=====
5+
6+
SYNOPSIS
7+
--------
8+
9+
**envml** [*MODULE_ACTION*]... [--] *COMMAND* [*ARG*]...
10+
11+
DESCRIPTION
12+
-----------
13+
14+
The :command:`envml` command is a helper script that configures the shell
15+
environment using specified Environment Modules actions before executing a
16+
given command.
17+
18+
This is useful for running a command in a modified environment without
19+
permanently altering the current shell session.
20+
21+
The script first interprets arguments as module actions, then switches to
22+
command execution after either encountering ``--`` or determining that the
23+
remaining arguments form the actual command to run.
24+
25+
MODULE_ACTION FORMAT
26+
--------------------
27+
28+
Each module action argument can be one of the following forms:
29+
30+
- ``purge``
31+
Unload all currently loaded modulefiles.
32+
33+
- ``restore[=coll]``
34+
Restore the module environment from the named collection ``coll``. If no
35+
name is given, restores the default collection.
36+
37+
- ``unload=mod1[&mod2...]``
38+
Unload one or more specified modulefiles.
39+
40+
- ``switch=mod1&mod2``
41+
Unload ``mod1`` and load ``mod2``.
42+
43+
- ``[load=]mod1[&mod2...]``
44+
Load one or more specified modulefiles. ``load=`` can be omitted.
45+
46+
Multiple MODULE_ACTIONs can be passed in a single argument using the colon
47+
(``:``) separator. The ampersand (``&``) is used to specify multiple modules
48+
in a single action.
49+
50+
COMMAND EXECUTION
51+
-----------------
52+
53+
Everything following the ``--`` separator is treated as the command to execute
54+
in the modified environment.
55+
56+
If no ``--`` separator is provided, :command:`envml` assumes the first
57+
argument is a MODULE_ACTION and the remaining arguments form the command to
58+
execute.
59+
60+
OPTIONS
61+
-------
62+
63+
.. option:: --help, -h
64+
65+
Display usage information and exit.
66+
67+
EXAMPLES
68+
--------
69+
70+
Run ``command arg1 arg2`` in the environment restored from the default module
71+
collection:
72+
73+
.. code-block:: sh
74+
75+
envml restore command arg1 arg2
76+
77+
Purge all modules, then load ``mod1`` and ``mod2``, and run the command:
78+
79+
.. code-block:: sh
80+
81+
envml purge:mod1:mod2 command arg1 arg2
82+
83+
Use the ``--`` separator to avoid ambiguity:
84+
85+
.. code-block:: sh
86+
87+
envml restore load=mod1&mod2 -- command arg1 arg2
88+
89+
EXIT STATUS
90+
-----------
91+
92+
The :command:`envml` command returns the exit status of the executed command
93+
or ``1`` if module action fails.
94+
95+
DIAGNOSTICS
96+
-----------
97+
98+
If the :command:`module` command is not available in the shell (i.e., not a
99+
shell function), :command:`envml` will print an error and exit.
100+
101+
SEE ALSO
102+
--------
103+
104+
:ref:`module(1)`, :ref:`ml(1)`, :ref:`modulefile(5)`

doc/source/index.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ automatically configured to the correct architecture.
111111
ml
112112
module
113113
modulefile
114+
envml
114115

115116
.. toctree::
116117
:hidden:
@@ -135,8 +136,9 @@ introduced by each version is available in the :ref:`MIGRATING` guide.
135136
:ref:`changes` document gives an in-depth view of the modified behaviors and
136137
new features between major versions.
137138

138-
Reference manual page for the :ref:`module(1)` and :ref:`ml(1)` commands and
139-
for :ref:`modulefile(5)` script provide details on all supported options.
139+
Reference manual page for the :ref:`module(1)`, :ref:`ml(1)` and
140+
:ref:`envml(1)` commands and for :ref:`modulefile(5)` script provide details
141+
on all supported options.
140142

141143
A :ref:`cookbook` of recipes describes how to use the various features of
142144
Modules and how to extend the :command:`module` command to achieve specific

0 commit comments

Comments
 (0)