| Crates.io | bun |
| lib.rs | bun |
| version | 0.1.0 |
| created_at | 2020-07-16 19:17:22.158139+00 |
| updated_at | 2020-07-16 19:17:22.158139+00 |
| description | Smart bookmarking tool, running custom commands to open urls from a browser url bar |
| homepage | https://github.com/0x20F/bunny |
| repository | https://github.com/0x20F/bunny |
| max_upload_size | |
| id | 265931 |
| size | 37,388 |
Smart bookmarking tool, running custom commands to open urls from a browser url bar
"Smart bookmarking"? What? I had the same reaction. Imagine it as a very fast, and elegant (if you so wish) way of entering urls into your browser. Instead of writing reddit.com/r/programmerhumor, you could be writing rd r programmerhumor and be redirected to your entertainment of choice a lot easier.
This was inspired by the following article by facebook
The server looks for a file that contains all the bookmarks inside the home directory (~/bookmarks.toml)
bookmarks.toml)The engine is simple, it's all written in a toml format for readability
books, they can have any name you choose, an alias, and a default url:[twitter]
alias = "tw"
default = "https://twitter.com"
book in the file has pages. Each page has a name, a prefix, and a url:[twitter]
alias = "tw"
default = "https://twitter.com"
[twitter.pages]
search = { prefix = "NONE", url = "https://twitter.com/search?q={encoded}" }
profile = { prefix = "@", url = "https://twitter.com/{raw}" }
url can contain special keys that handle the data you pass to the command.Consider the following command: tw rust lang. Here are the keys and what they do with the given data. The prefix gets stripped away and we are left to handle rust lang
{default} - will be replaced with the default url of the book => https://twitter.com{encoded} - will url encode the data => rust%20lang{raw} - will pass in the raw data without encoding it => rust lang{0} - will pass in the first segment of the data => rust{1} - will pass in the second segment of the data => lang
4 total segments at the moment, because it felt like more were just too many. These can be used to create more customised commands, such as, a reddit command:[reddit]
alias = "rd"
default = "https://reddit.com"
[reddit.pages]
whatever = { prefix = "NONE", url = "https://reddit.com/{0}/{1} }
rd r programmerhumor to go to a subreddit or as rd u programmerhumor to go to a userThe url prefix can be whatever you want it to be, it is used to differentiate between each command. You could have -s when searching for something, or full on search if shortcuts aren't your thing.
You dont even need spaces between the prefix and command.
-sheyooo will be split into -s heyooo if the prefix is defined as -s.
There's also one special prefix, NONE, which means the command will not expect a prefix, and encode the url with all the given data.