mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
Show history timestamps on seperate lines #-prefixed.
Improves the grouping of multiline history entries by sepearating the timestamps and history entires onto seperate lines. Use wcsftime() Saves us a conversion, might as well.
This commit is contained in:
parent
4f596536f5
commit
6936e64b34
2 changed files with 4 additions and 4 deletions
|
@ -34,7 +34,7 @@ The following options are available:
|
|||
|
||||
- `-p` or `--prefix` searches or deletes items in the history that begin with the specified text string. This is not currently supported by the `--delete` flag.
|
||||
|
||||
- `-t` or `--with-time` prefixes the output of each displayed history entry with the time it was recorded in the format "%Y-%m-%d %H:%M:%S" in your local timezone.
|
||||
- `-t` or `--with-time` outputs the date and time history items were recorded at before each history entry, formatted for the configured locale. See environ(7) for more information.
|
||||
|
||||
\subsection history-examples Example
|
||||
|
||||
|
|
|
@ -1402,9 +1402,9 @@ static bool format_history_record(const history_item_t &item, const bool with_ti
|
|||
const time_t seconds = item.timestamp();
|
||||
struct tm timestamp;
|
||||
if (!localtime_r(&seconds, ×tamp)) return false;
|
||||
char timestamp_string[22];
|
||||
if (strftime(timestamp_string, 22, "%Y-%m-%d %H:%M:%S ", ×tamp) != 21) return false;
|
||||
streams.out.append(str2wcstring(timestamp_string));
|
||||
wchar_t timestamp_string[64];
|
||||
if (std::wcsftime(timestamp_string, 63, L"# %c:\n", ×tamp) == 0) return false;
|
||||
streams.out.append(timestamp_string);
|
||||
}
|
||||
streams.out.append(item.str());
|
||||
streams.out.append(L"\n");
|
||||
|
|
Loading…
Reference in a new issue