Skip to content

Commit 796c30f

Browse files
committed
WIP
0 parents  commit 796c30f

File tree

9 files changed

+253
-0
lines changed

9 files changed

+253
-0
lines changed

cmd/ip.go

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
// ipCmd represents the ip command
10+
var ipCmd = &cobra.Command{
11+
Use: "ip",
12+
Short: "A brief description of your command",
13+
Long: `A longer description that spans multiple lines and likely contains examples
14+
and usage of using your command. For example:
15+
16+
Cobra is a CLI library for Go that empowers applications.
17+
This application is a tool to generate the needed files
18+
to quickly create a Cobra application.`,
19+
Run: func(cmd *cobra.Command, args []string) {
20+
fmt.Println("ip called")
21+
},
22+
}
23+
24+
func init() {
25+
rootCmd.AddCommand(ipCmd)
26+
27+
// Here you will define your flags and configuration settings.
28+
29+
// Cobra supports Persistent Flags which will work for this command
30+
// and all subcommands, e.g.:
31+
// ipCmd.PersistentFlags().String("foo", "", "A help for foo")
32+
33+
// Cobra supports local flags which will only run when this command
34+
// is called directly, e.g.:
35+
// ipCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
36+
}

cmd/launch.go

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
// launchCmd represents the launch command
10+
var launchCmd = &cobra.Command{
11+
Use: "launch",
12+
Short: "A brief description of your command",
13+
Long: `A longer description that spans multiple lines and likely contains examples
14+
and usage of using your command. For example:
15+
16+
Cobra is a CLI library for Go that empowers applications.
17+
This application is a tool to generate the needed files
18+
to quickly create a Cobra application.`,
19+
Run: func(cmd *cobra.Command, args []string) {
20+
fmt.Println("launch called")
21+
},
22+
}
23+
24+
func init() {
25+
rootCmd.AddCommand(launchCmd)
26+
27+
// Here you will define your flags and configuration settings.
28+
29+
// Cobra supports Persistent Flags which will work for this command
30+
// and all subcommands, e.g.:
31+
// launchCmd.PersistentFlags().String("foo", "", "A help for foo")
32+
33+
// Cobra supports local flags which will only run when this command
34+
// is called directly, e.g.:
35+
// launchCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
36+
}

cmd/provision.go

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
// provisionCmd represents the provision command
10+
var provisionCmd = &cobra.Command{
11+
Use: "provision",
12+
Short: "Provision a new VM image",
13+
Long: `Provision a new VM image based on A longer description that spans multiple lines and likely contains examples
14+
and usage of using your command. For example:
15+
16+
Cobra is a CLI library for Go that empowers applications.
17+
This application is a tool to generate the needed files
18+
to quickly create a Cobra application.`,
19+
RunE: func(cmd *cobra.Command, args []string) error {
20+
name, err := cmd.Flags().GetString("name")
21+
if err != nil {
22+
return err
23+
}
24+
25+
fmt.Printf("provision called for %s", name)
26+
return nil
27+
},
28+
}
29+
30+
func init() {
31+
provisionCmd.Flags().StringP("name", "n", "", "VM image name")
32+
rootCmd.AddCommand(provisionCmd)
33+
}

cmd/root.go

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/spf13/cobra"
8+
)
9+
10+
// rootCmd represents the base command when called without any subcommands
11+
var rootCmd = &cobra.Command{
12+
Use: "virgo",
13+
Short: "A brief description of your application",
14+
Long: `A longer description that spans multiple lines and likely contains
15+
examples and usage of using your application. For example:
16+
17+
Cobra is a CLI library for Go that empowers applications.
18+
This application is a tool to generate the needed files
19+
to quickly create a Cobra application.`,
20+
// Uncomment the following line if your bare application
21+
// has an action associated with it:
22+
// Run: func(cmd *cobra.Command, args []string) { },
23+
}
24+
25+
// Execute adds all child commands to the root command and sets flags appropriately.
26+
// This is called by main.main(). It only needs to happen once to the rootCmd.
27+
func Execute() {
28+
if err := rootCmd.Execute(); err != nil {
29+
fmt.Println(err)
30+
os.Exit(1)
31+
}
32+
}

cmd/ssh.go

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
// sshCmd represents the ssh command
10+
var sshCmd = &cobra.Command{
11+
Use: "ssh",
12+
Short: "A brief description of your command",
13+
Long: `A longer description that spans multiple lines and likely contains examples
14+
and usage of using your command. For example:
15+
16+
Cobra is a CLI library for Go that empowers applications.
17+
This application is a tool to generate the needed files
18+
to quickly create a Cobra application.`,
19+
Run: func(cmd *cobra.Command, args []string) {
20+
fmt.Println("ssh called")
21+
},
22+
}
23+
24+
func init() {
25+
rootCmd.AddCommand(sshCmd)
26+
27+
// Here you will define your flags and configuration settings.
28+
29+
// Cobra supports Persistent Flags which will work for this command
30+
// and all subcommands, e.g.:
31+
// sshCmd.PersistentFlags().String("foo", "", "A help for foo")
32+
33+
// Cobra supports local flags which will only run when this command
34+
// is called directly, e.g.:
35+
// sshCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
36+
}

cmd/undefine.go

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
// undefineCmd represents the undefine command
10+
var undefineCmd = &cobra.Command{
11+
Use: "undefine",
12+
Short: "A brief description of your command",
13+
Long: `A longer description that spans multiple lines and likely contains examples
14+
and usage of using your command. For example:
15+
16+
Cobra is a CLI library for Go that empowers applications.
17+
This application is a tool to generate the needed files
18+
to quickly create a Cobra application.`,
19+
Run: func(cmd *cobra.Command, args []string) {
20+
fmt.Println("undefine called")
21+
},
22+
}
23+
24+
func init() {
25+
rootCmd.AddCommand(undefineCmd)
26+
27+
// Here you will define your flags and configuration settings.
28+
29+
// Cobra supports Persistent Flags which will work for this command
30+
// and all subcommands, e.g.:
31+
// undefineCmd.PersistentFlags().String("foo", "", "A help for foo")
32+
33+
// Cobra supports local flags which will only run when this command
34+
// is called directly, e.g.:
35+
// undefineCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
36+
}

cmd/unprovision.go

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
// unprovisionCmd represents the unprovision command
10+
var unprovisionCmd = &cobra.Command{
11+
Use: "unprovision",
12+
Short: "A brief description of your command",
13+
Long: `A longer description that spans multiple lines and likely contains examples
14+
and usage of using your command. For example:
15+
16+
Cobra is a CLI library for Go that empowers applications.
17+
This application is a tool to generate the needed files
18+
to quickly create a Cobra application.`,
19+
Run: func(cmd *cobra.Command, args []string) {
20+
fmt.Println("unprovision called")
21+
},
22+
}
23+
24+
func init() {
25+
rootCmd.AddCommand(unprovisionCmd)
26+
27+
// Here you will define your flags and configuration settings.
28+
29+
// Cobra supports Persistent Flags which will work for this command
30+
// and all subcommands, e.g.:
31+
// unprovisionCmd.PersistentFlags().String("foo", "", "A help for foo")
32+
33+
// Cobra supports local flags which will only run when this command
34+
// is called directly, e.g.:
35+
// unprovisionCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
36+
}

main.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "github.com/anastop/virgo/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}

pkg/virgo/virgo.go

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package virgo

0 commit comments

Comments
 (0)