Skip to content

Commit c53d579

Browse files
committed
Fix version and output commands in alphabetical order
1 parent 2a37b13 commit c53d579

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

devcli/core/cli.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import typer
44
from rich import print
55
from typer import Context
6+
from typer.core import TyperGroup
67

78
from devcli.config import Config
89
from devcli.core import (
@@ -12,7 +13,13 @@
1213
load_dynamic_commands,
1314
)
1415

15-
cli = typer.Typer(add_completion=False, name="devcli")
16+
17+
class OrderedGroup(TyperGroup):
18+
def list_commands(self, ctx):
19+
return sorted(self.commands)
20+
21+
22+
cli = typer.Typer(add_completion=False, name="devcli", cls=OrderedGroup)
1623

1724
# config is a singleton to be
1825
# available to all parts of the system
@@ -35,7 +42,7 @@ def show_version():
3542
"""
3643
Show devcli version which is defined in pyproject.toml file
3744
38-
:return: tool.poetry.version
45+
:return: project.version
3946
"""
4047
project_conf = boot_conf.add_config(project_root("pyproject.toml"))
4148
print(f"devcli version {project_conf['project.version']}")

0 commit comments

Comments
 (0)