Skip to content

Commit

Permalink
test using cli
Browse files Browse the repository at this point in the history
  • Loading branch information
somnek committed Apr 2, 2023
1 parent befa777 commit 71d1f76
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,33 @@ func main() {
Short: "A Docker cli",
}

var ctnCmd = &cobra.Command{
var listCmd = &cobra.Command{
Use: "container",
Short: "List all containers",
Run: func(cmd *cobra.Command, args []string) {
listContainers(client)
},
}

var xCmd = &cobra.Command{
Use: "x",
Short: "...",
Run: func(cmd *cobra.Command, args []string) {
id := "d1f02035c4a1366b01f21d078be53a09d3899669152b541a8203aef297e7646c"
stopContainer(client, id)
removeContainer(client, id)
},
}

var stopCmd = &cobra.Command{
Use: "stop",
Short: "...",
Run: func(cmd *cobra.Command, args []string) {
listContainers(client)

},
}

var imgCmd = &cobra.Command{
Use: "image",
Short: "List all images",
Expand All @@ -35,6 +54,6 @@ func main() {
},
}

rootCmd.AddCommand(ctnCmd, imgCmd)
rootCmd.AddCommand(listCmd, stopCmd, imgCmd, xCmd)
rootCmd.Execute()
}

0 comments on commit 71d1f76

Please sign in to comment.