Skip to content

Commit 86337ba

Browse files
authored
Merge pull request #495 from seeM/fix-console-help
fix: `console_help` excludes entrypoints from the root module
2 parents 91cdf99 + d3dcbb8 commit 86337ba

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
@@ -2356,11 +2356,12 @@
23562356
"def console_help(\n",
23572357
" libname:str): # name of library for console script listing\n",
23582358
" \"Show help for all console scripts from `libname`\"\n",
2359+
" from fastcore.style import S\n",
23592360
" from pkg_resources import iter_entry_points as ep\n",
23602361
" for e in ep('console_scripts'): \n",
2361-
" if e.module_name.startswith(libname+'.'): \n",
2362-
" nm = f'\\033[1m\\033[94m{e.name}\\033[0m'\n",
2363-
" print(f'{nm:45}{e.load().__doc__}')"
2362+
" if e.module_name == libname or e.module_name.startswith(libname+'.'): \n",
2363+
" nm = S.bold.light_blue(e.name)\n",
2364+
" print(f'{nm:45}{e.load().__doc__}')\n"
23642365
]
23652366
},
23662367
{

0 commit comments

Comments
 (0)