trengrj / recent

log bash history to an sqlite database
MIT License
53 stars 2 forks source link

Prompt regex #4

Open donaldmunro opened 7 years ago

donaldmunro commented 7 years ago

I had a problem parsing the command line in parse_history despite setting and double checking the PROMPT_COMMAND to the specified value as I wasn't getting a leading space before the pid eg:

93418 vim /usr/lib/python3.6/site-packages/recent.py None recent: cannot parse command output, please check your bash trigger looks like this: export PROMPT_COMMAND='log-recent -r $? -c "$(HISTTIMEFORMAT= history 1)" -p $$' Changing the regex in parse_history to r'^\s*(\d+)\s+(.*)$' ie allowing zero or more whitespace before the command start, fixed it.

trengrj commented 7 years ago

Thanks @donaldmunro I'll add this as a fix