Use docopt for command arg parsing

This commit is contained in:
Marcin Kulik
2015-03-03 16:13:33 +01:00
parent f38e9bd07a
commit db0a8fd0d6
36 changed files with 4671 additions and 321 deletions

View File

@@ -1,10 +1,8 @@
package commands
import (
"flag"
"fmt"
"github.com/asciinema/asciinema-cli/cli"
"github.com/asciinema/asciinema-cli/util"
)
@@ -13,17 +11,14 @@ type AuthCommand struct {
apiToken string
}
func NewAuthCommand(cfg *util.Config) cli.Command {
func NewAuthCommand(cfg *util.Config) *AuthCommand {
return &AuthCommand{
apiURL: cfg.API.URL,
apiToken: cfg.API.Token,
}
}
func (c *AuthCommand) RegisterFlags(flags *flag.FlagSet) {
}
func (c *AuthCommand) Execute(args []string) error {
func (c *AuthCommand) Execute() 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)