Skip to content

Commit b2ad1dc

Browse files
committed
added in additional subcommands
1 parent 8600784 commit b2ad1dc

File tree

5 files changed

+94
-0
lines changed

5 files changed

+94
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.sqlite
2+
cli-cms

cmd/edit.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
Copyright © 2025 Dreams of Code
3+
*/
4+
package cmd
5+
6+
import (
7+
"fmt"
8+
9+
"github.com/spf13/cobra"
10+
)
11+
12+
// editCmd represents the edit command
13+
var editCmd = &cobra.Command{
14+
Use: "edit",
15+
Short: "Used to edit a blog post",
16+
Run: func(cmd *cobra.Command, args []string) {
17+
fmt.Println("edit called")
18+
},
19+
}
20+
21+
func init() {
22+
postsCmd.AddCommand(editCmd)
23+
}

cmd/get.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
Copyright © 2025 Dreams of Code
3+
*/
4+
package cmd
5+
6+
import (
7+
"fmt"
8+
9+
"github.com/spf13/cobra"
10+
)
11+
12+
// getCmd represents the get command
13+
var getCmd = &cobra.Command{
14+
Use: "get",
15+
Short: "Used to get a blog post by it's ID",
16+
Run: func(cmd *cobra.Command, args []string) {
17+
fmt.Println("get called")
18+
},
19+
}
20+
21+
func init() {
22+
postsCmd.AddCommand(getCmd)
23+
}

cmd/list.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
Copyright © 2025 Dreams of Code
3+
*/
4+
package cmd
5+
6+
import (
7+
"fmt"
8+
9+
"github.com/spf13/cobra"
10+
)
11+
12+
// listCmd represents the list command
13+
var listCmd = &cobra.Command{
14+
Use: "list",
15+
Short: "Used to list the blog posts in the system",
16+
Run: func(cmd *cobra.Command, args []string) {
17+
fmt.Println("list called")
18+
},
19+
}
20+
21+
func init() {
22+
postsCmd.AddCommand(listCmd)
23+
}

cmd/remove.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
Copyright © 2025 Dreams of Code
3+
*/
4+
package cmd
5+
6+
import (
7+
"fmt"
8+
9+
"github.com/spf13/cobra"
10+
)
11+
12+
// removeCmd represents the remove command
13+
var removeCmd = &cobra.Command{
14+
Use: "remove",
15+
Short: "Used to remove a blog post by it's ID",
16+
Run: func(cmd *cobra.Command, args []string) {
17+
fmt.Println("remove called")
18+
},
19+
}
20+
21+
func init() {
22+
postsCmd.AddCommand(removeCmd)
23+
}

0 commit comments

Comments
 (0)