Let -s ignore number prefix of script to include
fictionic opened this issue · 8 comments
The indeces of the scripts are an implementation detail that the user should not need to worry about. The user only cares about the functionality of the included script, which is indicated in the main part of the name. E.g. -s cover
vs -s 70-cover
.
Another, more drastic idea would be to make -s
work exactly like -r
—that is, make it include all scripts whose name match the provided regex. This is desirable for the same reason as it is for -r
. Suppose you have two scripts that deal with file tags (as I do): 10-tag-fields
and 11-tag-contents
. If you want to run only those scripts, you'd need to do -r '' -s 10-tag-fields -s 11-tag-contents
. With the regex strategy, this becomes -r '' -s tag
. This also occurs when the scripts you want to include are not run by default.
What do you think?
In retrospect, the commandline usability of demlo suffers from debatable design decisions.
Your suggestion only tackles the tip of iceberg...
- First of, to make sure there is no misunderstanding: indices are used to sort scripts in the script chain.
For instance,10-tag
is run before60-path
, which is almost always what we want.
I think there originally were a few reason as for why -s
does not accept regexp; however, with latest versions none of them seems to be valid anymore.
- Pro-tip: If you use the fish shell or Eshell, demlo can auto-complete the script names.
Completion does not work on -r
though, I think it's an oversight. I should fix that too.
Other points unrelated to your request, but I'm curious if you'd have any comment on this.
-
I think each script should come with an individual help which would provide a description, a list of the global variables in use if any, and some examples. I believe that would make Demlo dramatically more user friendly.
-
Sensible defaults: right now, the included
demlorc
is not parsed in the system folder. I think Demlo should parse it so that a config-less Demlo does something meaningful by default instead of doing nothing. It would still be possible revert to the current behaviour by either uninstalling the systemdemlorc
or by creating and empty userdemlorc
.
- Yes I do know the purpose of the prefixes. That's all good.
- I know, and I use zsh... is zsh completion something you plan on doing? Not the biggest priority obviously, but it would be nice.
- Yes, in fact that is something I plan to do for my own demlo script system (which sort of creates its own use framework anyway). See here (it's still a work in progress, but it's usable).
- Ah, that is also a good idea! Though how would you deal with the fact that the user might have modified the scripts in the user config folder? I suppose if that folder exists then the system one should be ignored?
(2) I've dumped zsh a long time ago... Too much insanity there for me, sorry :p I'll welcome any contribution however, obviously.
(4) You meant demlorc
, right? Then that's correct.
(2) Yeah it's hella complicated for sure. I'll look into it at some point.
(3) Yep
I'd also love any feedback you have on my demloconf repo that I linked above; I've worked on it a whole lot!
@fictionic Let me know if that works for you.