command 'frappy cli' does now connect to the configured frappy

and not scanned frappy servers
This commit is contained in:
2025-07-08 08:27:23 +02:00
parent df19b1c8a0
commit e008ae11f5
3 changed files with 13 additions and 5 deletions

View File

@@ -130,11 +130,12 @@ WantedBy = multi-user.target
FRAPPY_SERVICE = """[Unit]
Description = Running frappy server
After=waitboot.service
[Service]
Type=simple
Environment=PYTHONPATH=/home/l_samenv/.local/lib/python3.11/site-packages/
ExecStart = /home/l_samenv/boxtools/start_frappy 10
ExecStart = /home/l_samenv/boxtools/start_frappy
[Install]
WantedBy = default.target

View File

@@ -5,6 +5,7 @@ import time
from frappy.lib import generalConfig
from frappy.logging import logger
from frappy.server import Server
from frappy.client.interactive import init, interact
from utils import BoxInfo
box = BoxInfo()
@@ -15,9 +16,15 @@ def main(cfg, port=None, **_):
srv = Server(cfg, logger.log, cfgfiles=None, interface=port)
srv.run()
if len(sys.argv) > 1:
time.sleep(int(sys.argv[1]))
def cli(cfg, port, **_):
init(f'localhost:{port}')
interact()
main(**box.read_config('FRAPPY'))
cfg = box.read_config('FRAPPY')
if sys.argv[1:2] == ['cli']:
cli(**cfg)
else:
main(**cfg)

View File

@@ -13,7 +13,7 @@ frappy() {
if [[ -z "$1" ]]; then
echo "Usage: frappy status|start|stop|restart|cli"
elif [[ "$1" == "cli" ]]; then
~/frappy/bin/frappy-cli
~/boxtools/start_frappy cli
else
systemctl --user $1 frappy
fi