Skip to content

Add batch check methods, safety features, and bug fixes#57

Merged
luthermonson merged 1 commit intomainfrom
feature/vvv-improvements
Jan 6, 2026
Merged

Add batch check methods, safety features, and bug fixes#57
luthermonson merged 1 commit intomainfrom
feature/vvv-improvements

Conversation

@tomjn
Copy link
Contributor

@tomjn tomjn commented Dec 30, 2025

Some changes to support checking hosts before attempting to modify files with sudo, and attempting to fix some edge cases around host file comments and race conditions.

Features added:

  • HasAll(): Check if IP has all specified hostnames
  • HasAny(): Check if IP has any of specified hostnames
  • CheckAll(): Get map of hostname existence status
  • Backup(): Create backup before modifying hosts file
  • BackupTo(): Create backup to custom location
  • HasBeenModified(): Detect concurrent modifications

Bug fixes:

  • Fix comment parsing to preserve multiple # characters

Safety improvements:

  • Add modTime tracking for modification detection
  • Enable pre-write safety checks

Tests:

  • Add tests for new features
  • Add regression test for multi-# comment parsing

Features added:
- HasAll(): Check if IP has all specified hostnames
- HasAny(): Check if IP has any of specified hostnames
- CheckAll(): Get map of hostname existence status
- Backup(): Create backup before modifying hosts file
- BackupTo(): Create backup to custom location
- HasBeenModified(): Detect concurrent modifications

Bug fixes:
- Fix comment parsing to preserve multiple # characters

Safety improvements:
- Add modTime tracking for modification detection
- Enable pre-write safety checks

Tests:
- Add comprehensive tests for all new features
- Add regression test for multi-# comment parsing

This addresses VVV requirements for:
- Checking hosts without sudo (read-only operations)
- Preventing data loss with backups
- Better comment preservation
@Mte90
Copy link
Member

Mte90 commented Dec 31, 2025

To me it make sense what do you think @luthermonson ?

@luthermonson
Copy link
Contributor

makes sense to me

@luthermonson luthermonson merged commit 7d30adf into main Jan 6, 2026
2 checks passed
@luthermonson luthermonson deleted the feature/vvv-improvements branch January 6, 2026 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants