mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-19 19:37:59 +02:00
Add getTimestamp command as an internal command that will be used as an alternative to date since date on MacOS doesn't support nanosecond granularity
This commit is contained in:
parent
8690d87a16
commit
d8b83b9429
@ -24,6 +24,15 @@ import (
|
|||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var getTimestampCmd = &cobra.Command{
|
||||||
|
Use: "getTimestamp",
|
||||||
|
Hidden: true,
|
||||||
|
Short: "[Internal-only] Returns a timestamp in Unix nanoseconds",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
fmt.Println(time.Now().UnixNano())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
var saveHistoryEntryCmd = &cobra.Command{
|
var saveHistoryEntryCmd = &cobra.Command{
|
||||||
Use: "saveHistoryEntry",
|
Use: "saveHistoryEntry",
|
||||||
Hidden: true,
|
Hidden: true,
|
||||||
@ -293,11 +302,6 @@ func deletePresavedEntries(ctx context.Context, entry *data.HistoryEntry, isRetr
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
|
||||||
rootCmd.AddCommand(saveHistoryEntryCmd)
|
|
||||||
rootCmd.AddCommand(presaveHistoryEntryCmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleDumpRequests(ctx context.Context, dumpRequests []*shared.DumpRequest) error {
|
func handleDumpRequests(ctx context.Context, dumpRequests []*shared.DumpRequest) error {
|
||||||
db := hctx.GetDb(ctx)
|
db := hctx.GetDb(ctx)
|
||||||
config := hctx.GetConf(ctx)
|
config := hctx.GetConf(ctx)
|
||||||
@ -636,3 +640,9 @@ func getCwdWithoutSubstitution() (string, error) {
|
|||||||
}
|
}
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(saveHistoryEntryCmd)
|
||||||
|
rootCmd.AddCommand(presaveHistoryEntryCmd)
|
||||||
|
rootCmd.AddCommand(getTimestampCmd)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user