mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
datasette install / datasette uninstall commands, closes #925
This commit is contained in:
parent
3fa261d1d2
commit
01fe5b7401
3 changed files with 58 additions and 0 deletions
|
|
@ -231,6 +231,31 @@ def package(
|
|||
call(args)
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("packages", nargs=-1, required=True)
|
||||
def install(packages):
|
||||
"Install Python packages - e.g. Datasette plugins - into the same environment as Datasett"
|
||||
from pip._internal.cli.main import main
|
||||
|
||||
try:
|
||||
main(["install"] + list(packages))
|
||||
except SystemExit as e:
|
||||
pass
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("packages", nargs=-1, required=True)
|
||||
@click.option("-y", "--yes", is_flag=True, help="Don't ask for confirmation")
|
||||
def uninstall(packages, yes):
|
||||
"Uninstall Python packages (e.g. plugins) from the Datasette environment"
|
||||
from pip._internal.cli.main import main
|
||||
|
||||
try:
|
||||
main(["uninstall"] + list(packages) + (["-y"] if yes else []))
|
||||
except SystemExit as e:
|
||||
pass
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("files", type=click.Path(exists=True), nargs=-1)
|
||||
@click.option(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue