wip: moving things around to logically group them

This commit is contained in:
2026-05-12 21:05:03 -06:00
parent a7eaa45869
commit 66fc781260
3 changed files with 34 additions and 4 deletions
+5 -2
View File
@@ -22,11 +22,14 @@ var rootCmd = &cobra.Command{
var listCmd = &cobra.Command{ var listCmd = &cobra.Command{
Use: "list [directory]", Use: "list [directory]",
Short: "List the contents of a directory", Short: "List the contents of a directory",
Long: "List the contents of a directory. Only shows one level deep.",
Args: cobra.MaximumNArgs(1), Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
name := "world"
fmt.Printf("Hello, %s!\n", name) fileStorePath := os.Getenv("STORAGE_PATH")
resolveFileStorePath(fileStorePath)
readFilesFromFileStorePath(fileStorePath)
return nil return nil
}, },
} }
+6 -2
View File
@@ -8,6 +8,8 @@ import (
"path/filepath" "path/filepath"
"time" "time"
"drogobox.com/drogobox/cmd"
"github.com/joho/godotenv" "github.com/joho/godotenv"
) )
@@ -103,7 +105,7 @@ func main() {
log.Fatal("Error loading .env file") log.Fatal("Error loading .env file")
} }
port := os.Getenv("PORT") /*port := os.Getenv("PORT")
fileStorePath := os.Getenv("STORAGE_PATH") fileStorePath := os.Getenv("STORAGE_PATH")
@@ -112,5 +114,7 @@ func main() {
fmt.Printf("in the future I will listen on port: %s\n", port) fmt.Printf("in the future I will listen on port: %s\n", port)
fmt.Printf("Reading files from: %s\n", fileStorePath) fmt.Printf("Reading files from: %s\n", fileStorePath)
readFilesFromFileStorePath(fileStorePath) readFilesFromFileStorePath(fileStorePath)*/
cmd.Execute()
} }
+23
View File
@@ -0,0 +1,23 @@
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var listCmd = &cobra.Command{
Use: "list [directory]",
Short: "List the contents of a directory",
Long: "List the contents of a directory. Only shows one level deep.",
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
fileStorePath := os.Getenv("STORAGE_PATH")
resolveFileStorePath(fileStorePath)
readFilesFromFileStorePath(fileStorePath)
return nil
},
}