mirror of
https://codeberg.org/scip/ts.git
synced 2025-12-17 20:41:03 +01:00
fix linting errs
This commit is contained in:
@@ -18,18 +18,17 @@ const (
|
|||||||
Usage string = `This is ts, a timestamp tool.
|
Usage string = `This is ts, a timestamp tool.
|
||||||
|
|
||||||
Usage: ts <time string> [<time string>]
|
Usage: ts <time string> [<time string>]
|
||||||
-d --diff Calculate difference between two timestamps (default).
|
-d --diff Calculate difference between two timestamps (default)
|
||||||
-a --add Add two timestamps (second parameter must be a time).
|
-a --add Add two timestamps (second parameter must be a time)
|
||||||
-f --format For diffs: duration, hour, min, sec, msec.
|
-f --format For diffs: duration, hour, min, sec, msec
|
||||||
For timestamps: datetime, rfc3339, date, time, unix, string.
|
For timestamps: datetime, rfc3339, date, time, unix, string
|
||||||
string is a strftime(1) format string. datetime is
|
string is a strftime(1) format string. datetime is
|
||||||
the default.
|
the default
|
||||||
-u --unit Add unit to the output of timestamp diffs.
|
-u --unit Add unit to the output of timestamp diffs
|
||||||
--debug Show debugging output.
|
--debug Show debugging output
|
||||||
-v --version Show program version.
|
-v --version Show program version
|
||||||
-h --help Show this help screen.
|
-h --help Show this help screen
|
||||||
-e --examples Show examples or supported inputs.
|
-e --examples Show examples or supported inputs`
|
||||||
`
|
|
||||||
|
|
||||||
Examples string = `Example timestamp inputs:
|
Examples string = `Example timestamp inputs:
|
||||||
now 10:25:30 Last sunday at 5:30pm 2 weeks ago
|
now 10:25:30 Last sunday at 5:30pm 2 weeks ago
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ func Main(output io.Writer) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if conf.Examples {
|
if conf.Examples {
|
||||||
fmt.Fprintln(output, Examples)
|
_, err := fmt.Fprintln(output, Examples)
|
||||||
|
if err != nil {
|
||||||
|
Die(err)
|
||||||
|
}
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,9 +65,7 @@ func (tp *TimestampProccessor) Parse(timestamp string) (time.Time, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now failed, try module dateparse
|
// now failed, try module dateparse
|
||||||
ts, err = dateparse.ParseAny(timestamp)
|
return dateparse.ParseAny(timestamp)
|
||||||
|
|
||||||
return ts, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tp *TimestampProccessor) Calc(timestampA, timestampB string) error {
|
func (tp *TimestampProccessor) Calc(timestampA, timestampB string) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user