🌷 the cutsie hackatime helper
1package main
2
3import (
4 "context"
5 "os"
6
7 "github.com/charmbracelet/fang"
8 "github.com/spf13/cobra"
9 "github.com/taciturnaxolotl/akami/handler"
10)
11
12func main() {
13 // init our cobra command with a name and description
14 cmd := &cobra.Command{
15 Use: "akami",
16 Short: "🌷 the cutsie hackatime helper",
17 Long: `
18 █████╗ ██╗ ██╗ █████╗ ███╗ ███╗██╗
19██╔══██╗██║ ██╔╝██╔══██╗████╗ ████║██║
20███████║█████╔╝ ███████║██╔████╔██║██║
21██╔══██║██╔═██╗ ██╔══██║██║╚██╔╝██║██║
22██║ ██║██║ ██╗██║ ██║██║ ╚═╝ ██║██║
23╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
24
25🌷 Akami — The cutsie hackatime helper`,
26 }
27
28 // diagnose command
29 cmd.AddCommand(&cobra.Command{
30 Use: "doc",
31 Short: "diagnose potential hackatime issues",
32 RunE: handler.Doctor,
33 Args: cobra.NoArgs,
34 })
35
36 cmd.AddCommand(&cobra.Command{
37 Use: "test",
38 Short: "send a test heartbeat to hackatime or whatever api url you provide",
39 RunE: handler.TestHeartbeat,
40 Args: cobra.NoArgs,
41 })
42
43 cmd.AddCommand(&cobra.Command{
44 Use: "status",
45 Short: "get your hackatime stats",
46 RunE: handler.Status,
47 Args: cobra.NoArgs,
48 })
49
50 cmd.PersistentFlags().StringP("url", "u", "", "The base url for the hackatime client")
51 cmd.PersistentFlags().StringP("key", "k", "", "API key to use for authentication")
52
53 // this is where we get the fancy fang magic ✨
54 if err := fang.Execute(
55 context.Background(),
56 cmd,
57 ); err != nil {
58 os.Exit(1)
59 }
60}