Skip to content

Commit c3f1350

Browse files
🌱 Improve printing options (#1584)
When print options, there are two sections: "Scorecard options:" and "Event / repo information:". However, the headers of these sections have the same format as the options themselves (name followed by ":"). So I initially failed to identify they were just headers, and thought they were actual options that were empty. I think indenting entries inside each section helps avoid this confusion. Before: ```console Scorecard options: Ref: HEAD Repository: ossf/scorecard Local: Format: sarif Policy file: /policy.yml Event / repo information: Event file: /testdata/fork.json Event name: branch_protection_rule Fork repository: true Private repository: true Publication enabled: false Default branch: main ``` After: ```console Scorecard options: Ref: HEAD Repository: ossf/scorecard Local: Format: sarif Policy file: /policy.yml Event / repo information: Event file: /testdata/fork.json Event name: branch_protection_rule Fork repository: true Private repository: true Publication enabled: false Default branch: main ``` Signed-off-by: David Rodríguez <[email protected]>
1 parent 43e475b commit c3f1350

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

options/options.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,19 @@ func (o *Options) Validate() error {
140140
func (o *Options) Print() {
141141
// Scorecard options
142142
fmt.Println("Scorecard options:")
143-
fmt.Printf("Ref: %s\n", o.ScorecardOpts.Commit)
144-
fmt.Printf("Repository: %s\n", o.ScorecardOpts.Repo)
145-
fmt.Printf("Local: %s\n", o.ScorecardOpts.Local)
146-
fmt.Printf("Format: %s\n", o.ScorecardOpts.Format)
147-
fmt.Printf("Policy file: %s\n", o.ScorecardOpts.PolicyFile)
143+
fmt.Printf(" Ref: %s\n", o.ScorecardOpts.Commit)
144+
fmt.Printf(" Repository: %s\n", o.ScorecardOpts.Repo)
145+
fmt.Printf(" Local: %s\n", o.ScorecardOpts.Local)
146+
fmt.Printf(" Format: %s\n", o.ScorecardOpts.Format)
147+
fmt.Printf(" Policy file: %s\n", o.ScorecardOpts.PolicyFile)
148148
fmt.Println()
149149
fmt.Println("Event / repo information:")
150-
fmt.Printf("Event file: %s\n", o.GithubEventPath)
151-
fmt.Printf("Event name: %s\n", o.GithubEventName)
152-
fmt.Printf("Fork repository: %s\n", o.IsForkStr)
153-
fmt.Printf("Private repository: %s\n", o.PrivateRepoStr)
154-
fmt.Printf("Publication enabled: %+v\n", o.PublishResults)
155-
fmt.Printf("Default branch: %s\n", o.DefaultBranch)
150+
fmt.Printf(" Event file: %s\n", o.GithubEventPath)
151+
fmt.Printf(" Event name: %s\n", o.GithubEventName)
152+
fmt.Printf(" Fork repository: %s\n", o.IsForkStr)
153+
fmt.Printf(" Private repository: %s\n", o.PrivateRepoStr)
154+
fmt.Printf(" Publication enabled: %+v\n", o.PublishResults)
155+
fmt.Printf(" Default branch: %s\n", o.DefaultBranch)
156156
}
157157

158158
func (o *Options) setScorecardOpts() {

0 commit comments

Comments
 (0)