Created new Golang program
This commit is contained in:
24
cmd/root.go
Normal file
24
cmd/root.go
Normal file
@ -0,0 +1,24 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "muldap",
|
||||
Short: "muldap is Metaunix.net's LDAP management tool",
|
||||
Long: "LDAP management tool for Metaunix.net user and group resources.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("Metaunix.net LDAP tool - available commands are: version")
|
||||
},
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
20
cmd/version.go
Normal file
20
cmd/version.go
Normal file
@ -0,0 +1,20 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
}
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the version number of muldap",
|
||||
Long: `All software has versions. This is muldap's`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("Metaunix.net LDAP tool v0.1.0")
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user