Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 3603491

Browse files
authored
Merge pull request #442 from silvin-lubecki/clean-fork
Clean the fork command specific types
2 parents 92197ca + 0796c0e commit 3603491

1 file changed

Lines changed: 0 additions & 63 deletions

File tree

types/metadata/metadata.go

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -38,67 +38,4 @@ type AppMetadata struct {
3838
Description string `json:"description,omitempty"`
3939
Namespace string `json:"namespace,omitempty"`
4040
Maintainers Maintainers `json:"maintainers,omitempty"`
41-
Parents Parents `yaml:",omitempty" json:"parents,omitempty"`
42-
}
43-
44-
// Parents is a list of ParentMetadata items
45-
type Parents []ParentMetadata
46-
47-
// ParentMetadata contains historical data of forked packages
48-
type ParentMetadata struct {
49-
Name string `json:"name"`
50-
Namespace string `json:"namespace,omitempty"`
51-
Version string `json:"version"`
52-
Maintainers Maintainers `json:"maintainers,omitempty"`
53-
}
54-
55-
// Modifier is a function signature that takes and returns an AppMetadata object
56-
type Modifier func(AppMetadata) AppMetadata
57-
58-
// From returns an AppMetadata instance based on the provided AppMetadata
59-
// and applicable modifier functions
60-
func From(orig AppMetadata, modifiers ...Modifier) AppMetadata {
61-
parent := ParentMetadata{
62-
Name: orig.Name,
63-
Namespace: orig.Namespace,
64-
Version: orig.Version,
65-
Maintainers: orig.Maintainers,
66-
}
67-
68-
result := AppMetadata{
69-
Version: orig.Version,
70-
Name: orig.Name,
71-
Namespace: orig.Namespace,
72-
Description: orig.Description,
73-
Maintainers: orig.Maintainers,
74-
Parents: append(orig.Parents, parent),
75-
}
76-
for _, f := range modifiers {
77-
result = f(result)
78-
}
79-
return result
80-
}
81-
82-
// WithMaintainers returns a modified AppMetadata with updated maintainers field
83-
func WithMaintainers(maintainers Maintainers) Modifier {
84-
return func(parent AppMetadata) AppMetadata {
85-
parent.Maintainers = maintainers
86-
return parent
87-
}
88-
}
89-
90-
// WithName returns a modified AppMetadata with updated name field
91-
func WithName(name string) Modifier {
92-
return func(parent AppMetadata) AppMetadata {
93-
parent.Name = name
94-
return parent
95-
}
96-
}
97-
98-
// WithNamespace returns a modified AppMetadata with updated namespace field
99-
func WithNamespace(namespace string) Modifier {
100-
return func(parent AppMetadata) AppMetadata {
101-
parent.Namespace = namespace
102-
return parent
103-
}
10441
}

0 commit comments

Comments
 (0)