Add verbose flag for the status subcommand

This commit is contained in:
David Dworken 2022-04-16 10:46:57 -07:00
parent 2b676a935b
commit def83d6b0e
2 changed files with 15 additions and 11 deletions

View File

@ -709,13 +709,17 @@ func TestDisplayTable(t *testing.T) {
userSecret := installHishtory(t, "")
// Submit two fake entries
tmz, err := time.LoadLocation("America/Los_Angeles")
if err != nil {
t.Fatalf("failed to load timezone: %v", err)
}
entry1 := data.MakeFakeHistoryEntry("table_cmd1")
entry1.StartTime = time.Unix(1650096186, 0)
entry1.EndTime = time.Unix(1650096190, 0)
entry1.StartTime = time.Unix(1650096186, 0).In(tmz)
entry1.EndTime = time.Unix(1650096190, 0).In(tmz)
manuallySubmitHistoryEntry(t, userSecret, entry1)
entry2 := data.MakeFakeHistoryEntry("table_cmd2")
entry2.StartTime = time.Unix(1650096196, 0)
entry2.EndTime = time.Unix(1650096220, 0)
entry2.StartTime = time.Unix(1650096196, 0).In(tmz)
entry2.EndTime = time.Unix(1650096220, 0).In(tmz)
entry2.CurrentWorkingDirectory = "~/foo/"
entry2.ExitCode = 3
manuallySubmitHistoryEntry(t, userSecret, entry2)

View File

@ -44,13 +44,13 @@ func main() {
case "status":
config, err := lib.GetConfig()
lib.CheckFatalError(err)
fmt.Print("Hishtory: v0." + Version + "\nEnabled: ")
fmt.Print(config.IsEnabled)
fmt.Print("\nSecret Key: ")
fmt.Print(config.UserSecret)
fmt.Print("\nCommit Hash: ")
fmt.Print(GitCommit)
fmt.Print("\n")
fmt.Printf("Hishtory: v0.%s\nEnabled: %v\n", Version, config.IsEnabled)
fmt.Printf("Secret Key: %s\n", config.UserSecret)
if len(os.Args) == 3 && os.Args[2] == "-v" {
fmt.Printf("User ID: %s\n", data.UserId(config.UserSecret))
fmt.Printf("Device ID: %s\n", config.DeviceId)
}
fmt.Printf("Commit Hash: %s\n", GitCommit)
case "update":
lib.CheckFatalError(lib.Update("https://api.hishtory.dev/download/hishtory-linux-amd64"))
default: