Skip to content

Commit

Permalink
update version to 0.7.10
Browse files Browse the repository at this point in the history
  • Loading branch information
胡霁 authored and ice-black-tea committed Mar 28, 2023
1 parent a577899 commit 42efb23
Show file tree
Hide file tree
Showing 26 changed files with 264 additions and 133 deletions.
2 changes: 1 addition & 1 deletion src/linktools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
from ._logging import LogHandler
from ._config import Config
from ._tools import ToolContainer, ToolExecError, Tool
from ._environ import Environ, environ
from ._environ import BaseEnviron, environ
18 changes: 10 additions & 8 deletions src/linktools/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
from rich import get_console
from rich.tree import Tree

from . import cli
from ._environ import environ
from .cli import BaseCommand, walk_commands
from .decorator import cached_property
from .version import __description__


class CategoryInfo:
Expand All @@ -52,11 +51,14 @@ def __repr__(self):

class CommandInfo:

def __init__(self, name: str, category: CategoryInfo, command: cli.Command):
self.name = name
def __init__(self, category: CategoryInfo, command: BaseCommand):
self.category = category
self.command = command

@property
def name(self):
return self.command.name

@property
def description(self):
return self.command.description
Expand All @@ -65,7 +67,7 @@ def __repr__(self):
return self.name


class Command(cli.Command):
class Command(BaseCommand):

@cached_property
def _commands(self):
Expand All @@ -80,10 +82,9 @@ def _commands(self):
for category in module_categories:
commands[category] = []
path = os.path.join(module_path, category.name)
for name, command in cli.walk_commands(path):
for command in walk_commands(path):
commands[category].append(
CommandInfo(
name=name,
category=category,
command=command,
)
Expand Down Expand Up @@ -123,7 +124,8 @@ def run(self, args: [str]) -> Optional[int]:
node.add(f"👉 {command.category.prefix}[bold red]{command.name}[/bold red]: {command.description}")

console = get_console()
console.print(__description__, highlight=False)
if environ.description:
console.print(environ.description, highlight=False)
console.print(tree, highlight=False)


Expand Down
Loading

0 comments on commit 42efb23

Please sign in to comment.