Skip to content

Added support for symlinks and directories#108

Merged
S4tvara merged 6 commits intoS4tvara:mainfrom
harshalranjhani:main
Oct 6, 2025
Merged

Added support for symlinks and directories#108
S4tvara merged 6 commits intoS4tvara:mainfrom
harshalranjhani:main

Conversation

@harshalranjhani
Copy link
Copy Markdown
Contributor

Fixes #29

Summary

Adds support for directories and symbolic links to the add command with user-controlled flags for recursive traversal and hidden file inclusion.

New Flags

--recursive / -r: Recursively add directories (default: false)
--include-hidden / -H: Include hidden files/directories (default: false)

Changes

1. Helper Functions (internal/fs/helper.go)

  • Added PathType enum (File, Dir, Symlink, Other)
  • GetPathInfo(): Detects path type without following symlinks
  • ResolveSymlink(): Resolves symlinks to their targets
  • ShouldSkipHidden(): Filters hidden files based on flag

2. Add Command (cmd/add.go)

  • expandDirectories(): Expands directories into file pairs when --recursive is set
  • Walks directory tree using filepath.WalkDir()
  • Preserves directory structure in destination paths
  • Applies hidden file filtering based on --include-hidden
  • Updated processing loop to handle symlinks:
    • Resolves symlinks to files and stores target content
    • Rejects symlinks to directories
    • Fixed Windows symlink test compatibility

3. Tests (internal/fs/helper_test.go)

  • Added tests for GetPathInfo, ResolveSymlink, ShouldSkipHidden

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 5, 2025

Codecov Report

❌ Patch coverage is 22.90076% with 101 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/add.go 2.06% 95 Missing ⚠️
internal/fs/helper.go 82.35% 5 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@S4tvara S4tvara merged commit e30b291 into S4tvara:main Oct 6, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for directories and symlinks in sietch add command

2 participants