Skip to content

Instantly share code, notes, and snippets.

@knaveightt
Last active February 28, 2023 22:17
Show Gist options
  • Save knaveightt/603229a9e8b971c222292d9091b82581 to your computer and use it in GitHub Desktop.
Save knaveightt/603229a9e8b971c222292d9091b82581 to your computer and use it in GitHub Desktop.
Quick Specification for a Python/Bash based Bookmark Management System
// Quick and dirty specification for my bookmarks system using python/bash scripts to manage bookmarks of differnet types
// scripts/files to be used
// $HOME/.config/kcbookmarks/kcbookmarkrc
// $HOME/.local/share/kcbookmarks/bookmarks.yaml
// $HOME/.local/share/kcbookmarks/kcbookmarks.py
// $HOME/.local/bin/kc-bookmark-get-quick
// $HOME/.local/bin/kc-bookmark-get-menu
// $HOME/.local/bin/kc-bookmark-add-menu
// bookmarks will be in a text file named bookmarks.yaml
lastUpdate: {date}
bookmarks:
- id: {integer:incremental,unique}
name: {string:unique}
category: {"URL","File"}
location: {string}
tags:
- {string}
- {string}
notes: |
{string}
lastUpdate: 2023-02-28
bookmarks:
- id: 1
name: Github
category: URL
location: https://github.com/
tags:
- development
- version control
- code
notes: |
All my repositories are here.
// kcbookmarks.py script will allow the functions below
// output functions - these all assume the return list will be piped into a fuzzy finder like fzf for searching and selection
o1) Return Simple List
"Return <name>{tab}<location> for each item"
o2) Return Bookmarks by Tag
"First return list of unique <tag>, then upon <tag> selection, return <name>{tab}<location> for objects containing that tag"
o2a) Return Bookmark Tags will need to be a function to support this
o3) Return URL Bookmarks
"Return <name>{tab}<location> for each item that has "URL" as the category"
o4) Return File Bookmarks
"Return <name>{tab}<location> for each item that has "File" as the category"
o5) Dump Bookmarks
"Returns each book mark object as Tab-delimited with the following format below"
<name>{tab}<category>{tab}<location>{tab}[TAG:<tag>{tab}]<notes>
o6) Return Bookmark Keys
"Returns <id>:<name>{tab}<location> for each bookmark"
// input functions
i1) Simple Insert
"Automatically takes the following arguments to create the tag"
<name> <category> <location>
i2) Add Tags by id
"Automatically adds tags to the given bookmark following this format"
<id> [<tag>] [<tag>] [<tag>]...
i3) Add Tags by name
"Automatically adds tags to the given bookmark following this format"
<name> [<tag> ]...
i4) Add notes by id
"Automatically appends text to the notes element of a given bookmark following this format"
<id> ^<note>
i5) Add notes by name
"Automatically appends text to the notes element of a given bookmark following this format"
<name> ^<note>
i6) Merge bookmark files
"Attempts to merge two files following the defined yaml format"
// wrapper bash scripts
// using fzf for selections and such, I will write bash scripts that allows for copying the bookmark location to the clip board and adding more bokomarks
// note: use a kcbookmarkrc file to store the path to the bookmarks file.
// Always ingest this path when the below scripts are running.
// Always assuming that bookmarks.yaml is the file being used in this path
// kc-bookmark-get-quick - this will quickly get a list of bookmarks for copying to clip board
// >>> will utilize (i1) above
// kc-bookmark-get-menu - will be able to chose from the following
// "Seach Bookmarks by Tag"
// >>> will use (o2) and (o2a)
// "Search URL Bookmarks Only"
// >>> will use (o3)
// "Search File Bookmarks Only"
// >>> will use (o4)
// "Full Bookmark Search"
// >>> will use (o5)
// kc-bookmark-add-menu - will be able to chose from the following
// "Add New Bookmark"
// >>> will use (i1)
// "Add Tags to Bookmark"
// >>> will use (o6) and (i2)
// "Add Notes to Bookmark"
// >>> will use (o6) and (i4)
// "Merge Bookmarks Files"
// >>> will use (i6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment