-
Notifications
You must be signed in to change notification settings - Fork 2
Shells and mepo
mepo provides a few helper shell functions to make things easier
mepo-cd
is a helper shell function (alias in csh) that uses mepo whereis
information to move you around the repositories. So for example:
❯ mepo whereis
GEOSgcm | .
env | @env
cmake | @cmake
ecbuild | @cmake/@ecbuild
NCEP_Shared | src/Shared/@NCEP_Shared
GMAO_Shared | src/Shared/@GMAO_Shared
MAPL | src/Shared/@MAPL
FMS | src/Shared/@FMS
GEOSgcm_GridComp | src/Components/@GEOSgcm_GridComp
FVdycoreCubed_GridComp | src/Components/@GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSsuperdyn_GridComp/@FVdycoreCubed_GridComp
fvdycore | src/Components/@GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSsuperdyn_GridComp/@FVdycoreCubed_GridComp/@fvdycore
GEOSchem_GridComp | src/Components/@GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/@GEOSchem_GridComp
mom | src/Components/@GEOSgcm_GridComp/GEOSogcm_GridComp/GEOSocean_GridComp/GuestOcean_GridComp/MOM_GEOS5PlugMod/@mom
mom6 | src/Components/@GEOSgcm_GridComp/GEOSogcm_GridComp/GEOSocean_GridComp/GuestOcean_GridComp/MOM6_GEOSPlug/@mom6
GEOSgcm_App | src/Applications/@GEOSgcm_App
UMD_Etc | src/Applications/@UMD_Etc
CPLFCST_Etc | src/Applications/@CPLFCST_Etc
❯ pwd
/Users/mathomp4/MepoTalk/v10.16.3
❯ mepo-cd FMS
❯ pwd
/Users/mathomp4/MepoTalk/v10.16.3/src/Shared/@FMS
Running mepo-cd FMS
is equivalent to cd $(mepo whereis FMS)
(and indeed is run as such in the function).
In zsh and bash, running just mepo-cd
will bring you back to the root of the fixture. It's equivalent to mepo-cd GEOSgcm
say, for, the GEOSgcm fixture. Note though that due to limitation of csh/tcsh, this does not work there.
For bash, one should source the mepo-cd.bash
script in the etc/
directory of mepo in their .bashrc
:
[ -f /path/to/mepo/etc/mepo-cd.bash ] && source /path/to/mepo/etc/mepo-cd.bash
This adds a mepo-cd
function to the shell.
[ -f /discover/swdev/gmao_SIteam/mepo/etc/mepo-cd.bash ] && source /discover/swdev/gmao_SIteam/mepo/etc/mepo-cd.bash
[ -f /nobackup/gmao_SIteam/mepo/etc/mepo-cd.bash ] && source /nobackup/gmao_SIteam/mepo/etc/mepo-cd.bash
For zsh, one should source the mepo-cd.zsh
script in the etc/
directory of mepo in their .zshrc
:
[[ -f /path/to/mepo/etc/mepo-cd.zsh ]] && source /path/to/mepo/etc/mepo-cd.zsh
This adds a mepo-cd
function to the shell.
[[ -f /discover/swdev/gmao_SIteam/mepo/etc/mepo-cd.zsh ]] && source /discover/swdev/gmao_SIteam/mepo/etc/mepo-cd.zsh
[[ -f /nobackup/gmao_SIteam/mepo/etc/mepo-cd.zsh ]] && source /nobackup/gmao_SIteam/mepo/etc/mepo-cd.zsh
For csh and tcsh, one would add to .cshrc
or .tcshrc
:
source /path/to/mepo/etc/mepo-cd.csh
Note that since csh and tcsh do not support shell functions, this defines an alias. It does not have as much power as the bash/zsh functions (for example, you cannot run mepo-cd
by itself. It requires an argument.)
source /discover/swdev/gmao_SIteam/mepo/etc/mepo-cd.csh
source /nobackup/gmao_SIteam/mepo/etc/mepo-cd.csh
A very limited bash completion script can be found in the mepo/etc/
folder as well. It is not very complete, but we would gladly accept any enhancements from users.
[ -f /path/to/mepo/etc/mepo-completion.bash ] && source /path/to/mepo/etc/mepo-completion.bash
[ -f /discover/swdev/gmao_SIteam/mepo/etc/mepo-completion.bash ] && source /discover/swdev/gmao_SIteam/mepo/etc/mepo-completion.bash
[ -f /nobackup/gmao_SIteam/mepo/etc/mepo-completion.bash ] && source /nobackup/gmao_SIteam/mepo/etc/mepo-completion.bash
[[ -f /path/to/mepo/etc/mepo-completion.bash ]] && source /path/to/mepo/etc/mepo-completion.bash
zsh users might have to add:
autoload -Uz bashcompinit && bashcompinit
before sourcing the bash completion script.
[[ -f /discover/swdev/gmao_SIteam/mepo/etc/mepo-completion.bash ]] && source /discover/swdev/gmao_SIteam/mepo/etc/mepo-completion.bash
[[ -f /nobackup/gmao_SIteam/mepo/etc/mepo-completion.bash ]] && source /nobackup/gmao_SIteam/mepo/etc/mepo-completion.bash