Files
Adem BaccaraandGitHub b7fb586e73 feat(parser): refactor ssh_config parser and writer to preserve unmanaged fields, comments, and directives (#45)
This PR introduces a major refactor of the SSH config parsing and writing logic. The new implementation is more robust and secure, ensuring that only the intended changes are applied while preserving the original file’s structure.

Key changes

- Lossless parsing/writing: Preserve unmanaged fields (e.g., `ProxyJump`), comments, and directives such as `Include` and `Match`.

- Library update: Switched to [github.com/kevinburke/ssh_config](https://github.com/kevinburke/ssh_config)
 as the base parser, with a custom fork to support required modifications https://github.com/adembc/ssh_config.

- Backup policy: Before any modification, create a backup of the SSH config file. Maintain up to 10 backups (configurable in the future) and automatically delete older ones.

- IdentityFile handling: Parse IdentityFile as an array instead of a single string, with improved update logic.

- Bug fix: Resolve issue where tags could not be fully removed.

- Multiple aliases: Support defining and managing multiple aliases for a single server.

- Testability: Code has been refactored with testability in mind. Follow-up PRs will include dedicated tests.
2025-09-10 23:24:50 +01:00

28 lines
821 B
AMPL

module github.com/Adembc/lazyssh
go 1.24.6
replace github.com/kevinburke/ssh_config => github.com/adembc/ssh_config v1.4.2
require (
github.com/atotto/clipboard v0.1.4
github.com/gdamore/tcell/v2 v2.9.0
github.com/kevinburke/ssh_config v1.4.0
github.com/mattn/go-runewidth v0.0.16
github.com/rivo/tview v0.0.0-20250625164341-a4a78f1e05cb
github.com/spf13/cobra v1.9.1
go.uber.org/zap v1.27.0
)
require (
github.com/gdamore/encoding v1.0.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/spf13/pflag v1.0.7 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/term v0.34.0 // indirect
golang.org/x/text v0.28.0 // indirect
)