I have something like 30-50 repositories in my ~/Workspace
.
That is absolutely awful.
At some point, I tried to subdivide them into "categories" like "dev", "sys", "alpine" and so on.
That didn’t help much.
I clearly needed something to help me navigate around them, in a sort of "bookmark"ish way, and handle initial setup. So I accidentally wrote the SysV RC in zsh.
-
Acquire
zpe.zwc
-
Download it from the GitHub releases page
-
Use gmake with zsh installed to generate it from source
-
-
Store it in a consistent location
-
Add the file to your
fpath
(example:fpath+=( ~/.zsh/zpe.zwc )
) -
Autoload all the contents of the digest file (example:
autoload -w ~/.zsh/zpe.zwc
)
Note
|
If you’re using the latest version of toasty-zsh, you can simply drop zpe.zwc into your $zd/digests folder.
|
zpe
is the main function name.
Everything is done through subcommands.
zpe new
-
Creates a new project environment. Effectively, this creates three new files inside
$ZPE_DIR
(name.up
,name.down
andname.env
), and populates them with defaults. You also can optionally pass it a directory for the project in question. It defaults to the current working directory. Example:zpe new tzsh ~/Workspace/sys/toasty-zsh
zpe edit
-
Edits one of the three files created by
zpe new
. Defaults to editingname.up
. Pass an extra parameter to give the suffix to edit. Example:zpe edit tzsh env
zpe load
-
Loads one of the following:
-
global configuration (
zpe.conf
) -
name.env
if only name is passed -
name.ext
if name and an ext is passedExample:
zpe load tzsh down
-
zpe ls|list
-
Lists the projects in their "callable" form. Usually sorted, but not guaranteed to be such. If an argument is provided, it takes that to be a project name and lists the files under that project (e.g "up" and "down").
zpe cat
-
Prints the contents of a given project file.
zpe cp|copy
-
Copies project from argument 1 to argument 2. Best effort to translate variable names.
zpe mv|move
-
Renames project from argument 1 to argument 2. Best effort to translate variable names.
zpe exec
-
Runs a command in the context of a project. Example:
zpe exec tzsh git pull
WarningThe parsing is simplistic: $1
is the project name and the other arguments are evaluated as-is. zpe rm
-
Removes a project. More precisely, it removes
$1.*
from$ZPE_DIR
. Example:zpe rm tzsh
zpe up|down
-
Convenience shortcuts for
zpe load $1 up|down
. Example:zpe up tzsh
.