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 display-name option to customize/disambiguate output #454

Merged
merged 3 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ your changes (you can read more about pull requests on GitHub [here](http://help

When you send a pull request, please be sure to include:
- unit tests that validate that your changes work as expected (both for Go and for JavaScript changes)
- consice code comments (it can help to imagine that you're explaining your code to a total stranger)
- an examples, if necessary.
- concise code comments (it can help to imagine that you're explaining your code to a total stranger)
- one or more examples, if necessary.
awf marked this conversation as resolved.
Show resolved Hide resolved

## More
Hound is a volunteer effort. We do our best to try and review contributions in a timely manner. Any code or feedback
Expand Down
4 changes: 4 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func repoNameFor(repos map[string]*config.Repo, repo string) string {
return repo
}

if data.DisplayName != "" {
return data.DisplayName
}

name := repoNameFromUrl(data.Url)
if name == "" {
return repo
Expand Down
1 change: 1 addition & 0 deletions config-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"url" : "https://www.github.com/YourOrganization/RepoOne.git",
"ms-between-poll": 10000,
"exclude-dot-files": true,
"display-name": "RepoOne (dot files not indexed)",
"auto-generated-files": ["example/path"]
},
"GitRepoWithDetectRefDisabled" : {
Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type UrlPattern struct {

type Repo struct {
Url string `json:"url"`
DisplayName string `json:"display-name"`
MsBetweenPolls int `json:"ms-between-poll"`
Vcs string `json:"vcs"`
VcsConfigMessage *SecretMessage `json:"vcs-config"`
Expand Down
1 change: 1 addition & 0 deletions docs/config-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Options for url used for repo link under repos

URLOptions | Description | Default Values
:------ | :--- | :-----
display-name | alternative display name for repo | ""
url-pattern | when provided used by Hound for config|`{url}/blob/{rev}/{path}{anchor}`
anchor | when provided used for vcs config| `#L{line}`

Expand Down
4 changes: 4 additions & 0 deletions ui/assets/js/hound.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ var Model = {
return repo;
}

if (info['display-name']) {
return info['display-name'];
}

var url = info.url,
ax = url.lastIndexOf("/");
if (ax < 0) {
Expand Down