The bug
The PowerShell autocomplete generation command appears to be broken in Octopus CLI 2.21.3 and 2.21.2.
The CLI advertises a completion command:
completion: Generate the autocompletion script for the specified shell
The following help command succeeds and shows the expected usage:
octopus help completion powershell
Output:
Generate the autocompletion script for powershell.
To load completions in your current shell session:
octopus completion powershell | Out-String | Invoke-Expression
However, running the documented command:
octopus completion powershell
does not generate a PowerShell completion script.
Instead, it outputs the top-level Octopus CLI banner/help beginning with:
Work seamlessly with Octopus Deploy from the command line.
and exits with code:
No output is written to STDERR.
Because the command emits the root help text rather than a PowerShell script, the documented installation command also fails:
octopus completion powershell | Out-String | Invoke-Expression
Result:
Invoke-Expression : The term 'Work' is not recognized as the name of a cmdlet,
function, script file, or operable program.
Command to reproduce
octopus --version
octopus help completion powershell
octopus completion powershell
$LASTEXITCODE
Also:
octopus completion powershell | Out-String | Invoke-Expression
$LASTEXITCODE
Outcome
Actual:
Work seamlessly with Octopus Deploy from the command line.
####
############
##################
...
Exit code:
STDERR:
Expected:
A PowerShell completion script is written to STDOUT.
Versions
cli:
Also reproduced on:
Octopus Server:
The completion script generation command should not require an Octopus Server connection to function.
Links
None.
The bug
The PowerShell autocomplete generation command appears to be broken in Octopus CLI 2.21.3 and 2.21.2.
The CLI advertises a completion command:
The following help command succeeds and shows the expected usage:
Output:
However, running the documented command:
does not generate a PowerShell completion script.
Instead, it outputs the top-level Octopus CLI banner/help beginning with:
and exits with code:
No output is written to STDERR.
Because the command emits the root help text rather than a PowerShell script, the documented installation command also fails:
Result:
Command to reproduce
Also:
Outcome
Actual:
Exit code:
STDERR:
Expected:
Versions
cli:
Also reproduced on:
Octopus Server:
The completion script generation command should not require an Octopus Server connection to function.
Links
None.