Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tab completion instructions for PowerShell #1623

Merged
merged 1 commit into from
Feb 26, 2019

Conversation

matt9ucci
Copy link
Contributor

For Windows PowerShell and PowerShell Core (Linux/Mac/Win) users.

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with this, but I'd like someone else who has Windows to hand to give it a 👍 too

@dwijnand
Copy link
Member

@matt9ucci do you know if one could programmatically test installed PowerShell completions?

I'd (always) prefer a test, but I'm cool with this landing as is, and forward-fixing anything that comes up.

@matt9ucci
Copy link
Contributor Author

do you know if one could programmatically test installed PowerShell completions?

Yes. 😃
Try the following test code:

# Test rustup
if (!(Get-Command rustup)) {
    Write-Error 'rustup is not installed'
}

# Enable rustup tab completion
rustup completions powershell | Out-String | Invoke-Expression

# Get completion texts for 'rustup ' (e.g. completions, component, default, doc, etc.)
$text = 'rustup '
$cursorPosition = $text.Length
$options = $null
$completionTexts = [System.Management.Automation.CommandCompletion]::CompleteInput($text, $cursorPosition, $options).CompletionMatches.CompletionText

# Verify the result of completion
if ($completionTexts -contains 'completions') {
    Write-Host 'rustup tab completion is successfully enabled'
} else {
    Write-Error 'rustup tab completion is not enabled'
}

It is just an easy version. If we need "full" unit testing, using the Pester is the best solution (for reference, see my Pester test cases for DockerCompletion module)

@dwijnand
Copy link
Member

Cool. It doesn't look like we have anything like that running on AppVeyor. Is setting that up something that would be of interest to you?

@kinnison
Copy link
Contributor

I'm not sure we CI completions at all right now. I'd be satisfied with just one other person who can use PowerShell verifying that the instructions provided for the README work and are appropriately idiomatic.

@matt9ucci
Copy link
Contributor Author

Hi all. I have done with Pester test script and appveyor.yml, and submitted the PR #1629. Please review it.
If you do not need such a test script, don't hesitate to close the PR.

@nrc nrc merged commit 31e9136 into rust-lang:master Feb 26, 2019
@matt9ucci matt9ucci deleted the readme-pwsh-compl branch February 26, 2019 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants