cli/command: implement ErrPromptTerminated without errdefs package

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-03-22 13:26:43 +01:00
parent 8633197105
commit af85e1e2f7

View File

@ -16,7 +16,6 @@ import (
"github.com/docker/cli/cli/config"
"github.com/docker/cli/cli/streams"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/errdefs"
"github.com/moby/sys/atomicwriter"
"github.com/moby/term"
"github.com/pkg/errors"
@ -36,7 +35,15 @@ func CopyToFile(outfile string, r io.Reader) error {
return err
}
var ErrPromptTerminated = errdefs.Cancelled(errors.New("prompt terminated"))
const ErrPromptTerminated cancelledErr = "prompt terminated"
type cancelledErr string
func (e cancelledErr) Error() string {
return string(e)
}
func (cancelledErr) Cancelled() {}
// DisableInputEcho disables input echo on the provided streams.In.
// This is useful when the user provides sensitive information like passwords.