wip: moving things around to logically group them
This commit is contained in:
+5
-2
@@ -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"
|
|
||||||
|
fileStorePath := os.Getenv("STORAGE_PATH")
|
||||||
|
resolveFileStorePath(fileStorePath)
|
||||||
|
readFilesFromFileStorePath(fileStorePath)
|
||||||
|
|
||||||
fmt.Printf("Hello, %s!\n", name)
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
},
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user