Skip to content

Commit

Permalink
🐛 Fix: 使用 nb 命令找不到 pyproject.toml (#91)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ju4tCode <[email protected]>
  • Loading branch information
3 people authored Jul 9, 2023
1 parent 3348a74 commit 6c4d754
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nb_cli/cli/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import click

from nb_cli import _, cache
from nb_cli.exceptions import ProjectNotFoundError
from nb_cli.handlers import run_script, list_scripts

from .utils import run_async
Expand Down Expand Up @@ -118,7 +119,12 @@ def _build_script_command(self, script_name: str) -> click.Command:
@run_async # type: ignore
@cache(ttl=None)
async def _load_scripts(self, ctx: click.Context) -> List[click.Command]:
scripts = await list_scripts()
try:
scripts = await list_scripts()
except ProjectNotFoundError:
# not in a project
return []

# check duplicate
elements = Counter(scripts).most_common()
if elements and elements[0][1] > 1:
Expand Down

0 comments on commit 6c4d754

Please sign in to comment.