PLT-6471 Properly panic when translations can't be loaded (#6414)

* PLT-6471 Properly panic when translations can't be loaded

* Print usage messages when errors occur during CLI initialization

* Reverted behaviour of FindDir and added second return value to it

* Fixed merge conflict
Этот коммит содержится в:
Harrison Healey
2017-05-23 11:06:25 -04:00
коммит произвёл GitHub
родитель 69f3f2fdce
Коммит 5c1049054e
23 изменённых файлов: 189 добавлений и 73 удалений

Просмотреть файл

@@ -67,7 +67,9 @@ func init() {
}
func createTeamCmdF(cmd *cobra.Command, args []string) error {
initDBCommandContextCobra(cmd)
if err := initDBCommandContextCobra(cmd); err != nil {
return err
}
name, errn := cmd.Flags().GetString("name")
if errn != nil || name == "" {
@@ -100,7 +102,9 @@ func createTeamCmdF(cmd *cobra.Command, args []string) error {
}
func removeUsersCmdF(cmd *cobra.Command, args []string) error {
initDBCommandContextCobra(cmd)
if err := initDBCommandContextCobra(cmd); err != nil {
return err
}
if len(args) < 2 {
return errors.New("Not enough arguments.")
@@ -130,7 +134,9 @@ func removeUserFromTeam(team *model.Team, user *model.User, userArg string) {
}
func addUsersCmdF(cmd *cobra.Command, args []string) error {
initDBCommandContextCobra(cmd)
if err := initDBCommandContextCobra(cmd); err != nil {
return err
}
if len(args) < 2 {
return errors.New("Not enough arguments.")
@@ -160,7 +166,9 @@ func addUserToTeam(team *model.Team, user *model.User, userArg string) {
}
func deleteTeamsCmdF(cmd *cobra.Command, args []string) error {
initDBCommandContextCobra(cmd)
if err := initDBCommandContextCobra(cmd); err != nil {
return err
}
if len(args) < 1 {
return errors.New("Not enough arguments.")