-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6213043
Showing
6 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Adam Christiansen | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Plecostomus | ||
|
||
A simple command history filter for the | ||
[fish shell](https://github.com/fish-shell/fish-shell). | ||
|
||
## Features | ||
|
||
- Use regex filters to prevent commands from being saved in the command | ||
history. | ||
- Out of the box, commands that begin with one or more spaces are ignored. | ||
- That's it - nothing else! | ||
|
||
## Requirements | ||
|
||
* [fish](https://github.com/fish-shell/fish-shell) (3.0.0 or higher) | ||
|
||
## Installation | ||
|
||
### Using [Fisher](https://github.com/jorgebucaran/fisher) | ||
|
||
```sh | ||
fisher install adamchristiansen/plecostomus | ||
``` | ||
|
||
## Configuration | ||
|
||
Filters can be added by modifying the `plecostomus_regex_patterns` universal | ||
variable, which is an array of regex patterns to ignore. By default it is | ||
|
||
```sh | ||
set -U plecostomus_regex_patterns '^ +' | ||
``` | ||
|
||
## Alternatives | ||
|
||
This plugin is simple by design, and supports only regex filtering. It is | ||
simple and fast. If more features are needed, consider using: | ||
|
||
- [Sponge](https://github.com/meaningful-ooo/sponge) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
set -g plecostomus_version 1.0.0 | ||
|
||
# The default ignore patterns | ||
if not set -qU plecostomus_regex_patterns | ||
set -U plecostomus_regex_patterns '^ +' | ||
end | ||
|
||
# Load the handlers | ||
functions --query __plecostomus_preexec __plecostomus_postexec | ||
|
||
function __plecostomus_install --on-event plecostomus_install | ||
set -g __plecostomus_command '' | ||
end | ||
|
||
function __plecostomus_update --on-event plecostomus_update | ||
# Nothing to do | ||
end | ||
|
||
function __plecostomus_uninstall --on-event plecostomus_uninstall | ||
set -eU plecostomus_regex_patterns | ||
set -eg __plecostomus_command | ||
set -eg plecostomus_version | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function __plecostomus_postexec --on-event fish_postexec | ||
for pattern in $plecostomus_regex_patterns | ||
if builtin string match -rq -- $pattern $__plecostomus_command | ||
builtin history delete --case-sensitive --exact -- $__plecostomus_command | ||
break | ||
end | ||
end | ||
builtin history save | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function __plecostomus_preexec -e fish_preexec -a command | ||
set -g __plecostomus_command $command | ||
end |