forked from toolshed/abra
fix(recipe): Prevent crash when recipe has no previous tag or release
This commit is contained in:
@ -42,7 +42,8 @@ local file system.`),
|
||||
ValidArgsFunction: func(
|
||||
cmd *cobra.Command,
|
||||
args []string,
|
||||
toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
toComplete string,
|
||||
) ([]string, cobra.ShellCompDirective) {
|
||||
switch l := len(args); l {
|
||||
case 0:
|
||||
return autocomplete.RecipeNameComplete()
|
||||
@ -131,10 +132,16 @@ likely to change.
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
latestRelease := tags[len(tags)-1]
|
||||
latestRelease := "0.0.0+0.0.0"
|
||||
if len(tags) > 0 {
|
||||
latestRelease = tags[len(tags)-1]
|
||||
}
|
||||
changesTable.Headers(i18n.G("SERVICE"), latestRelease, i18n.G("PROPOSED CHANGES"))
|
||||
|
||||
latestRecipeVersion := versions[len(versions)-1]
|
||||
latestRecipeVersion := latestRelease
|
||||
if len(versions) > 0 {
|
||||
latestRecipeVersion = versions[len(versions)-1]
|
||||
}
|
||||
allRecipeVersions := catl[recipe.Name].Versions
|
||||
for _, recipeVersion := range allRecipeVersions {
|
||||
if serviceVersions, ok := recipeVersion[latestRecipeVersion]; ok {
|
||||
|
||||
Reference in New Issue
Block a user