Skip to content

Commit

Permalink
add rsync --exclude-from option
Browse files Browse the repository at this point in the history
  • Loading branch information
bougou committed Aug 9, 2023
1 parent 827d57d commit 2681a83
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Repository contains some helpful tools:
- raw rsync wrapper
- rsync task — wrapper which provide important information about rsync task: progress, remain items, total items and speed
- rsync task — wrapper which provide important information about rsync task: progress, remain items, total items and speed

## Task wrapper usage

Expand Down
6 changes: 6 additions & 0 deletions rsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ type RsyncOptions struct {
Info string
// Exclude --exclude="", exclude remote paths.
Exclude []string
// ExcludeFrom --exclude-from="", read exclude patterns from FILE
ExcludeFrom string
// Include --include="", include remote paths.
Include []string
// Filter --filter="", include filter rule.
Expand Down Expand Up @@ -597,6 +599,10 @@ func getArguments(options RsyncOptions) []string {
}
}

if options.ExcludeFrom != "" {
arguments = append(arguments, fmt.Sprintf("--exclude-from=%s", options.ExcludeFrom))
}

if options.Filter != "" {
arguments = append(arguments, fmt.Sprintf("--filter=%s", options.Filter))
}
Expand Down

0 comments on commit 2681a83

Please sign in to comment.