Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add history dir [path] to show the history for the current directory #5287

Open
anki-code opened this issue Feb 23, 2024 · 1 comment
Open
Labels

Comments

@anki-code
Copy link
Member

Example:

cd ~
echo 1
echo 2
cd /tmp
echo 3
echo 4

cd ~
history dir
# echo 1
# echo 2
history dir /tmp
# echo 3
# echo 4

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

@anki-code
Copy link
Member Author

anki-code commented Feb 23, 2024

Workaround for sqlite history backend:

aliases |= {
    # history search
    'hs': """sqlite3 $XONSH_HISTORY_FILE @("SELECT inp FROM xonsh_history WHERE inp LIKE '%" + $arg0 + "%' AND inp NOT LIKE 'hs %' ORDER BY tsb DESC LIMIT 10");""",
    # history in dir
    'hd': """sqlite3 $XONSH_HISTORY_FILE @(f"SELECT inp FROM xonsh_history WHERE cwd LIKE '%{$PWD}%' AND inp NOT LIKE 'hd %' ORDER BY tsb DESC LIMIT 10");""",
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant