From e00b201a7767af245cac0021c8182181c479f27b Mon Sep 17 00:00:00 2001 From: Robin Olsen Date: Thu, 26 Feb 2026 20:26:15 +0100 Subject: [PATCH] add bash completion to os for survey and pm commands --- .gitignore | 2 +- Makefile | 17 +++++++++++------ build/Dockerfile | 7 ++++++- build/setup-desktop.sh | 31 ++++++++++++++++++++++++++----- internal/commands/survey/root.go | 1 - 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 84e580a..887dbaa 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ node_modules/ package-lock.json package.json -build/survey +build # Added by goreleaser init: dist/ diff --git a/Makefile b/Makefile index 41a553d..adff253 100644 --- a/Makefile +++ b/Makefile @@ -33,22 +33,25 @@ docker-run: docker-push: @docker push telikz/lazypm:latest -os-build: build +os-build: build completions + @cp ./bin/pm ./build/pm @cp ./bin/survey ./build/survey - @docker build -t telikz/lazypm:os ./build + @cp ./bin/survey_bash.sh ./build/survey_bash.sh + @cp ./bin/pm_bash.sh ./build/pm_bash.sh + @docker build -t telikz/lazyos ./build @echo "Built lazyos image successfully. You can run it using 'make os-run'." os-run: os-build - @docker run -d --name=lazyos -e PUID=1000 -e PGID=1000 -e TZ=Etc/UTC -p 3000:3000 -p 3001:3001 --shm-size="1gb" telikz/lazypm:os + @docker run -d --name=lazyos -e PUID=1000 -e PGID=1000 -e TZ=Etc/UTC -p 3000:3000 -p 3001:3001 --shm-size="1gb" telikz/lazyos @echo "Started lazyos container successfully. You can access the web interface at http://localhost:3000." os-stop: @docker stop lazyos - @docker rm lazyos + @docker rm -v --force lazyos @echo "Stopped and removed lazyos container successfully." os-push: - @docker push telikz/lazypm:os + @docker push telikz/lazyos start: @go run ./cmd/survey start @@ -74,8 +77,10 @@ tw: tw-install completions: - @go build -o ./bin/pm ./cmd/pm @mkdir -p ./bin + @go build -o ./bin/pm ./cmd/pm + @go build -o ./bin/survey ./cmd/survey + @./bin/survey completion bash > ./bin/survey_bash.sh @./bin/pm completion bash > ./bin/pm_bash.sh @./bin/pm completion zsh > ./bin/pm_zsh.sh @./bin/pm completion fish > ./bin/pm_fish.sh diff --git a/build/Dockerfile b/build/Dockerfile index 9184e80..714a8bf 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,6 +1,11 @@ FROM lscr.io/linuxserver/webtop:latest -RUN apk add --no-cache gcompat libc6-compat +RUN apk add --no-cache exo gcompat libc6-compat bash bash-completion alacritty + +COPY pm /usr/local/bin/pm +COPY pm_bash.sh /etc/bash_completion.d/pm +COPY survey_bash.sh /etc/bash_completion.d/survey +RUN chmod +x /usr/local/bin/pm COPY survey /usr/local/bin/survey RUN chmod +x /usr/local/bin/survey diff --git a/build/setup-desktop.sh b/build/setup-desktop.sh index d62c919..3df49f4 100644 --- a/build/setup-desktop.sh +++ b/build/setup-desktop.sh @@ -5,19 +5,40 @@ echo "**** Setting up custom desktop shortcuts ****" # Ensure the Desktop folder exists for the default 'abc' user mkdir -p /config/Desktop -cat < /config/Desktop/MyGoApp.desktop +cat < /config/Desktop/LazyPM.desktop [Desktop Entry] Version=1.0 Type=Application Name=PM Survey -Comment=Launch my custom Go binary +Comment=Launch the Prompt Manageragment Survey Exec=/usr/local/bin/survey start Icon=utilities-terminal Terminal=true Categories=Utility; EOF -chmod +x /config/Desktop/MyGoApp.desktop -chown abc:abc /config/Desktop/MyGoApp.desktop +chmod +x /config/Desktop/LazyPM.desktop +chown abc:abc /config/Desktop/LazyPM.desktop -echo "**** Desktop setup complete ****" +echo "**** Setting default browser to Chromium... ****" + +xdg-settings set default-web-browser chromium.desktop + +echo "**** Setting default handlers for HTTP and HTTPS... ****" +xdg-mime default chromium.desktop x-scheme-handler/http +xdg-mime default chromium.desktop x-scheme-handler/https + +echo "**** Setting up bash completion... ****" +source /etc/bash/bash_completion.sh + +echo "Setting Alacritty as default terminal..." +mkdir -p /config/.config/xfce4 + +cat > /config/.config/xfce4/helpers.rc <