Closed michaelortmann closed 3 months ago
Very nice addition!
info commands is all C implemented functions and you filter them by excluding the ones with ":" in their name to hide the implicit bind functions *raw:gotjoin
etc.?
If that's true, the "official" way would be to hide the ones starting with *
.
info procs would be all Tcl implemented functions, not sure if we want to include that or not.
At first i had it filtered for *
, but then i saw remaining :
in function names. so, i switched to that, which excludes a superset compared to the set of functions starting with *
for it didnt occur to me, that :
is an allowed char in a function name for python top be able to call it. so i was fast filtering for :
here. maybe too fast? if those funcs are callable, we could switch back to *
in beginning, yeah.
regarding which functions exactly to include/exclude: this PR aimed to be very simple. few lines of code enabling a new feature. you are free to take it from here and go the extra mile :)
Use a Python Set instead of a list
I was using a list
instead of set
on purpose, because thats the default return type of dir:
https://docs.python.org/3/library/functions.html#dir
example:
>>> type(dir())
<class 'list'>
do you still want to return a set?
no, you are right, list is fine then, but it should still be [info commands] and [info procs] but without the ones starting with *
no, you are right, list is fine then, but it should still be [info commands] and [info procs] but without the ones starting with
*
but when filtering with starting *
what about remaining strings containing :
like filt:dcc_action
?
Those should stay in - a lot of scripts have their commands this way too and it's not "internal" commands
Found by: (thommey or vanosg, asthere was a TODO comment i picked up) Patch by: michaelortmann Fixes:
One-line summary: Add dir(eggdrop.tcl)
Additional description (if needed):
Test cases demonstrating functionality (if applicable): Before:
After: