Skip to content

Commit 38c7824

Browse files
Walzpierrelalanne
authored andcommitted
chore: Improve --help and Readme, multiple --object and --limit behavior
1 parent 4feeae9 commit 38c7824

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ The default format is `gzip-jsonl` to minimize the size of the output file.
103103
The default output filepath is `./fingerprints.jsonl.gz`. Use `--output` to override this behavior.
104104
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
105105
repositories. You can override this limit with the option `--limit`, a limit of 0 will process all repos of the organization.
106+
Note that if multiple organizations are passed, the limit is applied to each one independently.
106107

107108
### Sample output
108109

@@ -126,10 +127,10 @@ For all the following examples, we assume that the user is able to clone reposit
126127

127128
### GitHub
128129

129-
1. Export all fingerprints from private repositories from a GitHub Org to the default path `./fingerprints.jsonl.gz` with logs:
130+
1. Export all fingerprints from private repositories from GitHub Orgs to the default path `./fingerprints.jsonl.gz` with logs:
130131

131132
```sh
132-
env VCS_TOKEN="<token>" src-fingerprint -v collect --provider github --object ORG_NAME
133+
env VCS_TOKEN="<token>" src-fingerprint -v collect --provider github --object ORG_1_NAME --object ORG_2_NAME
133134
```
134135

135136
2. Export all fingerprints of every repository the user can access to the default path `./fingerprints.jsonl.gz`:
@@ -153,7 +154,7 @@ env VCS_TOKEN="<token>" src-fingerprint -v collect --provider gitlab --object "G
153154
env VCS_TOKEN="<token>" src-fingerprint -v collect --provider gitlab --include-forked-repos
154155
```
155156

156-
### Bitbucket server (formely Atlassian Stash)
157+
### Bitbucket server (formerly Atlassian Stash)
157158

158159
1. Export all fingerprints from a Bitbucket project with private repository to the default path `./fingerprints.jsonl.gz` with logs:
159160
**Note :** If you are targeting a self-hosted BitBucket instance, use the `--provider-url` to specify its url, don't forget to include the scheme.
@@ -190,10 +191,10 @@ src-fingerprint collect -p repository -u 'https://user:[email protected]/GitGu
190191
src-fingerprint collect -p repository -u 'https://github.com/GitGuardian/gg-shield.git'
191192
```
192193

193-
3. repository in a local directory
194+
3. repository in multiple local directories
194195

195196
```sh
196-
src-fingerprint collect -p repository -u /projects/gitlab/src-fingerprint
197+
src-fingerprint collect -p repository -u /projects/gitlab/src-fingerprint -u /projects/gitlab/internal-api
197198
```
198199

199200
4. repository in current directory

cmd/src-fingerprint/main.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,22 @@ func main() {
118118
Name: "provider",
119119
Aliases: []string{"p"},
120120
Required: true,
121-
Usage: "Source code provider. options: 'gitlab'/'github'/'bitbucket'/'repository'",
121+
Usage: "Source code provider. options: 'gitlab'/'github'/'bitbucket'/'repository'.",
122122
},
123123
&cli.StringFlag{
124124
Name: "provider-url",
125-
Usage: "base URL of the Git provider API. If not set, defaults URL are used.",
125+
Usage: "Base URL of the Git provider API. If not set, defaults URL are used.",
126126
},
127127
&cli.StringSliceFlag{
128128
Name: "object",
129129
Aliases: []string{"u"},
130-
Usage: "repository|org|group to scrape. If not specified all reachable repositories will be collected.",
130+
Usage: "Repository, organization or group to scrape. If not specified all reachable " +
131+
"repositories will be collected.",
131132
},
132133
&cli.BoolFlag{
133134
Name: "include-forked-repos",
134135
Value: false,
135-
Usage: "include forked repositories. Available for 'github' and 'gitlab' providers.",
136+
Usage: "Include forked repositories. Available for 'github' and 'gitlab' providers.",
136137
},
137138
&cli.BoolFlag{
138139
Name: "include-public-repos",
@@ -148,18 +149,18 @@ func main() {
148149
Name: "export-format",
149150
Aliases: []string{"f"},
150151
Value: "gzip-jsonl",
151-
Usage: "export format: 'jsonl'/'gzip-jsonl'/'json'/'gzip-json'",
152+
Usage: "Export format: 'jsonl'/'gzip-jsonl'/'json'/'gzip-json'.",
152153
},
153154
&cli.StringFlag{
154155
Name: "output",
155156
Aliases: []string{"o"},
156157
Value: "./fingerprints.jsonl.gz",
157-
Usage: "set output path to `FILE`. Use \"-\" to redirect to stdout.",
158+
Usage: "Set output path to `FILE`. Use \"-\" to redirect to stdout.",
158159
},
159160
&cli.StringFlag{
160161
Name: "clone-dir",
161162
Value: "-",
162-
Usage: "set cloning location for repositories",
163+
Usage: "Set cloning location for repositories.",
163164
},
164165
&cli.BoolFlag{
165166
Name: "ssh-cloning",
@@ -169,32 +170,33 @@ func main() {
169170
&cli.StringFlag{
170171
Name: "after",
171172
Value: "",
172-
Usage: "set a commit date after which we want to collect fileshas",
173+
Usage: "Set a commit date after which we want to collect fileshas.",
173174
},
174175
&cli.StringFlag{
175176
Name: "repo-name",
176-
Usage: "Name of the repository to display in outputs if the provider is 'repository'",
177+
Usage: "Name of the repository to display in outputs if the provider is 'repository'.",
177178
},
178179
&cli.BoolFlag{
179180
Name: "repo-is-private",
180181
Value: false,
181-
Usage: "Private status value to display in outputs if the provider is 'repository'",
182+
Usage: "Private status value to display in outputs if the provider is 'repository'.",
182183
},
183184
&cli.StringFlag{
184185
Name: "token",
185186
Aliases: []string{"t"},
186-
Usage: "token for vcs access.",
187+
Usage: "Token for vcs access.",
187188
EnvVars: []string{"VCS_TOKEN", "GITLAB_TOKEN", "GITHUB_TOKEN"},
188189
},
189190
&cli.IntFlag{
190191
Name: "cloners",
191192
Value: DefaultClonerN,
192-
Usage: "number of cloners, more cloners means more memory usage",
193+
Usage: "Number of cloners, more cloners means more memory usage.",
193194
},
194195
&cli.IntFlag{
195196
Name: "limit",
196197
Value: DefaultLimit,
197-
Usage: "maximum number of repositories to analyze (0 for unlimited).",
198+
Usage: "Maximum number of repositories to analyze (0 for unlimited). " +
199+
"The limit is applied for independently to each object.",
198200
},
199201
},
200202
},

0 commit comments

Comments
 (0)