Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions dexi/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import typer
from typing_extensions import Annotated

from .commands.installer import install_packages
from .commands.manager import (
Expand All @@ -7,7 +8,7 @@
update_all_packages,
update_package,
)
from .commands.viewer import list_packages
from .commands.viewer import autocomplete_packages, list_packages
from .core.errors import Errors

app = typer.Typer()
Expand All @@ -31,7 +32,14 @@ def add(package: str, branch: str = "main"):


@app.command()
def remove(package: str):
def remove(
package: Annotated[
str,
typer.Argument(
help="The name of the package", autocompletion=autocomplete_packages
),
],
):
"""
Removes and uninstalls a package.

Expand All @@ -46,7 +54,15 @@ def remove(package: str):


@app.command()
def update(package: str | None = None):
def update(
package: Annotated[
str,
typer.Argument(
help="The name of the package", autocompletion=autocomplete_packages
),
]
| None = None,
):
"""
Updates all packages or a specified package.

Expand Down
8 changes: 8 additions & 0 deletions dexi/commands/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
from ..core.utils import console, fetch_all_packages, fetch_pyproject, package_name


def autocomplete_packages(incomplete: str) -> list[str]:
return [
package["git"]
for package in fetch_all_packages()
if package["git"].startswith(incomplete)
]


def list_packages(hide_update: bool = False):
"""
Displays a list of packages.
Expand Down
Loading