feat: ghistory/lhistory — session highlighting, time range and glob filtering - #124
Merged
Conversation
Add filtering and highlighting to ghistory and lhistory: - Current-session entries highlighted bold green in ghistory output - -n N : show last N entries (default 20 for ghistory, all for lhistory) - -s SID : filter by session ID (ghistory only) - -g PATTERN: glob filter on command name (fnmatch, case-insensitive) - --since T : entries after timestamp T - --until T : entries before timestamp T - --today : entries from today midnight T formats: today, Nm, Nh, Nd, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS Implementation details: - HistDisplayOpts struct passed to history_log_display() for all filters - cmdline_split() helper parses data.CLIcmdline directly (double/single quote aware) because the calc parser mangles dash-flag arguments - CLIcore_UI.c: dash-prefixed args after a COMMAND token are stored as RAWSTRING (bypassing the arithmetic parser) to prevent parseerror=1 from blocking the command function from being called - cmdline_free() called after history_log_display() to avoid use-after- free on opts.glob_cmd and opts.filter_session pointers"
oguyon
added a commit
that referenced
this pull request
May 21, 2026
…124) Add filtering and highlighting to ghistory and lhistory: - Current-session entries highlighted bold green in ghistory output - -n N : show last N entries (default 20 for ghistory, all for lhistory) - -s SID : filter by session ID (ghistory only) - -g PATTERN: glob filter on command name (fnmatch, case-insensitive) - --since T : entries after timestamp T - --until T : entries before timestamp T - --today : entries from today midnight T formats: today, Nm, Nh, Nd, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS Implementation details: - HistDisplayOpts struct passed to history_log_display() for all filters - cmdline_split() helper parses data.CLIcmdline directly (double/single quote aware) because the calc parser mangles dash-flag arguments - CLIcore_UI.c: dash-prefixed args after a COMMAND token are stored as RAWSTRING (bypassing the arithmetic parser) to prevent parseerror=1 from blocking the command function from being called - cmdline_free() called after history_log_display() to avoid use-after- free on opts.glob_cmd and opts.filter_session pointers"
oguyon
added a commit
that referenced
this pull request
May 21, 2026
…124) Add filtering and highlighting to ghistory and lhistory: - Current-session entries highlighted bold green in ghistory output - -n N : show last N entries (default 20 for ghistory, all for lhistory) - -s SID : filter by session ID (ghistory only) - -g PATTERN: glob filter on command name (fnmatch, case-insensitive) - --since T : entries after timestamp T - --until T : entries before timestamp T - --today : entries from today midnight T formats: today, Nm, Nh, Nd, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS Implementation details: - HistDisplayOpts struct passed to history_log_display() for all filters - cmdline_split() helper parses data.CLIcmdline directly (double/single quote aware) because the calc parser mangles dash-flag arguments - CLIcore_UI.c: dash-prefixed args after a COMMAND token are stored as RAWSTRING (bypassing the arithmetic parser) to prevent parseerror=1 from blocking the command function from being called - cmdline_free() called after history_log_display() to avoid use-after- free on opts.glob_cmd and opts.filter_session pointers"
oguyon
added a commit
that referenced
this pull request
May 22, 2026
…124) Add filtering and highlighting to ghistory and lhistory: - Current-session entries highlighted bold green in ghistory output - -n N : show last N entries (default 20 for ghistory, all for lhistory) - -s SID : filter by session ID (ghistory only) - -g PATTERN: glob filter on command name (fnmatch, case-insensitive) - --since T : entries after timestamp T - --until T : entries before timestamp T - --today : entries from today midnight T formats: today, Nm, Nh, Nd, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS Implementation details: - HistDisplayOpts struct passed to history_log_display() for all filters - cmdline_split() helper parses data.CLIcmdline directly (double/single quote aware) because the calc parser mangles dash-flag arguments - CLIcore_UI.c: dash-prefixed args after a COMMAND token are stored as RAWSTRING (bypassing the arithmetic parser) to prevent parseerror=1 from blocking the command function from being called - cmdline_free() called after history_log_display() to avoid use-after- free on opts.glob_cmd and opts.filter_session pointers"
DasVinch
pushed a commit
that referenced
this pull request
May 29, 2026
…124) Add filtering and highlighting to ghistory and lhistory: - Current-session entries highlighted bold green in ghistory output - -n N : show last N entries (default 20 for ghistory, all for lhistory) - -s SID : filter by session ID (ghistory only) - -g PATTERN: glob filter on command name (fnmatch, case-insensitive) - --since T : entries after timestamp T - --until T : entries before timestamp T - --today : entries from today midnight T formats: today, Nm, Nh, Nd, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS Implementation details: - HistDisplayOpts struct passed to history_log_display() for all filters - cmdline_split() helper parses data.CLIcmdline directly (double/single quote aware) because the calc parser mangles dash-flag arguments - CLIcore_UI.c: dash-prefixed args after a COMMAND token are stored as RAWSTRING (bypassing the arithmetic parser) to prevent parseerror=1 from blocking the command function from being called - cmdline_free() called after history_log_display() to avoid use-after- free on opts.glob_cmd and opts.filter_session pointers"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prompt Summary
User requested that
ghistorycommand output highlight entries from the current session, and that bothghistoryandlhistorygain new options for time range filtering and glob filtering on command names.Changes
Enhances the
ghistoryandlhistoryCLI commands with the following new capabilities:New options
ghistorylhistoryNor-n N-s SID-g "PATTERN"fnmatch, case-insensitive)--since T--until T--todayTime format
T:today,15m,2h,3d,YYYY-MM-DD,YYYY-MM-DDTHH:MM:SSSession highlighting
ghistorynow displays current-session entries in bold green; other sessions are shown in normal colour.Implementation notes
CLIcore_UI_history.c:HistDisplayOptsstruct carries all filter/display options tohistory_log_display()parse_time_arg()helper for flexible time parsing (relative and absolute formats)cmdline_split()/cmdline_free()helpers parsedata.CLIcmdlinedirectly (single/double-quote aware), bypassing the calc parser which mangles dash-prefixed flagsCLIcore_UI.c:-, it is now stored asCMDARGTOKEN_TYPE_RAWSTRINGrather than being processed by the arithmetic expression parser. Without this, flags like-n,-g,--sincesetdata.parseerror = 1, which silently prevents the command function from ever being called.AI Authorship