File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77 "github.com/gopasspw/gopass/internal/backend"
88 "github.com/gopasspw/gopass/pkg/debug"
9+ "github.com/gopasspw/gopass/pkg/otp"
910 "github.com/gopasspw/gopass/pkg/set"
1011 "github.com/urfave/cli/v3"
1112)
@@ -890,7 +891,7 @@ func (s *Action) GetCommands() []*cli.Command {
890891 Before : s .IsInitialized ,
891892 Action : s .OTP ,
892893 ShellComplete : s .Complete ,
893- Flags : []cli.Flag {
894+ Flags : append ( []cli.Flag {
894895 & cli.BoolFlag {
895896 Name : "alsoclip" ,
896897 Aliases : []string {"C" },
@@ -916,12 +917,7 @@ func (s *Action) GetCommands() []*cli.Command {
916917 Aliases : []string {"o" },
917918 Usage : "Only display the token" ,
918919 },
919- & cli.BoolFlag {
920- Name : "snip" ,
921- Aliases : []string {"s" },
922- Usage : "Scan screen content to insert a OTP QR code into provided entry" ,
923- },
924- },
920+ }, otp .SnipFlags ()... ),
925921 },
926922 {
927923 Name : "process" ,
Original file line number Diff line number Diff line change @@ -5,10 +5,17 @@ package otp
55import (
66 "context"
77 "fmt"
8+
9+ "github.com/urfave/cli/v3"
810)
911
1012// ParseScreen will attempt to parse all available screen and will look for otpauth QR codes. It returns the first one
1113// it has found.
1214func ParseScreen (ctx context.Context ) (string , error ) {
1315 return "" , fmt .Errorf ("not supported on your platform" )
1416}
17+
18+ // SnipFlags returns an empty slice because the screen-capture feature is not available in this build.
19+ func SnipFlags () []cli.Flag {
20+ return nil
21+ }
Original file line number Diff line number Diff line change @@ -10,8 +10,20 @@ import (
1010 "github.com/kbinani/screenshot"
1111 "github.com/makiuchi-d/gozxing"
1212 "github.com/makiuchi-d/gozxing/qrcode"
13+ "github.com/urfave/cli/v3"
1314)
1415
16+ // SnipFlags returns the CLI flags for the screen-capture (snip) feature.
17+ func SnipFlags () []cli.Flag {
18+ return []cli.Flag {
19+ & cli.BoolFlag {
20+ Name : "snip" ,
21+ Aliases : []string {"s" },
22+ Usage : "Scan screen content to insert a OTP QR code into provided entry" ,
23+ },
24+ }
25+ }
26+
1527// ParseScreen will attempt to parse all available screen and will look for otpauth QR codes. It returns the first one
1628// it has found.
1729func ParseScreen (ctx context.Context ) (string , error ) {
You can’t perform that action at this time.
0 commit comments