Skip to content

Commit

Permalink
1.3; fix help a bit and update readme, installer
Browse files Browse the repository at this point in the history
  • Loading branch information
Sqaaakoi committed Jan 27, 2023
1 parent ceefec5 commit 9b583cd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

# Installation
Run `./install.sh`
Installs to ~/.local/bin/localhistory.sh

# Why?
Shell histories can get cluttered easily, and this helps by letting you automatically switch to history files in the current project that you are working on.

# Features
- Automatically detects a `.local_bash_history` file in your current directory and switches to it
- Saves history automatically
- `lht` tool to manage the local history files
- Can display status in prompt
- `lht` tool to manage the local history files

# License
MIT
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cp localhistory.sh ~/.local/bin/localhistory.sh
chmod +x ~/.local/bin/localhistory.sh
# Do not inject into .bashrc twice; checked by if variables set by the script are set
if [ -z "$__LOCALHISTORY_FILENAME" ]; then
echo "Updating .bashrc"
echo -e "\n~/.local/bin/localhistory.sh --prompt-command" >> ~/.bashrc
fi
. localhistory.sh
Expand Down
8 changes: 4 additions & 4 deletions localhistory.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Local history for Bash
# Version 1.2
# Version 1.3
# Use `lht help` for help and more information

# Copyright (c) 2023 Sqaaakoi
Expand Down Expand Up @@ -180,7 +180,7 @@ lht() {
fi
if [ "$1" = "help" ]; then
echo -e "\033[96mlht: Local History Tool\033[00m"
echo -e "\033[36mVersion 1.2\033[00m"
echo -e "\033[36mVersion 1.3\033[00m"
echo -e ""
echo -e "\033[94mRequired arguments are displayed as \033[32m[required]\033[00m"
echo -e "\033[94mOptional / multi-choice arguments are displayed as \033[32m(option|alternate-option)\033[00m"
Expand All @@ -199,9 +199,9 @@ lht() {
echo -e "\033[36mlht off\033[00m"
echo -e "\033[37m - Disables local history for this session\033[00m"
echo -e "\033[36mlht create \033[32m(git|gitlocal)\033[00m"
echo -e "\033[37m - Creates a local history file and optionally adds it to .gitignore (git) or .git/info/exclude (gitlocal)\033[00m"
echo -e "\033[37m - Creates a local history file and optionally adds it to .gitignore \033[32m(git)\033[37m or .git/info/exclude \033[32m(gitlocal)\033[00m"
echo -e "\033[36mlht prompt_status \033[32m[active] [inactive] [disabled] [path_prefix] [path_suffix]\033[00m"
echo -e "\033[37m - Shows [active] if enabled and active, [inactive] if local history is enabled and inactive, [disabled] if local history is disabled, and the new history file path surrounded by [path_prefix] and [path_suffix] if active and recently updated\033[00m"
echo -e "\033[37m - Shows \033[32m[active]\033[37m if enabled and active, \033[32m[inactive]\033[37m if local history is enabled and inactive, \033[32m[disabled]\033[37m if local history is disabled, and the new history file path surrounded by \033[32m[path_prefix]\033[37m and \033[32m[path_suffix]\033[37m if active and recently updated\033[00m"
echo -e "\033[36mlht help\033[00m"
echo -e "\033[36mlht --help\033[00m"
echo -e "\033[37m - Shows this help message\033[00m"
Expand Down

0 comments on commit 9b583cd

Please sign in to comment.