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

Autocomplete user-defined pretty formats #802

Merged
merged 3 commits into from
Oct 27, 2020

Conversation

rdnlsmith
Copy link
Contributor

Enumerates any pretty.* keys in the user's Git config and includes
them alongside built-in options like oneline, short, full, etc.
for the --pretty= and --format= parameters of git log and
git show.

The key enumeration is done generically via function gitConfigKeys,
which in theory could be used for enumerating other config values with a
similar structure.

Fixes #786.

Enumerates any `pretty.*` keys in the user's Git config and includes
them alongside built-in options like `oneline`, `short`, `full`, etc.
for the `--pretty=` and `--format=` parameters of `git log` and
`git show`.

The key enumeration is done generically via function `gitConfigKeys`,
which in theory could be used for enumerating other config values with a
similar structure.

Fixes dahlbyk#786.
Copy link
Owner

@dahlbyk dahlbyk left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! I have a few suggestions - thoughts?

It would be nice to have tests to verify this works as expected with and without custom pretty.* config. For alias setup/teardown, see

BeforeEach {
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssigments', '')]
$repoPath = NewGitTempRepo
# Test with non-standard vsts pr alias name
&$gitbin config alias.test-vsts-pr "!f() { exec vsts code pr \`"`$`@\`"; }; f"
}
AfterEach {
RemoveGitTempRepo $repoPath
}

src/GitParamTabExpansion.ps1 Outdated Show resolved Hide resolved
src/GitParamTabExpansion.ps1 Outdated Show resolved Hide resolved
@rdnlsmith
Copy link
Contributor Author

Updated! I totally agree with the code changes—the way I had it was a case of me trying a little too hard to emulate existing nearby code.

Hopefully the tests I wrote are appropriate!

Copy link
Owner

@dahlbyk dahlbyk left a comment

Choose a reason for hiding this comment

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

Nailed it. Nice work, and thanks for the contribution!

@dahlbyk dahlbyk merged commit 0e20dfb into dahlbyk:master Oct 27, 2020
@rdnlsmith rdnlsmith deleted the feature/custom-pretty-autocomplete branch October 27, 2020 19:40
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.

Support completion for user-defined formats
2 participants