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
+6 -2
View File
@@ -8,6 +8,8 @@ import (
"path/filepath"
"time"
"drogobox.com/drogobox/cmd"
"github.com/joho/godotenv"
)
@@ -103,7 +105,7 @@ func main() {
log.Fatal("Error loading .env file")
}
port := os.Getenv("PORT")
/*port := os.Getenv("PORT")
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("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
},
}