Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the symlink action #227

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const (
RenameAction
// ChmodAction the action of change the file mode
ChmodAction
// SymlinkAction the action of create a symbolic link
SymlinkAction
// maxAction the max boundary value of Action, it is an invalid value
maxAction
)
Expand All @@ -36,6 +38,8 @@ func (action Action) String() string {
desc = "Rename"
case ChmodAction:
desc = "Chmod"
case SymlinkAction:
desc = "Symlink"
case UnknownAction:
desc = "Unknown"
default:
Expand Down
3 changes: 3 additions & 0 deletions action/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func TestParseActionFromString(t *testing.T) {
{"3", RemoveAction},
{"4", RenameAction},
{"5", ChmodAction},
{"6", SymlinkAction},
{"99999", UnknownAction},
{"xyz", UnknownAction},
{"0", UnknownAction},
Expand Down Expand Up @@ -40,6 +41,7 @@ func TestAction_Int(t *testing.T) {
{"RemoveAction", RemoveAction, 3},
{"RenameAction", RenameAction, 4},
{"ChmodAction", ChmodAction, 5},
{"SymlinkAction", SymlinkAction, 6},
{"Action(10)", Action(10), 10},
{"Action(10).Valid()", Action(10).Valid(), UnknownAction.Int()},
}
Expand All @@ -66,6 +68,7 @@ func TestAction_String(t *testing.T) {
{"RemoveAction", RemoveAction, "Remove"},
{"RenameAction", RenameAction, "Rename"},
{"ChmodAction", ChmodAction, "Chmod"},
{"SymlinkAction", SymlinkAction, "Symlink"},
{"Action(10)", Action(10), "Invalid"},
}

Expand Down