Skip to content

Commit 0a82cac

Browse files
Show error if executable moved (#51)
1 parent 0a02a67 commit 0a82cac

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

source/CommandLine/ShellCompletion/ShellCompletionInstaller.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.IO;
33
using System.Linq;
44
using System.Text;
5+
using Octopus.CommandLine.Commands;
56
using Octopus.CommandLine.Extensions;
67
using Octopus.CommandLine.Plumbing;
78

@@ -49,6 +50,13 @@ public virtual void Install(bool dryRun)
4950
{
5051
if (profileText.Contains(AllShellsPrefix) || profileText.Contains(AllShellsSuffix) || profileText.Contains(ProfileScript))
5152
{
53+
if (!profileText.Contains(ProfileScript)){
54+
var message =
55+
$"Looks like command line completion is already installed, but points to a different executable.{Environment.NewLine}" +
56+
$"Please manually edit the file {ProfileLocation} to remove the existing auto complete script and then re-install.";
57+
throw new CommandException(message);
58+
}
59+
5260
commandOutputProvider.Information("Looks like command line completion is already installed. Nothing to do.");
5361
return;
5462
}
@@ -84,4 +92,4 @@ public virtual void Install(bool dryRun)
8492
}
8593
}
8694
}
87-
}
95+
}

0 commit comments

Comments
 (0)