From bb277bbf802f2d397055c753377373022d24818a Mon Sep 17 00:00:00 2001 From: Renan <6718144+renancaraujo@users.noreply.github.com> Date: Fri, 10 Feb 2023 18:52:41 +0000 Subject: [PATCH] fix: completion installation (#53) --- lib/src/installer/completion_installation.dart | 2 +- .../installer/completion_installation_test.dart | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/src/installer/completion_installation.dart b/lib/src/installer/completion_installation.dart index c3e6ef0..86b2115 100644 --- a/lib/src/installer/completion_installation.dart +++ b/lib/src/installer/completion_installation.dart @@ -306,7 +306,7 @@ class CompletionInstallation { configFile.writeAsStringSync( mode: FileMode.append, ''' -## [$scriptName] +\n## [$scriptName] ## $description ${configuration!.sourceLineTemplate(scriptPath)} ## [/$scriptName] diff --git a/test/src/installer/completion_installation_test.dart b/test/src/installer/completion_installation_test.dart index 000dedb..e5c8527 100644 --- a/test/src/installer/completion_installation_test.dart +++ b/test/src/installer/completion_installation_test.dart @@ -205,7 +205,8 @@ void main() { expect(configFile.existsSync(), true); // ignore: leading_newlines_in_multiline_strings - expect(configFile.readAsStringSync(), '''## [very_good] + expect(configFile.readAsStringSync(), ''' +\n## [very_good] ## Completion config for "very_good" [[ -f ${configDir.path}/very_good.zsh ]] && . ${configDir.path}/very_good.zsh || true ## [/very_good] @@ -265,7 +266,8 @@ void main() { installation.writeToShellConfigFile('very_good'); // ignore: leading_newlines_in_multiline_strings - expect(rcFile.readAsStringSync(), '''## [Completion] + expect(rcFile.readAsStringSync(), ''' +\n## [Completion] ## Completion scripts setup. Remove the following line to uninstall [[ -f ${configDir.path}/zsh-config.zsh ]] && . ${configDir.path}/zsh-config.zsh || true ## [/Completion] @@ -372,7 +374,8 @@ void main() { // rc fle includes one reference to the global config // ignore: leading_newlines_in_multiline_strings - expect(rcFile.readAsStringSync(), '''## [Completion] + expect(rcFile.readAsStringSync(), ''' +\n## [Completion] ## Completion scripts setup. Remove the following line to uninstall [[ -f ${configDir.path}/zsh-config.zsh ]] && . ${configDir.path}/zsh-config.zsh || true ## [/Completion] @@ -385,12 +388,13 @@ void main() { ); // ignore: leading_newlines_in_multiline_strings - expect(globalConfig.readAsStringSync(), '''## [very_good] + expect(globalConfig.readAsStringSync(), ''' +\n## [very_good] ## Completion config for "very_good" [[ -f ${configDir.path}/very_good.zsh ]] && . ${configDir.path}/very_good.zsh || true ## [/very_good] -## [not_good] +\n## [not_good] ## Completion config for "not_good" [[ -f ${configDir.path}/not_good.zsh ]] && . ${configDir.path}/not_good.zsh || true ## [/not_good] @@ -423,7 +427,8 @@ void main() { ..install('not_good'); // ignore: leading_newlines_in_multiline_strings - expect(bashProfile.readAsStringSync(), '''## [Completion] + expect(bashProfile.readAsStringSync(), ''' +\n## [Completion] ## Completion scripts setup. Remove the following line to uninstall [ -f ${configDir.path}/bash-config.bash ] && . ${configDir.path}/bash-config.bash || true ## [/Completion]