Improve warning output if no clipboard is available
Fixes
@@ -7,10 +7,16 @@ import (
"github.com/atotto/clipboard"
"github.com/fatih/color"
"github.com/justwatchcom/gopass/utils/ctxutil"
+ "github.com/justwatchcom/gopass/utils/out"
"github.com/pkg/errors"
)
func (s *Action) copyToClipboard(ctx context.Context, name string, content []byte) error {
+ if clipboard.Unsupported {
+ out.Yellow(ctx, "WARNING: No clipboard available. Install xsel or xclip or use -p to print to console")
+ return nil
+ }
+
if err := clipboard.WriteAll(string(content)); err != nil {
return errors.Wrapf(err, "failed to write to clipboard")
}
