Skip to content

Commit

Permalink
Merge pull request #31 from hathora/tail-line-update
Browse files Browse the repository at this point in the history
Updating tail lines text, and required flags
  • Loading branch information
tarunipaleru committed Jun 17, 2024
2 parents 179c255 + b0411f8 commit c93e586
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/commands/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package commands

import (
"context"
"errors"
"fmt"
"os"

Expand Down Expand Up @@ -95,7 +96,7 @@ var (
cli.EnvVar(buildFlagEnvVar("TAIL_LINES")),
altsrc.ConfigFile(configFlag.Name, "log.tail-lines"),
),
Usage: "`<number>` of lines to return from the most recent log history",
Usage: "`<number>` of lines to return from the most recent log history (1-5000)",
Value: 100,
Category: "Log:",
Persistent: true,
Expand Down Expand Up @@ -161,5 +162,12 @@ func ProcessLogConfigFrom(cmd *cli.Command) (*ProcessLogConfig, error) {
}

func (c *ProcessLogConfig) Validate() error {
return requireIntInRange(c.TailLines, minTailLines, maxTailLines, tailLinesFlag.Name)
var err error
err = errors.Join(err, requireIntInRange(c.TailLines, minTailLines, maxTailLines, tailLinesFlag.Name))

if c.ProcessID == "" {
err = errors.Join(err, missingRequiredFlag(processIDFlag.Name))
}

return err
}

0 comments on commit c93e586

Please sign in to comment.