Skip to content

Commit c94234a

Browse files
pierrelalanneagateau-gg
authored andcommitted
feat(output_format): change default output format and update README accordingly
1 parent 967fb6b commit c94234a

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

README.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- [Generate My Token](#generate-my-token)
77
- [GitHub](#github)
88
- [GitLab](#gitlab)
9-
- [Compute my fileshas](#compute-my-fileshas)
9+
- [Compute my code fingerprints](#compute-my-code-fingerprints)
1010
- [GitHub](#github-1)
1111
- [GitLab](#gitlab-1)
1212
- [Bitbucket server (formely Atlassian Stash)](#bitbucket-server-formely-atlassian-stash)
@@ -15,7 +15,7 @@
1515

1616
## Introduction
1717

18-
The purpose of `src-fingerprint` is to provide an easy way to extract git related information (namely all files sha of a repository) from your hosted source version control system.
18+
The purpose of `src-fingerprint` is to provide an easy way to extract git related information (namely all file shas of a repository) from your hosted source version control system.
1919

2020
This util supports 3 main version control systems:
2121

@@ -32,6 +32,7 @@ Get the executables [here](http://github.com/gitguardian/src-fingerprint/release
3232
### Using Homebrew
3333

3434
If you're using [Homebrew](https://brew.sh/index_fr) you can add GitGuardian's tap and then install src-fingerprint. Just run the following commands :
35+
3536
```shell
3637
brew tap gitguardian/tap
3738
brew install src-fingerprint
@@ -64,37 +65,43 @@ $ go get -u github.com/gitguardian/src-fingerprint/cmd/src-fingerprint
6465
3. Click the `read repository` box. This is the only scope we need. You can set an end-date for the token validity if you want more security
6566
4. Click on `Create personal token`. The token will only be available at this time so make sure you keep it in a safe place
6667

67-
## Compute my fileshas
68+
## Compute my code fingerprints
6869

6970
### General information
71+
7072
The output format can be chosen between `jsonl`, `json`, `gzip-jsonl` and `gzip-json` with the option `--export-format`.
71-
The default format is `jsonl`, but if you want to minimize the size of the output file choose `gzip-jsonl`.
72-
Also, note that if you were to download fileshas for repositories of a big organization, `src-fingerprint` has a limit to process no more than 100
73+
The default format is `gzip-jsonl` to minimize the size of the output file.
74+
The default output filepath is `./fingerprints.jsonl.gz`. Use `--output` to override this behavior.
75+
Also, note that if you were to download fingerprints for repositories of a big organization, `src-fingerprint` has a limit to process no more than 100
7376
repositories. You can override this limit with the option `--limit`, a limit of 0 will process all repos of the organization.
7477

78+
### Default behavior
79+
80+
Note that by default **for github provider**, `src-fingerprint` will exclude private repositories, forks and archived repositories from the fingerprints computation. Use options `-e` or `--all` to change this behavior.
81+
7582
### GitHub
7683

77-
1. Export all file SHAs from a GitHub Org with private repositories to a file with logs:
84+
1. Export all fingerprints from private repositories from a GitHub Org to the default path `./fingerprints.jsonl.gz` with logs:
7885

7986
```sh
80-
env VCS_TOKEN="<token>" src-fingerprint -v --export-format gzip-jsonl --output fileshas_collected.jsonl.gz --provider github --object GitGuardian
87+
env VCS_TOKEN="<token>" src-fingerprint -v --provider github --object ORG_NAME --all
8188
```
8289

83-
2. Export all file SHAs of every repository the user can access to `stdout`:
90+
2. Export all fingerprints of every repository the user can access to the default path `./fingerprints.jsonl.gz`:
8491

8592
```sh
86-
env VCS_TOKEN="<token>" src-fingerprint -v --provider github
93+
env VCS_TOKEN="<token>" src-fingerprint -v --provider github --all
8794
```
8895

8996
### GitLab
9097

91-
1. Export all file SHAs from a GitLab group with private projects to a file with logs:
98+
1. Export all fingerprints from private repositories of a GitLab group to the default path `./fingerprints.jsonl.gz` with logs:
9299

93100
```sh
94-
env VCS_TOKEN="<token>" src-fingerprint -v --export-format gzip-jsonl --output fileshas_collected.jsonl.gz --provider gitlab --object "GitGuardian-dev-group"
101+
env VCS_TOKEN="<token>" src-fingerprint -v --provider gitlab --object "GitGuardian-dev-group"
95102
```
96103

97-
2. Export all file SHAs of every project the user can access to `stdout`:
104+
2. Export all fingerprints of every project the user can access to the default path `./fingerprints.jsonl.gz` with logs:
98105

99106
> :warning: On `gitlab.com` this will attempt to retrieve all repositories on `gitlab.com`
100107
@@ -104,13 +111,13 @@ env VCS_TOKEN="<token>" src-fingerprint -v --provider gitlab
104111

105112
### Bitbucket server (formely Atlassian Stash)
106113

107-
1. Export all file SHAs from a Bitbucket project with private repository to a file with logs:
114+
1. Export all fingerprints from a Bitbucket project with private repository to the default path `./fingerprints.jsonl.gz` with logs:
108115

109116
```sh
110-
env VCS_TOKEN="<token>" src-fingerprint -v --export-format gzip-jsonl --output fileshas_collected.jsonl.gz --provider bitbucket --object "GitGuardian Project"
117+
env VCS_TOKEN="<token>" src-fingerprint -v --provider bitbucket --object "GitGuardian Project"
111118
```
112119

113-
2. Export all file SHAs of every repository the user can access to `stdout`:
120+
2. Export all fingerprints of every repository the user can access to the default path `./fingerprints.jsonl.gz` with logs:
114121

115122
```sh
116123
env VCS_TOKEN="<token>" src-fingerprint -v --provider bitbucket
@@ -151,4 +158,5 @@ src-fingerprint -p repository -u .
151158
```
152159

153160
## License
161+
154162
GitGuardian `src-fingerprint` is MIT licensed.

cmd/src-fingerprint/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ func main() {
112112
&cli.StringFlag{
113113
Name: "output",
114114
Aliases: []string{"o"},
115-
Value: "-",
116-
Usage: "set output path to `FILE`. stdout by default",
115+
Value: "./fingerprints.jsonl.gz",
116+
Usage: "set output path to `FILE`. Use \"-\" to redirect to stdout.",
117117
},
118118
&cli.StringFlag{
119119
Name: "export-format",
120120
Aliases: []string{"f"},
121-
Value: "jsonl",
122-
Usage: "export format: 'jsonl'/'gzip-jsonl'/'json'/'gzip-json'. 'jsonl' by default",
121+
Value: "gzip-jsonl",
122+
Usage: "export format: 'jsonl'/'gzip-jsonl'/'json'/'gzip-json'",
123123
},
124124
&cli.StringFlag{
125125
Name: "clone-dir",

0 commit comments

Comments
 (0)