@@ -29,7 +29,14 @@ Updated at: {{.UpdatedAt}}`
2929)
3030
3131// NewFormat returns a Format for rendering using a secret Context
32+ //
33+ // Deprecated: this function was only used internally and will be removed in the next release.
3234func NewFormat (source string , quiet bool ) formatter.Format {
35+ return newFormat (source , quiet )
36+ }
37+
38+ // newFormat returns a Format for rendering using a secretContext.
39+ func newFormat (source string , quiet bool ) formatter.Format {
3340 switch source {
3441 case formatter .PrettyFormatKey :
3542 return secretInspectPrettyTemplate
@@ -43,7 +50,14 @@ func NewFormat(source string, quiet bool) formatter.Format {
4350}
4451
4552// FormatWrite writes the context
46- func FormatWrite (ctx formatter.Context , secrets []swarm.Secret ) error {
53+ //
54+ // Deprecated: this function was only used internally and will be removed in the next release.
55+ func FormatWrite (fmtCtx formatter.Context , secrets []swarm.Secret ) error {
56+ return formatWrite (fmtCtx , secrets )
57+ }
58+
59+ // formatWrite writes the context
60+ func formatWrite (fmtCtx formatter.Context , secrets []swarm.Secret ) error {
4761 render := func (format func (subContext formatter.SubContext ) error ) error {
4862 for _ , secret := range secrets {
4963 secretCtx := & secretContext {s : secret }
@@ -53,7 +67,7 @@ func FormatWrite(ctx formatter.Context, secrets []swarm.Secret) error {
5367 }
5468 return nil
5569 }
56- return ctx .Write (newSecretContext (), render )
70+ return fmtCtx .Write (newSecretContext (), render )
5771}
5872
5973func newSecretContext () * secretContext {
@@ -122,9 +136,16 @@ func (c *secretContext) Label(name string) string {
122136}
123137
124138// InspectFormatWrite renders the context for a list of secrets
125- func InspectFormatWrite (ctx formatter.Context , refs []string , getRef inspect.GetRefFunc ) error {
126- if ctx .Format != secretInspectPrettyTemplate {
127- return inspect .Inspect (ctx .Output , refs , string (ctx .Format ), getRef )
139+ //
140+ // Deprecated: this function was only used internally and will be removed in the next release.
141+ func InspectFormatWrite (fmtCtx formatter.Context , refs []string , getRef inspect.GetRefFunc ) error {
142+ return inspectFormatWrite (fmtCtx , refs , getRef )
143+ }
144+
145+ // inspectFormatWrite renders the context for a list of secrets.
146+ func inspectFormatWrite (fmtCtx formatter.Context , refs []string , getRef inspect.GetRefFunc ) error {
147+ if fmtCtx .Format != secretInspectPrettyTemplate {
148+ return inspect .Inspect (fmtCtx .Output , refs , string (fmtCtx .Format ), getRef )
128149 }
129150 render := func (format func (subContext formatter.SubContext ) error ) error {
130151 for _ , ref := range refs {
@@ -142,7 +163,7 @@ func InspectFormatWrite(ctx formatter.Context, refs []string, getRef inspect.Get
142163 }
143164 return nil
144165 }
145- return ctx .Write (& secretInspectContext {}, render )
166+ return fmtCtx .Write (& secretInspectContext {}, render )
146167}
147168
148169type secretInspectContext struct {
0 commit comments