Fix tabwriter
This commit is contained in:
@@ -35,7 +35,9 @@ func (c *DatabasesCommand) Run(ctx context.Context, args []string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List all databases.
|
// List all databases.
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 8, 2, ' ', 0)
|
||||||
|
defer w.Flush()
|
||||||
|
|
||||||
fmt.Fprintln(w, "path\treplicas")
|
fmt.Fprintln(w, "path\treplicas")
|
||||||
for _, dbConfig := range config.DBs {
|
for _, dbConfig := range config.DBs {
|
||||||
db, err := newDBFromConfig(&config, dbConfig)
|
db, err := newDBFromConfig(&config, dbConfig)
|
||||||
@@ -53,7 +55,6 @@ func (c *DatabasesCommand) Run(ctx context.Context, args []string) (err error) {
|
|||||||
strings.Join(replicaNames, ","),
|
strings.Join(replicaNames, ","),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
w.Flush()
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,9 @@ func (c *GenerationsCommand) Run(ctx context.Context, args []string) (err error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List each generation.
|
// List each generation.
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 8, 2, ' ', 0)
|
||||||
|
defer w.Flush()
|
||||||
|
|
||||||
fmt.Fprintln(w, "name\tgeneration\tlag\tstart\tend")
|
fmt.Fprintln(w, "name\tgeneration\tlag\tstart\tend")
|
||||||
for _, r := range replicas {
|
for _, r := range replicas {
|
||||||
generations, err := r.Generations(ctx)
|
generations, err := r.Generations(ctx)
|
||||||
@@ -101,10 +103,8 @@ func (c *GenerationsCommand) Run(ctx context.Context, args []string) (err error)
|
|||||||
stats.CreatedAt.Format(time.RFC3339),
|
stats.CreatedAt.Format(time.RFC3339),
|
||||||
stats.UpdatedAt.Format(time.RFC3339),
|
stats.UpdatedAt.Format(time.RFC3339),
|
||||||
)
|
)
|
||||||
w.Flush()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.Flush()
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ func (c *SnapshotsCommand) Run(ctx context.Context, args []string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List all snapshots.
|
// List all snapshots.
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 8, 2, ' ', 0)
|
||||||
|
defer w.Flush()
|
||||||
|
|
||||||
fmt.Fprintln(w, "replica\tgeneration\tindex\tsize\tcreated")
|
fmt.Fprintln(w, "replica\tgeneration\tindex\tsize\tcreated")
|
||||||
for _, info := range infos {
|
for _, info := range infos {
|
||||||
fmt.Fprintf(w, "%s\t%s\t%d\t%d\t%s\n",
|
fmt.Fprintf(w, "%s\t%s\t%d\t%d\t%s\n",
|
||||||
@@ -86,7 +88,6 @@ func (c *SnapshotsCommand) Run(ctx context.Context, args []string) (err error) {
|
|||||||
info.CreatedAt.Format(time.RFC3339),
|
info.CreatedAt.Format(time.RFC3339),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
w.Flush()
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,9 @@ func (c *WALCommand) Run(ctx context.Context, args []string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List all WAL files.
|
// List all WAL files.
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 8, 2, ' ', 0)
|
||||||
|
defer w.Flush()
|
||||||
|
|
||||||
fmt.Fprintln(w, "replica\tgeneration\tindex\toffset\tsize\tcreated")
|
fmt.Fprintln(w, "replica\tgeneration\tindex\toffset\tsize\tcreated")
|
||||||
for _, info := range infos {
|
for _, info := range infos {
|
||||||
if *generation != "" && info.Generation != *generation {
|
if *generation != "" && info.Generation != *generation {
|
||||||
@@ -92,7 +94,6 @@ func (c *WALCommand) Run(ctx context.Context, args []string) (err error) {
|
|||||||
info.CreatedAt.Format(time.RFC3339),
|
info.CreatedAt.Format(time.RFC3339),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
w.Flush()
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user