-
-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(login): select login mode with type flag
- Loading branch information
Showing
6 changed files
with
210 additions
and
80 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package login | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/go-faster/errors" | ||
) | ||
|
||
//go:generate go-enum --values --names --flag --nocase | ||
|
||
// Type | ||
// ENUM(desktop, code, qr) | ||
type Type int | ||
|
||
type Options struct { | ||
Type Type | ||
Desktop string | ||
Passcode string | ||
} | ||
|
||
func Run(ctx context.Context, opts Options) error { | ||
switch opts.Type { | ||
case TypeDesktop: | ||
return Desktop(ctx, opts) | ||
case TypeCode: | ||
return Code(ctx) | ||
case TypeQr: | ||
return QR(ctx) | ||
default: | ||
return errors.Errorf("unsupported login type: %s", opts.Type) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters