mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 11:48:13 +01:00
Add auth command
This commit is contained in:
28
commands/auth.go
Normal file
28
commands/auth.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"github.com/asciinema/asciinema-cli/cli"
|
||||
"github.com/asciinema/asciinema-cli/util"
|
||||
)
|
||||
|
||||
func Auth(flags *flag.FlagSet, cfg *util.Config) cli.Command {
|
||||
return &AuthCommand{
|
||||
apiUrl: cfg.Api.Url,
|
||||
apiToken: cfg.Api.Token,
|
||||
}
|
||||
}
|
||||
|
||||
type AuthCommand struct {
|
||||
apiUrl string
|
||||
apiToken string
|
||||
}
|
||||
|
||||
func (c *AuthCommand) Execute(args []string) error {
|
||||
fmt.Println("Open the following URL in your browser to register your API token and assign any recorded asciicasts to your profile:")
|
||||
fmt.Printf("%v/connect/%v\n", c.apiUrl, c.apiToken)
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user