wip: a list command
This commit is contained in:
+14
-2
@@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "drogobox",
|
Use: "drogobox",
|
||||||
Short: "DroGoBox is just a dumb project",
|
Short: "DroGoBox is just a dumb project",
|
||||||
Long: `DroGoBox is just a dumb project
|
Long: `DroGoBox is just a dumb project
|
||||||
an alternative to Nextcloud written with Go
|
an alternative to Nextcloud written with Go
|
||||||
@@ -19,6 +19,18 @@ var rootCmd = &cobra.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var listCmd = &cobra.Command{
|
||||||
|
Use: "list [directory]",
|
||||||
|
Short: "List the contents of a directory",
|
||||||
|
Args: cobra.MaximumNArgs(1),
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
name := "world"
|
||||||
|
|
||||||
|
fmt.Printf("Hello, %s!\n", name)
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
func Execute() {
|
func Execute() {
|
||||||
if err := rootCmd.Execute(); err != nil {
|
if err := rootCmd.Execute(); err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
@@ -27,5 +39,5 @@ func Execute() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
//
|
rootCmd.AddCommand(listCmd)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user