mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-22 21:41:01 +01: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"
|
||||
)
|
||||
|
||||
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{
|
||||
Use: "saveHistoryEntry",
|
||||
Hidden: true,
|
||||
@ -293,11 +302,6 @@ func deletePresavedEntries(ctx context.Context, entry *data.HistoryEntry, isRetr
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(saveHistoryEntryCmd)
|
||||
rootCmd.AddCommand(presaveHistoryEntryCmd)
|
||||
}
|
||||
|
||||
func handleDumpRequests(ctx context.Context, dumpRequests []*shared.DumpRequest) error {
|
||||
db := hctx.GetDb(ctx)
|
||||
config := hctx.GetConf(ctx)
|
||||
@ -636,3 +640,9 @@ func getCwdWithoutSubstitution() (string, error) {
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(saveHistoryEntryCmd)
|
||||
rootCmd.AddCommand(presaveHistoryEntryCmd)
|
||||
rootCmd.AddCommand(getTimestampCmd)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user