mirror of
https://codeberg.org/scip/ts.git
synced 2025-12-17 12:31:06 +01:00
add default datetime format, fix default format usage
This commit is contained in:
@@ -31,7 +31,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VERSIONstring = "0.0.3"
|
VERSIONstring = "0.0.4"
|
||||||
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>]
|
||||||
@@ -76,8 +76,11 @@ noon Yesterday at 10:15am Mon, 02 Jan 2006 15:
|
|||||||
Example durations for second parameter:
|
Example durations for second parameter:
|
||||||
2d1h30m 2 days, one and a half hour
|
2d1h30m 2 days, one and a half hour
|
||||||
30m 30 minutes`
|
30m 30 minutes`
|
||||||
|
|
||||||
ModeDiff int = iota
|
ModeDiff int = iota
|
||||||
ModeAdd
|
ModeAdd
|
||||||
|
|
||||||
|
DefaultFormat string = "Mon Jan 02 15:04:05 MST"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|||||||
@@ -105,7 +105,8 @@ func (tp *TimestampProccessor) SingleTimestamp(timestamp string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
tp.Print(ts)
|
tp.Print(TPdatetime{TimestampProccessor: *tp, Data: ts})
|
||||||
|
//tp.Print(ts)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ func (datetime TPdatetime) String() string {
|
|||||||
case "datetime":
|
case "datetime":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "":
|
case "":
|
||||||
return datetime.Data.String()
|
return datetime.Data.Format(DefaultFormat)
|
||||||
default:
|
default:
|
||||||
return datetime.Data.Format(datetime.Format)
|
return datetime.Data.Format(datetime.Format)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user