spamwax / alfred-pinboard-rs

Alfred Workflow for Pinboard (Rust)
Other
278 stars 13 forks source link

Feature Request: Support for adding title when adding a bookmark #60

Open byalextran opened 4 years ago

byalextran commented 4 years ago

When adding a bookmark, you can add a description using a semicolon (e.g. p tag1 tag2 ; description).

I'd love the ability to also add a custom title as opposed to what the title of the page is. Perhaps with a colon?

spamwax commented 4 years ago

Sounds reasonable, but due to time constraints I can't work on it at the moment, but PRs are welcome.

byalextran commented 4 years ago

i've never done anything in rust or with alfred workflows before, however, i'm open to tinkering around. since i'm not familiar with the codebase, it'd be helpful if you gave me a high-level overview of what changes need to be made (and where) to implement this.

granted, i could probably figure it out by looking around ... however, i'm thinking you could probably save me quite a bit of time with just a few minutes of yours.

spamwax commented 4 years ago

Great! The main executable does its job by running different sub-commands (src/commands/*). The one that deals with parsing what user entered after p is src/commands/list.rs

; is a special character that splits the user input into list of tags and description. Then list.rs searches cached list of tags for the last word user has entered. When user hits enter, an alfred Item that contains all of the tags is sent to next step in Workflow.

For this to work, we need to first decide how the user can ask for a custom title (something along the lines you suggested above) and do proper parsing. Then if a title is provided, we can add a new variable(title) around line 143 in list.rs

Additionally src/commands/post sub-command should change to receive a title argument. Within post.rs if title is set then instead of using browser title, we use the supplied title.

The cli.rs lets you change what optional arguments each subcommand currently accepts. Look at the Post struct

If these are done correctly, then changing the Alfred workflow itself will be very easy.

byalextran commented 4 years ago

awesome, super helpful. no promises, but this feature would be extremely useful to me. so i've got motivation to get it working. 😀

spamwax commented 4 years ago

Just curious, what's your use case that having custom title is helpful

byalextran commented 4 years ago

not all page titles are descriptive enough or contain the keywords i would instinctively use to search for that bookmark. so being able to specify a custom title ensures it's accurate and searchable for me.

also, i like having my titles formatted a specific way (which includes removing a lot of cruft).

spamwax commented 4 years ago

I see. I typically do that "organization" either in tags or description of the bookmark. Most of the time my pset tagonly is set to "tag only search"

byalextran commented 4 years ago

i just recently decided to use pinboard as my bookmark repo instead of chrome. so right now trying to figure out the system that works best for my needs.

i'll most likely end up using the description/tags for part of my organization. but would still like the efficiency of customizing the title in alfred without having to save the bookmark and then edit the title in pinboard.

you know us alfred users, we're all about that efficiency. 😝

spamwax commented 4 years ago

😃