Skip to content

feat: add -up and -update flags for self-updating - #206

Open
root-Manas wants to merge 1 commit into
projectdiscovery:devfrom
root-Manas:feat/self-update
Open

root-Manas wants to merge 1 commit into
projectdiscovery:devfrom
root-Manas:feat/self-update

Conversation

@root-Manas

Copy link
Copy Markdown

Adds -up and -update to update the installed simplehttpserver binary to the latest release, then exit before starting a server. Both flags use ProjectDiscovery's existing shared updater, matching the callback pattern used in uncover.

Fixes #155.

The README documents both flags. utils was already an indirect dependency; it is now direct at the same version, with the updater's transitive dependencies recorded by go mod tidy.

Subprocess tests exercise both aliases against mocked GitHub responses: an already-current release exits successfully, and a failed release lookup exits with an error. All four cases fail on unmodified dev because the flags are undefined. Tests make no external requests and do not replace an executable.

Validation on Windows/amd64 with Go 1.27.0:

  • go test ./internal/runner -run TestUpdateFlags -count=1 -v
  • go test ./...
  • go vet ./...
  • go build -o ../artifacts/simplehttpserver.exe ./cmd/simplehttpserver
  • Built executable's -h output lists both update aliases.

Copilot AI lite review requested due to automatic review settings September 27, 2026 04:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Adds self-update support for simplehttpserver via -up and -update, updating the installed binary and exiting.

Changes:

  • Registers both update aliases.
  • Integrates the shared updater callback.
  • Adds subprocess tests and documentation.
  • Updates updater dependencies.
File Description
README.md Documents update commands and aliases.
internal/​runner/​update_test.go Tests successful and failed update checks.
internal/​runner/​options.go Registers update flags.
internal/​runner/​banner.go Integrates the updater callback.
go.mod Adds the direct updater dependency.
go.sum Records dependency checksums.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants