Files
asciinema/main.go

49 lines
1.1 KiB
Go
Raw Normal View History

2014-08-02 22:27:17 +02:00
package main
import (
2014-08-09 23:39:23 +02:00
"fmt"
2014-08-02 22:27:17 +02:00
"os"
2014-11-12 20:54:50 +01:00
"github.com/asciinema/asciinema-cli/api"
2014-08-02 22:27:17 +02:00
"github.com/asciinema/asciinema-cli/cli"
"github.com/asciinema/asciinema-cli/commands"
"github.com/asciinema/asciinema-cli/util"
)
func main() {
2014-11-12 20:58:14 +01:00
cfg, err := util.LoadConfig()
2014-11-12 20:54:50 +01:00
if err != nil {
fmt.Println(err)
os.Exit(1)
}
2014-08-09 23:39:23 +02:00
2014-11-15 13:33:20 +01:00
api := api.New(cfg.API.URL, cfg.API.Token, Version)
2014-11-12 20:54:50 +01:00
cli := &cli.CLI{
Commands: map[string]cli.Command{
"rec": commands.NewRecordCommand(api, cfg),
"auth": commands.NewAuthCommand(cfg),
"version": commands.NewVersionCommand(Version, GitCommit),
},
HelpFunc: help,
}
2014-11-12 20:54:50 +01:00
os.Exit(cli.Run(os.Args[1:]))
2014-08-09 23:39:23 +02:00
}
func help() {
2014-12-17 11:40:17 +01:00
fmt.Println(`usage: asciinema [-h] [-v] <command> [command-options]
2014-08-09 23:39:23 +02:00
2014-12-15 18:05:28 +01:00
Record and share your terminal sessions, the right way.
2014-08-09 23:39:23 +02:00
Commands:
2014-12-17 15:37:12 +01:00
rec Record terminal session
2014-12-17 11:40:17 +01:00
auth Assign local API token to asciinema.org account
2014-08-09 23:39:23 +02:00
2014-12-17 11:40:17 +01:00
Options:
-h, --help Display help message
-v, --version Display version information
Run "asciinema <command> -h" to see the options available for the given command.`)
2014-08-09 23:39:23 +02:00
}