-
Notifications
You must be signed in to change notification settings - Fork 2
Allow for easier querying of collected knowledge #58
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I noticed that I started to use pyzet more and more just for grepping for already saved knowledge rather than adding new stuff, and went with design to streamline this kind of usage.
The new proposed behavior is a bit similar to git -p flow and is implemented by pyzet query. It seems to work quite good when you're looking for something you know it's in your ZK, but you don't remember exact details.
I wasn't happy enough with them, so I never merged them to main, and they're in add-query branch. Instead, I'll create a PR as main has newer commits at this point, and rebase would be painful.
Demo of currently proposed behavior:
$ pyzet query
Hello there! What's next? [p,e,d,g,G,a,q,?] ?
p - print one of matching notes
e - edit one of matching notes
d - delete one of matching notes
g - grep for other notes
G - grep for other notes (case insensitive)
a - add a new note
q - quit
? - print help
---------------------------
current ID: None
patterns: None
What's next? [p,e,d,g,G,a,q,?] G
Grep patterns: python vim
Found 4 matches
What's next? [p,e,d,g,G,a,q,?] p
[1] 20220416171827 -- Bash export function instead of alias
[2] 20220420213126 -- Protips from Anthony Sottile (mainly Bash)
[3] 20221002210444 -- Folding in Vim
[4] 20230213230637 -- Ctags setup with Vim
Open (press enter to cancel): 1
============================ 20220416171827 ============================
# Bash export function instead of alias
Aliases are great but they don't work in subshells and external programs
like Vim. An alternative to alias is a Bash export function.
It's just a plain function that we later export with `export -f <name>`
command:
function foo () {
<some-command> "$@"
}
export -f foo
Tags:
#tips #bash #terminal #config #cli
========================================================================
What's next? [p,e,d,g,G,a,q,?] ?
p - print current note
e - edit current note
d - delete current note
g - grep for other notes
G - grep for other notes (case insensitive)
a - add a new note
q - quit
? - print help
---------------------------
current ID: 20220416171827
patterns: ['python', 'vim']
What's next? [p,e,d,g,G,a,q,?] e
<...here your editor is opened...>
20220416171827 wasn't modified
What's next? [p,e,d,g,G,a,q,?] q
Bye!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request