Skip to content

Commit

Permalink
Adding version command.
Browse files Browse the repository at this point in the history
  • Loading branch information
Macmod committed Feb 27, 2024
1 parent e576152 commit ae4c317
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,11 @@ func setupApp() {
}

func main() {
godapVer := "Godap v2.1.0"

rootCmd := &cobra.Command{
Use: "godap",
Short: "A complete TUI for LDAP written in Golang.",
Use: "godap <server address>",
Short: "A complete TUI for LDAP.",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
ldapServer = args[0]
Expand Down Expand Up @@ -452,6 +454,17 @@ func main() {
rootCmd.Flags().BoolVarP(&ldaps, "ldaps", "S", false, "Use LDAPS for initial connection")
rootCmd.Flags().StringVarP(&socksServer, "socks", "x", "", "Use a SOCKS proxy for initial connection")

versionCmd := &cobra.Command{
Use: "version",
Short: "Print the version number of the application",
DisableFlagsInUseLine: true,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(godapVer)
},
}

rootCmd.AddCommand(versionCmd)

if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
}
Expand Down

0 comments on commit ae4c317

Please sign in to comment.