| 1 | // Copyright The gittuf Authors |
| 2 | // SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| 4 | package discardscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/internal/cmd/trustpolicy/discard`/ |
| 5 | |
| 6 | import ( |
| 7 | "github.com/gittuf/gittuf/experimental/gittufscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/experimental/gittuf`/" |
| 8 | "github.com/spf13/cobrascip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/" |
| 9 | ) |
| 10 | |
| 11 | type optionsscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/internal/cmd/trustpolicy/discard`/options# struct{} |
| 12 | |
| 13 | func (o *optionsscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/internal/cmd/trustpolicy/discard`/options#) AddFlagsscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/internal/cmd/trustpolicy/discard`/options#AddFlags().(_ *cobrascip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/.Commandscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#) {} |
| 14 | |
| 15 | func (o *optionsscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/internal/cmd/trustpolicy/discard`/options#) Runscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/internal/cmd/trustpolicy/discard`/options#Run().(_ *cobrascip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/.Commandscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#, _ []string) error { |
| 16 | repo, err := gittufscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/experimental/gittuf`/.LoadRepositoryscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/experimental/gittuf`/LoadRepository().(".") |
| 17 | if err != nil { |
| 18 | return err |
| 19 | } |
| 20 | |
| 21 | return repo.DiscardPolicyscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/experimental/gittuf`/Repository#DiscardPolicy().() |
| 22 | } |
| 23 | |
| 24 | func Newscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/internal/cmd/trustpolicy/discard`/New().() *cobrascip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/.Commandscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command# { |
| 25 | o := &optionsscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/internal/cmd/trustpolicy/discard`/options#{} |
| 26 | cmd := &cobrascip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/.Commandscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#{ |
| 27 | Usescip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#Use.: "discard", |
| 28 | Shortscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#Short.: "Discard the currently staged changes to policy", |
| 29 | Longscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#Long.: "The 'discard' command removes any currently staged policy changes. It is used to revert pending policy updates before they are applied to the repository.", |
| 30 | RunEscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#RunE.: o.Runscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/internal/cmd/trustpolicy/discard`/options#Run()., |
| 31 | DisableAutoGenTagscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#DisableAutoGenTag.: true, |
| 32 | } |
| 33 | o.AddFlagsscip-go gomod github.com/gittuf/gittuf . `github.com/gittuf/gittuf/internal/cmd/trustpolicy/discard`/options#AddFlags().(cmd) |
| 34 | |
| 35 | return cmd |
| 36 | } |