🌷 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 })
34
35 cmdTest := &cobra.Command{
36 Use: "test",
37 Short: "send a test heartbeat to hackatime or whatever api url you provide",
38 RunE: handler.TestHeartbeat,
39 Args: cobra.NoArgs,
40 }
41 cmdTest.Flags().StringP("url", "u", "", "The base url for the hackatime client")
42 cmdTest.Flags().StringP("key", "k", "", "API key to use for authentication")
43 cmd.AddCommand(cmdTest)
44
45 // this is where we get the fancy fang magic ✨
46 if err := fang.Execute(
47 context.Background(),
48 cmd,
49 ); err != nil {
50 os.Exit(1)
51 }
52}