Skip to content

Commit

Permalink
Add support for protobuf files
Browse files Browse the repository at this point in the history
Signed-off-by: Liam White <[email protected]>
  • Loading branch information
liamawhite committed Jun 27, 2019
1 parent 5116388 commit 5aff729
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Languages:
- Golang
- Make
- Python
- Protobuf
- Shell
- YAML

Expand All @@ -30,7 +31,7 @@ brew install liamawhite/licenser/licenser
To install on Ubuntu/Debian, use `wget`.

```sh
wget -c https://github.com/liamawhite/licenser/releases/download/v0.3.3/licenser_0.3.3_Linux_x86_64.tar.gz -O - | sudo tar -xz -C /usr/bin
wget -c https://github.com/liamawhite/licenser/releases/download/v${VERSION}/licenser_${VERSION}_Linux_x86_64.tar.gz -O - | sudo tar -xz -C /usr/bin
```

To install on other platforms, download from the [releases section](https://github.com/liamawhite/licenser/releases).
Expand Down
2 changes: 2 additions & 0 deletions pkg/file/mutator.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ func identifyLanguageStyle(path string) *languageStyle {
return commentStyles["golang"]
case ".py":
return commentStyles["python"]
case ".proto":
return commentStyles["protobuf"]
case ".sh", ".patch":
return commentStyles["shell"]
case ".yaml", ".yml":
Expand Down
17 changes: 9 additions & 8 deletions pkg/file/style.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ type languageStyle struct {
}

var commentStyles = map[string]*languageStyle{
"bazel": &languageStyle{isBlock: false, comment: "#"},
"c": &languageStyle{isBlock: false, comment: "//"},
"docker": &languageStyle{isBlock: false, comment: "#"},
"golang": &languageStyle{isBlock: false, comment: "//"},
"make": &languageStyle{isBlock: false, comment: "#"},
"python": &languageStyle{isBlock: false, comment: "#"},
"shell": &languageStyle{isBlock: false, comment: "#"},
"yaml": &languageStyle{isBlock: false, comment: "#"},
"bazel": &languageStyle{isBlock: false, comment: "#"},
"c": &languageStyle{isBlock: false, comment: "//"},
"docker": &languageStyle{isBlock: false, comment: "#"},
"golang": &languageStyle{isBlock: false, comment: "//"},
"make": &languageStyle{isBlock: false, comment: "#"},
"protobuf": &languageStyle{isBlock: false, comment: "//"},
"python": &languageStyle{isBlock: false, comment: "#"},
"shell": &languageStyle{isBlock: false, comment: "#"},
"yaml": &languageStyle{isBlock: false, comment: "#"},
}

0 comments on commit 5aff729

Please sign in to comment.