2023-03-08 08:05:13 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-03-08 13:40:04 +00:00
|
|
|
"context"
|
2023-03-08 08:05:13 +00:00
|
|
|
"log"
|
|
|
|
"os"
|
2023-03-08 13:40:04 +00:00
|
|
|
"os/signal"
|
2023-03-08 08:05:13 +00:00
|
|
|
|
2023-03-08 13:40:04 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
|
|
|
"code.icb4dc0.de/prskr/nitter/internal/commands"
|
|
|
|
)
|
|
|
|
|
2023-03-08 15:13:49 +00:00
|
|
|
var root = &cobra.Command{
|
|
|
|
Use: "nitter",
|
|
|
|
TraverseChildren: true,
|
|
|
|
}
|
2023-03-08 08:05:13 +00:00
|
|
|
|
|
|
|
func main() {
|
2023-03-08 13:40:04 +00:00
|
|
|
root.PersistentFlags().StringP("namespace", "n", "", "Namespace a.k.a. organization/owner/group of the repository [$NITTER_NAMESPACE]")
|
|
|
|
root.PersistentFlags().StringP("repo", "r", "", "Repo to interact with [$NITTER_REPO]")
|
|
|
|
|
|
|
|
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
root.AddCommand(commands.Gitea())
|
2023-03-08 08:05:13 +00:00
|
|
|
|
2023-03-08 13:40:04 +00:00
|
|
|
if err := root.ExecuteContext(ctx); err != nil {
|
2023-03-08 08:05:13 +00:00
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|