From 03b57e3f9f40946a7cf8683507d433a677ac6ace Mon Sep 17 00:00:00 2001 From: kiki Date: Mon, 15 Apr 2024 22:03:43 +0200 Subject: [PATCH] add some commands Chat under construction still --- LICENSE | 0 cmd/chat.go | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++ cmd/env.go | 75 +++++++++++++++++++++++ cmd/rename.go | 66 ++++++++++++++++++++ cmd/resize.go | 76 +++++++++++++++++++++++ cmd/root.go | 77 +++++++++++++++++++++++ cmd/server.go | 55 +++++++++++++++++ go.mod | 40 ++++++++++++ go.sum | 92 +++++++++++++++++++++++++++ main.go | 11 ++++ 10 files changed, 659 insertions(+) create mode 100644 LICENSE create mode 100644 cmd/chat.go create mode 100644 cmd/env.go create mode 100644 cmd/rename.go create mode 100644 cmd/resize.go create mode 100644 cmd/root.go create mode 100644 cmd/server.go create mode 100644 go.sum create mode 100644 main.go diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e69de29 diff --git a/cmd/chat.go b/cmd/chat.go new file mode 100644 index 0000000..a2c767f --- /dev/null +++ b/cmd/chat.go @@ -0,0 +1,167 @@ +package cmd + +import ( + "bufio" + "fmt" + "log" + "net" + "os" + "sync" + + "github.com/spf13/cobra" +) + +var ( + nickname string + clients []*client + mu sync.Mutex +) + +type client struct { + conn net.Conn + nickname string +} + +// chatCmd represents the chat command +var chatCmd = &cobra.Command{ + Use: "chat", + Short: "Start a chat server or connect to other peers", + Long: `Start a chat server or connect to other peers. +If no arguments are provided, it starts a chat server. +If an address is provided, it connects to the specified chat server. +You can specify your nickname using the --nickname (-n) flag.`, + Args: cobra.MaximumNArgs(1), + Run: func(cmd *cobra.Command, args []string) { + if len(args) == 0 { + startChatServer() + } else { + address := args[0] + startChatClient(address) + } + }, +} + +func init() { + rootCmd.AddCommand(chatCmd) + chatCmd.Flags().StringVarP(&nickname, "nickname", "n", "", "Nickname for the user") +} + +func startChatServer() { + listener, err := net.Listen("tcp", "localhost:8080") + if err != nil { + log.Fatalf("Failed to start chat server: %v", err) + } + defer listener.Close() + fmt.Println("Chat server started. Listening on localhost:8080") + + // Start a goroutine to handle server input + go func() { + scanner := bufio.NewScanner(os.Stdin) + for scanner.Scan() { + msg := scanner.Text() + broadcastMessage(nil, "Server: "+msg+"\n") + } + if err := scanner.Err(); err != nil { + log.Fatalf("Error reading server input: %v", err) + } + }() + + for { + conn, err := listener.Accept() + if err != nil { + log.Printf("Failed to accept connection: %v", err) + continue + } + go handleClient(conn) + } +} + +func handleClient(conn net.Conn) { + defer conn.Close() + + reader := bufio.NewReader(conn) + + nickname, err := reader.ReadString('\n') + if err != nil { + log.Printf("Error reading nickname: %v", err) + return + } + + fmt.Printf("New connection from %s with nickname: %s", conn.RemoteAddr().String(), nickname) + + for { + message, err := reader.ReadString('\n') + if err != nil { + log.Printf("Error reading message: %v", err) + return + } + + fmt.Printf("[%s]: %s", nickname, message) + broadcastMessage(nil, fmt.Sprintf("[%s]: %s", nickname, message)) + } +} + +func removeClient(c *client) { + for i, cl := range clients { + if cl == c { + clients = append(clients[:i], clients[i+1:]...) + return + } + } +} + +func broadcastMessage(sender *client, message string) { + mu.Lock() + defer mu.Unlock() + + for _, cl := range clients { + if cl != sender { + _, err := cl.conn.Write([]byte(message)) + if err != nil { + log.Printf("Error broadcasting message: %v", err) + } + } + } +} + +func startChatClient(address string) { + conn, err := net.Dial("tcp", address) + if err != nil { + log.Fatalf("Failed to connect to chat server: %v", err) + } + defer conn.Close() + + fmt.Print("Enter your nickname: ") + scanner := bufio.NewScanner(os.Stdin) + if !scanner.Scan() { + log.Fatal("Failed to read nickname from stdin") + } + nickname := scanner.Text() + ": " + + // Send nickname to server + if _, err := fmt.Fprintf(conn, "%s\n", nickname); err != nil { + log.Fatalf("Failed to send nickname to server: %v", err) + } + + go func() { + reader := bufio.NewReader(conn) + for { + message, err := reader.ReadString('\n') + if err != nil { + log.Printf("Error reading message: %v", err) + return + } + fmt.Print(message) + } + }() + + for scanner.Scan() { + msg := scanner.Text() + if _, err := fmt.Fprintf(conn, "%s\n", msg); err != nil { + log.Fatalf("Failed to send message to server: %v", err) + } + } + if err := scanner.Err(); err != nil { + log.Fatalf("Error reading standard input: %v", err) + } +} diff --git a/cmd/env.go b/cmd/env.go new file mode 100644 index 0000000..dca0b1a --- /dev/null +++ b/cmd/env.go @@ -0,0 +1,75 @@ +package cmd + +import ( + "fmt" + "log" + "os" + "strings" + + "github.com/spf13/cobra" +) + +// envCmd represents the env command +var envCmd = &cobra.Command{ + Use: "env [action] [key] [value]", + Short: "Manage environment variables", + Long: `Manage environment variables. +Actions: +- list: List all environment variables. +- set: Set an environment variable. +- unset: Unset an environment variable.`, + Args: cobra.RangeArgs(1, 3), + Run: func(cmd *cobra.Command, args []string) { + action := args[0] + switch action { + case "list": + listEnvVariables() + case "set": + if len(args) != 3 { + fmt.Println("Usage: dttt env set [key] [value]") + return + } + key := args[1] + value := args[2] + setEnvVariable(key, value) + case "unset": + if len(args) != 2 { + fmt.Println("Usage: dttt env unset [key]") + return + } + key := args[1] + unsetEnvVariable(key) + default: + fmt.Println("Invalid action. Available actions: list, set, unset") + } + }, +} + +func init() { + rootCmd.AddCommand(envCmd) +} + +func listEnvVariables() { + fmt.Println("Environment variables:") + for _, env := range os.Environ() { + pair := strings.SplitN(env, "=", 2) + fmt.Printf("%s=%s\n", pair[0], pair[1]) + } +} + +func setEnvVariable(key, value string) { + err := os.Setenv(key, value) + if err != nil { + log.Fatalf("Error setting environment variable: %v", err) + } + fmt.Printf("Environment variable %s set to %s\n", key, value) +} + +func unsetEnvVariable(key string) { + err := os.Unsetenv(key) + if err != nil { + log.Fatalf("Error unsetting environment variable: %v", err) + } + fmt.Printf("Environment variable %s unset\n", key) +} + diff --git a/cmd/rename.go b/cmd/rename.go new file mode 100644 index 0000000..e2c96ed --- /dev/null +++ b/cmd/rename.go @@ -0,0 +1,66 @@ +package cmd + +import ( + "fmt" + "os" + "strings" + + "github.com/spf13/cobra" +) + +// renameCmd represents the rename command +var renameCmd = &cobra.Command{ + Use: "rename", + Short: "Rename files in bulk based on specified patterns", + Long: `Rename files in bulk based on specified patterns. + Example usage: dttt rename --pattern "prefix_###.jpg" --start 1 --directory ./images`, + Run: func(cmd *cobra.Command, args []string) { + // Handle command logic here + directory, _ := cmd.Flags().GetString("directory") + pattern, _ := cmd.Flags().GetString("pattern") + start, _ := cmd.Flags().GetInt("start") + + // Check if required flags are provided + if directory == "" || pattern == "" { + cmd.Help() + return + } + + // Implement the renaming logic + renameFiles(directory, pattern, start) + }, +} + +func init() { + rootCmd.AddCommand(renameCmd) + + // Define flags and configuration settings for the command + renameCmd.Flags().StringP("directory", "d", ".", "Directory containing the files to rename") + renameCmd.Flags().StringP("pattern", "p", "", "Pattern for renaming files. Use '###' as a placeholder for numeric sequence.") + renameCmd.Flags().IntP("start", "s", 1, "Start index for numeric sequence in the renaming pattern") +} + +// Function to rename files in bulk based on the specified pattern +func renameFiles(directory, pattern string, start int) { + // List files in the specified directory + files, err := os.ReadDir(directory) + if err != nil { + fmt.Println("Error:", err) + return + } + + // Iterate through each file in the directory + for i, file := range files { + // Generate the new filename based on the pattern + newName := strings.Replace(pattern, "###", fmt.Sprintf("%d", start+i), 1) + + // Rename the file + err := os.Rename(file.Name(), newName) + if err != nil { + fmt.Println("Error renaming file:", err) + continue + } + fmt.Printf("Renamed %s to %s\n", file.Name(), newName) + } +} + diff --git a/cmd/resize.go b/cmd/resize.go new file mode 100644 index 0000000..b847fe4 --- /dev/null +++ b/cmd/resize.go @@ -0,0 +1,76 @@ +package cmd + +import ( + "fmt" + "image" + "image/jpeg" + "log" + "os" + "strconv" + + "github.com/nfnt/resize" + "github.com/spf13/cobra" +) + +// resizeCmd represents the resize command +var resizeCmd = &cobra.Command{ + Use: "resize [input_file] [output_file] [width]", + Short: "Resize an image to the specified width", + Long: `Resize an image to the specified width using Lanczos3 interpolation. + Example: dttt resize input.jpg output.jpg 300`, + Args: cobra.ExactArgs(3), + Run: func(cmd *cobra.Command, args []string) { + if len(args) == 0 { + cmd.Help() + return + } + + inputFile := args[0] + outputFile := args[1] + widthStr := args[2] + + width, err := strconv.Atoi(widthStr) + if err != nil { + log.Fatal("Invalid width:", err) + } + + resizeImage(inputFile, outputFile, width) + }, +} + +func init() { + rootCmd.AddCommand(resizeCmd) +} + +func resizeImage(inputFile, outputFile string, width int) { + // Open the input image file + input, err := os.Open(inputFile) + if err != nil { + log.Fatal("Error opening input file:", err) + } + defer input.Close() + + // Decode the input image file + img, _, err := image.Decode(input) + if err != nil { + log.Fatal("Error decoding input image:", err) + } + + // Resize the image to the target width + resizedImg := resize.Resize(uint(width), 0, img, resize.Lanczos3) + + // Create the output image file + output, err := os.Create(outputFile) + if err != nil { + log.Fatal("Error creating output file:", err) + } + defer output.Close() + + // Write the resized image to the output file + if err := jpeg.Encode(output, resizedImg, nil); err != nil { + log.Fatal("Error encoding resized image:", err) + } + + fmt.Println("Image resized successfully!") +} + diff --git a/cmd/root.go b/cmd/root.go new file mode 100644 index 0000000..730a455 --- /dev/null +++ b/cmd/root.go @@ -0,0 +1,77 @@ +/* +Copyright © 2024 NAME HERE + +*/ +package cmd + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var cfgFile string + +// rootCmd represents the base command when called without any subcommands +var rootCmd = &cobra.Command{ + Use: "dttt", + Short: "A brief description of your application", + Long: `A longer description that spans multiple lines and likely contains +examples and usage of using your application. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + // Uncomment the following line if your bare application + // has an action associated with it: + // Run: func(cmd *cobra.Command, args []string) { }, +} + +// Execute adds all child commands to the root command and sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute() { + err := rootCmd.Execute() + if err != nil { + os.Exit(1) + } +} + +func init() { + cobra.OnInitialize(initConfig) + + // Here you will define your flags and configuration settings. + // Cobra supports persistent flags, which, if defined here, + // will be global for your application. + + rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.dttt.yaml)") + + // Cobra also supports local flags, which will only run + // when this action is called directly. + rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} + +// initConfig reads in config file and ENV variables if set. +func initConfig() { + if cfgFile != "" { + // Use config file from the flag. + viper.SetConfigFile(cfgFile) + } else { + // Find home directory. + home, err := os.UserHomeDir() + cobra.CheckErr(err) + + // Search config in home directory with name ".dttt" (without extension). + viper.AddConfigPath(home) + viper.SetConfigType("yaml") + viper.SetConfigName(".dttt") + } + + viper.AutomaticEnv() // read in environment variables that match + + // If a config file is found, read it in. + if err := viper.ReadInConfig(); err == nil { + fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed()) + } +} diff --git a/cmd/server.go b/cmd/server.go new file mode 100644 index 0000000..3635a19 --- /dev/null +++ b/cmd/server.go @@ -0,0 +1,55 @@ +package cmd + +import ( + "fmt" + "log" + "net/http" + "os" + "path/filepath" + + "github.com/spf13/cobra" +) + +// serverCmd represents the server command +var serverCmd = &cobra.Command{ + Use: "server [directory]", + Short: "Start a simple HTTP server to serve files from the specified directory", + Long: `Start a simple HTTP server to serve files from the specified directory. +If no directory is provided, the current directory is used by default. + +You can specify the port number using the --port (-p) flag. If not provided, the default port is 8080.`, + Args: cobra.MaximumNArgs(1), + Run: func(cmd *cobra.Command, args []string) { + var directory string + if len(args) == 1 { + directory = args[0] + } else { + directory, _ = os.Getwd() + } + + directory, err := filepath.Abs(directory) + if err != nil { + log.Fatalf("Error getting absolute path: %v", err) + } + + port, err := cmd.Flags().GetInt("port") + if err != nil { + log.Fatalf("Error getting port number: %v", err) + } + + addr := fmt.Sprintf(":%d", port) + + fmt.Printf("Starting HTTP server for directory: %s\n", directory) + http.Handle("/", http.FileServer(http.Dir(directory))) + fmt.Printf("Server listening on %s\n", addr) + if err := http.ListenAndServe(addr, nil); err != nil { + log.Fatalf("Error starting HTTP server: %v", err) + } + }, +} + +func init() { + rootCmd.AddCommand(serverCmd) + serverCmd.Flags().IntP("port", "p", 8080, "Port number for the HTTP server") +} + diff --git a/go.mod b/go.mod index 654c20f..7c11908 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,43 @@ module git.bits.studio/public/dttt go 1.22.1 + +require ( + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/charmbracelet/bubbletea v0.25.0 // indirect + github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mattn/go-isatty v0.0.18 // indirect + github.com/mattn/go-localereader v0.0.1 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect + github.com/muesli/cancelreader v0.2.2 // indirect + github.com/muesli/reflow v0.3.0 // indirect + github.com/muesli/termenv v0.15.2 // indirect + github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect + github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/cobra v1.8.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.18.2 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.6.0 // indirect + golang.org/x/text v0.14.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..f8c6a62 --- /dev/null +++ b/go.sum @@ -0,0 +1,92 @@ +github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= +github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= +github.com/charmbracelet/bubbletea v0.25.0 h1:bAfwk7jRz7FKFl9RzlIULPkStffg5k6pNt5dywy4TcM= +github.com/charmbracelet/bubbletea v0.25.0/go.mod h1:EN3QDR1T5ZdWmdfDzYcqOCAps45+QIJbLOBxmVNWNNg= +github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY= +github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= +github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= +github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= +github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= +github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= +github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= +github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34= +github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho= +github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= +github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= +github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= +github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= +github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= +github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= +github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= +github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= +github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= +github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go new file mode 100644 index 0000000..3cf97d2 --- /dev/null +++ b/main.go @@ -0,0 +1,11 @@ +/* +Copyright © 2024 NAME HERE + +*/ +package main + +import "git.bits.studio/public/dttt/cmd" + +func main() { + cmd.Execute() +}