Skip to content

Commit 2b1acf4

Browse files
committed
v0.2.0
1 parent 1c877d7 commit 2b1acf4

File tree

4 files changed

+63
-9
lines changed

4 files changed

+63
-9
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11

22
SRC=main.go
33
BIN=github-team-ssh-keys
4+
VERSION=$(shell cat VERSION)
45

56
all:
67
GO111MODULE=on go build -o $(BIN) $(SRC)
78

89
run:
910
GO111MODULE=on go run ${SRC} --github-org epitech --github-team sysadmin
1011

12+
release:
13+
GO111MODULE=on go build -o $(BIN)_$(VERSION)_linux-amd64 $(SRC)
14+
1115
clean:
1216
rm -f $(BIN)

README.md

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@ Sync public ssh keys to `~/.ssh/authorized_keys`, based on Github teams membersh
44

55
## Install
66

7-
```
8-
go get github.com/samber/github-team-ssh-keys
7+
```bash
8+
$ go get github.com/samber/github-team-ssh-keys
99
```
1010

1111
or
1212

13-
```
14-
curl -o /usr/local/bin/github-team-ssh-keys https://github.com/samber/github-team-ssh-keys/releases/download/v0.1.0/github-team-ssh-keys_v0.1.0_linux-amd64
13+
```bash
14+
$ curl -o /usr/local/bin/github-team-ssh-keys \
15+
https://github.com/samber/github-team-ssh-keys/releases/download/v0.2.0/github-team-ssh-keys_v0.2.0_linux-amd64
16+
$ chmod +x /usr/local/bin/github-team-ssh-keys
1517
```
1618

17-
### Sync with crontask
19+
### Sync using a crontask
1820

19-
```
20-
crontab -e
21+
```bash
22+
$ crontab -e
2123
```
2224

2325
Then:
@@ -29,10 +31,54 @@ Then:
2931

3032
## Usage
3133

34+
### Simple user
35+
36+
```bash
37+
$ github-team-ssh-keys --github-user samber
38+
39+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhDlAK8ewcwCTOv6xZHAAJK36QJ1ljJyn9/GiDTHE9aAREQdTtpPGrLvCxuqy3SZl/hvwSpNFjz0YH0sYvfQvBOTCogNo9o1FKcJaA9jOxPktRb2pObDA0+e2KIbyx3JR4hg63uP+p7awP8uKoRE+O8G6aTmv33mwqsl8ZOMVPo+qEkWniVCc5m7U1a/jIZj2JgFBa7Dhjnnr7RKlUWnmc0VhKQLwiOnyzpSMV2WBlOBrBnUAz60F2exTdX7zgULMHxyRSmL4xe/+BUHEUf9T41AEdWtcUx0iS7m/wGUvHKKokkz1zCkUGFy+Kq3rviH9dWYYt4KiHPm2/6DgKNua/ samber@github-team-ssh-key
40+
```
41+
42+
### All members of an organizations
43+
44+
```bash
45+
$ github-team-ssh-keys --github-token XXXXXXXXXXXXXXX \
46+
--github-org epitech
47+
48+
[...]
49+
```
50+
51+
### All members of an organizations being part of teams "root" and "sre"
3252

53+
```bash
54+
$ github-team-ssh-keys --github-token XXXXXXXXXXXXXXX \
55+
--github-org epitech \
56+
--github-team root \
57+
--github-team sre
58+
59+
[...]
60+
```
61+
62+
### All members of an organizations excluding me ;)
63+
64+
```bash
65+
$ github-team-ssh-keys --github-token XXXXXXXXXXXXXXX \
66+
--github-org epitech \
67+
--exclude-github-user samber
68+
69+
[...]
70+
```
3371

3472
## Contribute
3573

74+
```bash
75+
$ make run
76+
```
77+
78+
```bash
79+
$ make release
80+
```
81+
3682
## License
3783

3884
[MIT license](./LICENSE)

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.2.0

main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ func getUserSSHKeys(username string) []string {
137137
}
138138

139139
func output(sshKeys []string) {
140-
fmt.Println(strings.Join(sshKeys, "\n\n"))
140+
if len(sshKeys) > 0 {
141+
fmt.Println("#\n# Generated with https://github.com/samber/github-team-ssh-keys\n#\n")
142+
fmt.Println(strings.Join(sshKeys, "\n\n"))
143+
}
141144
}
142145

143146
func checkFlags() {
@@ -159,7 +162,7 @@ func checkFlags() {
159162
}
160163

161164
func main() {
162-
kingpin.Version("0.1.0")
165+
kingpin.Version("0.2.0")
163166
kingpin.Parse()
164167
checkFlags()
165168

0 commit comments

Comments
 (0)