Skip to content

Commit d3dcbb8

Browse files
committed
fix: console_help excludes entrypoints from the root module
1 parent f2e438d commit d3dcbb8

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

fastcore/xtras.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,10 @@ def shufflish(x, pct=0.04):
558558
def console_help(
559559
libname:str): # name of library for console script listing
560560
"Show help for all console scripts from `libname`"
561+
from fastcore.style import S
561562
from pkg_resources import iter_entry_points as ep
562563
for e in ep('console_scripts'):
563-
if e.module_name.startswith(libname+'.'):
564-
nm = f'\033[1m\033[94m{e.name}\033[0m'
564+
if e.module_name == libname or e.module_name.startswith(libname+'.'):
565+
nm = S.bold.light_blue(e.name)
565566
print(f'{nm:45}{e.load().__doc__}')
567+

nbs/03_xtras.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,11 +2357,12 @@
23572357
"def console_help(\n",
23582358
" libname:str): # name of library for console script listing\n",
23592359
" \"Show help for all console scripts from `libname`\"\n",
2360+
" from fastcore.style import S\n",
23602361
" from pkg_resources import iter_entry_points as ep\n",
23612362
" for e in ep('console_scripts'): \n",
2362-
" if e.module_name.startswith(libname+'.'): \n",
2363-
" nm = f'\\033[1m\\033[94m{e.name}\\033[0m'\n",
2364-
" print(f'{nm:45}{e.load().__doc__}')"
2363+
" if e.module_name == libname or e.module_name.startswith(libname+'.'): \n",
2364+
" nm = S.bold.light_blue(e.name)\n",
2365+
" print(f'{nm:45}{e.load().__doc__}')\n"
23652366
]
23662367
},
23672368
{

0 commit comments

Comments
 (0)