-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from otiai10/feature/opt-symlink
Feature/opt symlink
- Loading branch information
Showing
3 changed files
with
97 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package copy | ||
|
||
// Options specifies optional actions on copying. | ||
type Options struct { | ||
// OnSymlink can specify what to do on symlink | ||
OnSymlink func(p string) SymlinkAction | ||
} | ||
|
||
// SymlinkAction represents what to do on symlink. | ||
type SymlinkAction int | ||
|
||
const ( | ||
// Deep creates hard-copy of contents. | ||
Deep SymlinkAction = iota | ||
// Shallow creates new symlink to the dest of symlink. | ||
Shallow | ||
// Skip does nothing with symlink. | ||
Skip | ||
) | ||
|
||
// DefaultOptions by default. | ||
var DefaultOptions = Options{ | ||
OnSymlink: func(string) SymlinkAction { | ||
return Shallow | ||
}, | ||
} |