Improving command line interface (#4689)

Этот коммит содержится в:
Christopher Speller
2016-12-06 10:49:34 -05:00
коммит произвёл GitHub
родитель dcf11a14d8
Коммит 026553e4f8
130 изменённых файлов: 16375 добавлений и 669 удалений

39
cmd/platform/ldap.go Обычный файл
Просмотреть файл

@@ -0,0 +1,39 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package main
import (
"github.com/mattermost/platform/einterfaces"
"github.com/spf13/cobra"
)
var ldapCmd = &cobra.Command{
Use: "ldap",
Short: "LDAP related utilities",
}
var ldapSyncCmd = &cobra.Command{
Use: "sync",
Short: "Synchronize now",
Long: "Synchronize all LDAP users now.",
Example: " ldap sync",
RunE: ldapSyncCmdF,
}
func init() {
ldapCmd.AddCommand(
ldapSyncCmd,
)
}
func ldapSyncCmdF(cmd *cobra.Command, args []string) error {
if ldapI := einterfaces.GetLdapInterface(); ldapI != nil {
if err := ldapI.Syncronize(); err != nil {
CommandPrintErrorln("ERROR: AD/LDAP Synchronization Failed")
} else {
CommandPrettyPrintln("SUCCESS: AD/LDAP Synchronization Complete")
}
}
return nil
}