Added index command

This commit is contained in:
Tris Forster 2025-10-03 16:35:04 +10:00
parent 66eed73c0e
commit 128f34c997
3 changed files with 23 additions and 4 deletions

View File

@ -35,7 +35,7 @@ RUN apt-get -y install breeze-icon-theme python3-venv
# clean up
RUN apt-get clean
ARG SQUIRREL_VERSION=0.4.0
ARG SQUIRREL_VERSION=0.4.1
COPY dist/squirrel-${SQUIRREL_VERSION}-py3-none-any.whl squirrel-${SQUIRREL_VERSION}-py3-none-any.whl
@ -44,6 +44,8 @@ RUN /opt/squirrel/bin/pip install squirrel-${SQUIRREL_VERSION}-py3-none-any.whl
RUN /opt/squirrel/bin/pip install gunicorn
COPY squirrel-cmd /opt/squirrel/bin/squirrel
ENV PATH /opt/squirrel/bin:${PATH}
ENV SQUIRREL_CONFIG /etc/squirrel/config.json
EXPOSE 8000

View File

@ -1,6 +1,6 @@
[project]
name = "squirrel"
version = "0.4.0"
version = "0.4.1"
description = "Find your nuts"
authors = [
{name = "trisf"}
@ -13,8 +13,8 @@ dependencies = [
"dotenv (>=0.9.9,<0.10.0)"
]
#[project.scripts]
#"squirrel" = "squirrel.server:daemon"
[project.scripts]
"sqindex" = "squirrel.cmd:reindex"
[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]

17
squirrel/cmd.py Normal file
View File

@ -0,0 +1,17 @@
from squirrel.repo import get_archive
import shutil
import sys
archive = get_archive()
def reindex():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("repo")
options = parser.parse_args()
p = archive.reindex(options.repo)
for line in p.stderr:
sys.stderr.write(line.decode("utf8"))