aboutsummaryrefslogtreecommitdiff
path: root/cmd/planr/sub/cli.go
diff options
context:
space:
mode:
authorFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-06 21:06:02 -0500
committerFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-06 21:06:02 -0500
commitcc9e3965a365a9b98fd4c454017dfa8e40860fb1 (patch)
tree6588c40c71d39a5bcc4233afb1416f92e953558b /cmd/planr/sub/cli.go
parent82dcbb2a65a6a073a1809fcd202b540885df02d2 (diff)
downloadplanr-cc9e3965a365a9b98fd4c454017dfa8e40860fb1.tar.xz
planr-cc9e3965a365a9b98fd4c454017dfa8e40860fb1.zip
Add --extra flag to print addtional configuration info
Diffstat (limited to 'cmd/planr/sub/cli.go')
-rw-r--r--cmd/planr/sub/cli.go28
1 files changed, 21 insertions, 7 deletions
diff --git a/cmd/planr/sub/cli.go b/cmd/planr/sub/cli.go
index e6f2256..4d29144 100644
--- a/cmd/planr/sub/cli.go
+++ b/cmd/planr/sub/cli.go
@@ -17,8 +17,8 @@ var (
func tcTitle(tr planr.TestResult) string {
title := tr.Tc.Cname
- if tr.Tc.Config.Title != nil {
- title = *tr.Tc.Config.Title
+ if tr.Tc.Config.Title != "" {
+ title = tr.Tc.Config.Title
}
return title
@@ -70,20 +70,34 @@ func tcStatusLine(tr planr.TestResult) {
col_title.Println(title);
}
-func tcPprint(tr planr.TestResult) {
+type PrintOpts int
+
+const (
+ PRINT_CONCISE PrintOpts = 1 << iota
+ PRINT_DESCRIPTION
+ PRINT_POINTS
+)
+
+func (opt PrintOpts) HasFlag(flag PrintOpts) bool {
+ return (opt & flag) == flag
+}
+
+func tcPprint(tr planr.TestResult, opt PrintOpts) {
tcStatusLine(tr)
tc := tr.Tc
pprintLabeled("id", tc.Cname)
- if tc.Config.Points != nil {
+ if tc.Config.Points != nil && opt.HasFlag(PRINT_POINTS) {
points := fmt.Sprintf("%.1f", *tc.Config.Points)
- pprintLabeled("points", points)
+ pprintLabeled("points1", points)
}
- if tc.Config.Description != nil {
- pprintLabeled("description", *tc.Config.Description)
+ if tc.Config.Description != "" && opt.HasFlag(PRINT_DESCRIPTION) {
+ tabbed := strings.ReplaceAll(tc.Config.Description, "\n", "\n ")
+
+ pprintLabeled("description", tabbed)
}
if tr.Status == planr.COMPILATION_FAILURE {