Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better login commands #81

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions natster/natster.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,15 @@ func main() {
UnNegatableBoolVar(&HubOpts.AllowAll)
hub_up.Action(StartCatalogServer)

auth := ncli.Command("auth", "Authenticate your local context for use with natster.io")
auth := ncli.Command("auth", "Authenticate your local context for use with natster.io").Hidden()
weblogin := auth.Command("web", "Authenticate with one time code")
weblogin.Flag("qrcode", "Displays QR code in terminal of login link").Default("false").UnNegatableBoolVar(&WebLoginOpts.DisplayQR)
weblogin.Flag("qrcode", "Displays a QR code as well as the URL").Default("false").UnNegatableBoolVar(&WebLoginOpts.DisplayQR)
weblogin.Action(WebLogin)

login := ncli.Command("login", "Authenticate your local context for use with natster.io")
login.Flag("qrcode", "Displays a QR code as well as the URL").Default("false").UnNegatableBoolVar(&WebLoginOpts.DisplayQR)
login.Action(WebLogin)

claim := ncli.Command("claim", "Claims an OTC code. For testing only - Can only be done from the natster.io account").Hidden()
claim.Arg("code", "Previously generated one-time code").Required().StringVar(&ClaimOpts.Code)
claim.Arg("identity", "OAuth identity string").Required().StringVar(&ClaimOpts.OAuthIdentity)
Expand Down
1 change: 1 addition & 0 deletions natster/weblogin.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func WebLogin(ctx *fisk.ParseContext) error {
)

if WebLoginOpts.DisplayQR {
fmt.Printf("\n\nAlternatively, you can scan this QR code to claim your login code\n")
qrterminal.Generate(response.ClaimUrl, qrterminal.L, os.Stdout)
} else {
switch runtime.GOOS {
Expand Down
Loading