Skip to content

Commit

Permalink
Add display-name option to customize/disambiguate output (hound-sea…
Browse files Browse the repository at this point in the history
  • Loading branch information
awf committed Apr 19, 2023
1 parent e825c3d commit 445500b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
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.

## 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

0 comments on commit 445500b

Please sign in to comment.