MyCmd and MyProject Weekly Progress Report: 2025 Week 36
This week ended up being a busy week and so I don’t have demo to show, but I will put one together next week to demonstrate that includes this week’s changes.
Graphing The Dependency Between MyCmd Support Libraries
I have split the core MyCmd implementation into a base mycmd-lib file and a set of support library files in the same directory. From each support library file, I only load the other support libraries that are required for that file’s functionality. This makes testing each part in isolation in unit tests easier.
This week I was returning to implementing features in MyCmd, after
not working on any MyCmd features itself for a few months while I
focused on MyProject and
testing work. I didn’t fully remember the relationship between the files
and the loading order. So, I took the time to create a GraphViz dot file
(see it here)
with the relationships between these files. In this diagram,
mycmd-lib
refers to the above linked mycmd-lib
file, and then all of the others refer to the support library file
names. For example, formatted-output
in the diagram maps to
mycmd-formatted-output-lib.
From this, the following graph is generated:

Cross Platform Binary Support
In MyCmd, I have support in the mycmd-platform-support-lib,
I have support for handling system provided binaries in a cross-platform
way. For example, I use realpath
from GNU Coreutils, as it
offers a bit more features than the realpath
provided by
Mac OS. To do this, I install GNU Coreutils with HomeBrew. But this means GNU
realpath
is installed as grealpath
(Yes, I
know you can get it as realtpath
by changing your PATH, but
I don’t want to require that).
In support of this, I have a few functions:
mycmd.init_bin
- it uses a mapping in MyCmd to look for the appropriate executable name depending on the platform and errors if it is not found. Often this is called withmycmd.defer_at_startup
to do this when the library is loaded.mycmd.bin_execute
- I use this to execute the appropriate executable when found
For example, see the following snippet from the logging
command group, from before this week’s changes (see the
source here):
mycmd.defer_at_startup mycmd.init_bin zcat
function logging.cat_log() {
local -r log_file="${1}"
if [[ "${log_file}" =~ .+\.gz$ ]]; then
mycmd.bin_execute zcat "${log_file}"
else
cat "${log_file}"
fi
}
The problem with this mechanism is that if you have multiple calls to
mycmd.defer_at_startup mycmd.init_bin
for various
dependencies, it will stop at the first missing dependency. You fix that
one, and then it will run and then stop at the next one. I wanted a way
to handle this all at once and tell all of the missing dependencies at
once. So, this week I added a mechanism to add the dependencies to
initialize all in a bench. Now the first line of the above snippet is
this (see the
new source here):
mycmd.add_to_init_bin_batch zcat
With this, I now execute the initialize the batch at two separate times:
- First, when
mycmd-lib
and all of its support libraries are loaded - Secondly, after a command and its command groups have been loaded prior to executing the command
I did not complete this part this week, but I’m starting to also add this support into MyProject and have it execute the initialize batch after all of the task definition files have been loaded.
MyCmd Updates
This week I pushed 2 commits to MyCmd, including the following changes:
- Adding
mycmd.add_to_init_bin_batch
for batching initialization - Created a Graphviz Dot file for the
mycmd-lib
and support library dependencies
With this new feature, I created a new development snapshot tag and have updated my local snapshot worktree to this.
MyProject Updates
This week I pushed 1
commit to MyProject, using mycmd.add_to_init_bin_batch
instead of the old mycmd.defer_at_startup mycmd.init_bin
pattern for MyProject’s system dependencies.
Other Changes
This week I pushed 2 commits to my dotfiles, including the following changes:
- Cleaned up my Zsh configuration files to unset the temporary functions used during the startup configuration
- Updated my personal MyCmd command groups and commands to use the new
mycmd.add_to_init_bin_batch
function
Next Week
I need to finish adding support in MyProject to execute the batched bin initialization after loading the MyProject task definition files, and then update all of my task definition files to use the new pattern.
All of my MyCmd and MyProject Weekly Progress reports will be linked from here.