From 2c793a844ca8a3cdb2e72dee9ec357a0ad134a5b Mon Sep 17 00:00:00 2001 From: Erik Zivkovic Date: Thu, 14 Jul 2016 21:58:29 +0200 Subject: [PATCH] Remove .gradletasknamecache before regenerating it Remove the .gradletasknamecache file to avoid having an unnecessary newline at the top of the file when regenerating it. --- plugins/gradle/gradle.plugin.zsh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index ecabdd207..2baf5e1af 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -97,8 +97,10 @@ _gradle_tasks () { if [[ -f build.gradle ]]; then _gradle_arguments if _gradle_does_task_list_need_generating; then - # First make an empty file - echo '' > .gradletasknamecache + # First empty the old cache file + if [ -f .gradletasknamecache ]; then + rm .gradletasknamecache + fi # Then append the rest of the lines to that file output=$(gradle tasks --all) _gradle_parse_tasks_to_gradletasknamecache $output @@ -111,8 +113,10 @@ _gradlew_tasks () { if [[ -f build.gradle ]]; then _gradle_arguments if _gradle_does_task_list_need_generating; then - # First make an empty file - echo '' > .gradletasknamecache + # First empty the old cache file + if [ -f .gradletasknamecache ]; then + rm .gradletasknamecache + fi # Then append the rest of the lines to that file output=$(./gradlew tasks --all) _gradle_parse_tasks_to_gradletasknamecache $output