It would be nice if there wasn't an early exit when a matching directory is found in `def.config`. That way you could have multiple matches for a directory, and it would make simple stacking work for subdirectories too. The current behaviour makes subdirectory matches odd insofar as the behaviour is dependent on the order of entries in `def.config`.
A couple of minor notes in the spirit of helpful commentary:
• You're creating a global `line` variable while reading the config, using `setopt warn_create_global` is a great built-in feature to highlight these during development.
• You can perform tilde expansion with `${~var}` instead of needing to run sed(see GLOB_SUBST in the zsh docs). This would also make zsh's named directory support work in the config.
• There are shell constructs to remove the need for cut too: First word `${line%% *}`, other words `${line#* }`.
It seems fairly straightforward to me (albeit filling in some inferred gaps): it runs configured commands when $CWD changes to a matching path/pattern.
Writing high quality docs is a challenging task, and one which many people—even if they’re quite good at it—will understandably prioritize lower than a first implementation effort as they validate idea. Which doesn’t necessarily mean that you’ll be impressed by the thing in it’s current state, but you certainly don’t need to call someone’s project garbage just because you’re not interested in it.
You could just… move on to something you’re more interested in. Or you could ask a question clarifying what the thing is/does. Or you could even offer constructive feedback like ‘the current README doesn’t make it clear to me what this does, a demo and a clearer explanation might help’. You even almost did that. But you undercut that message, needlessly insulting the project and potentially discouraging the human who made the effort to create it. That benefits no one.
3 comments
[ 2.9 ms ] story [ 12.6 ms ] threadIt would be nice if there wasn't an early exit when a matching directory is found in `def.config`. That way you could have multiple matches for a directory, and it would make simple stacking work for subdirectories too. The current behaviour makes subdirectory matches odd insofar as the behaviour is dependent on the order of entries in `def.config`.
A couple of minor notes in the spirit of helpful commentary:
• You're creating a global `line` variable while reading the config, using `setopt warn_create_global` is a great built-in feature to highlight these during development.
• You can perform tilde expansion with `${~var}` instead of needing to run sed(see GLOB_SUBST in the zsh docs). This would also make zsh's named directory support work in the config.
• There are shell constructs to remove the need for cut too: First word `${line%% *}`, other words `${line#* }`.
And it lacks a demo of what it does.
I always treat such projects just as useless garbage.
Writing high quality docs is a challenging task, and one which many people—even if they’re quite good at it—will understandably prioritize lower than a first implementation effort as they validate idea. Which doesn’t necessarily mean that you’ll be impressed by the thing in it’s current state, but you certainly don’t need to call someone’s project garbage just because you’re not interested in it.
You could just… move on to something you’re more interested in. Or you could ask a question clarifying what the thing is/does. Or you could even offer constructive feedback like ‘the current README doesn’t make it clear to me what this does, a demo and a clearer explanation might help’. You even almost did that. But you undercut that message, needlessly insulting the project and potentially discouraging the human who made the effort to create it. That benefits no one.