jarun / buku

:bookmark: Personal mini-web in text
GNU General Public License v3.0
6.52k stars 294 forks source link

preview CLI switch #688

Closed carpii closed 1 year ago

carpii commented 1 year ago

I'm exploring the idea of writing a TUI interface to buku (I find the CLI a little cumbersome, but also dont want to use a web UI)

Could you please consider a feature which allows buku to retrieve a url plus meta, without adding it to the database?

For example, typical CLI usage retrieves metadata but also adds to database...

$ buku -a https://github.com/jarun/buku#running-standalone

1036. GitHub - jarun/buku: Personal mini-web in text
   > https://github.com/jarun/buku#running-standalone
   + :bookmark: Personal mini-web in text. Contribute to jarun/buku development by creating an account on GitHub.

Instead it could just retrieve (-r) the url, scrape the meta and then output to stdout (-j would produce JSON output)

$ buku -r -j https://github.com/jarun/buku#running-standalone

{
    "title": "GitHub - jarun/buku: Personal mini-web in text",
    "url": "https://github.com/jarun/buku#running-standalone",
    "brief": "Personal mini-web in text. Contribute to jarun/buku development by creating an account on GitHub."
}

This would assist hugely in producing a terminal based UI

LeXofLeviafan commented 1 year ago

If you implement your UI in Python (which is honestly the best option for a Python-based library), there's already such a command (just not exposed as a CLI tool).

If you don't want to write it in Python, here's a workaround that works already on current release version:

$ python -c 'import sys, json, buku;  print(json.dumps( buku.network_handler(sys.argv[1]) ))' "https://ddg.gg"
["DuckDuckGo \u2014 Privacy, simplified.", "The Internet privacy company that empowers you to seamlessly take control of your personal information online, without any tradeoffs.", null, 0, 0]
carpii commented 1 year ago

Thanks a lot for the workaround.

I agree python would be a natural choice, but I was planning on writing a golang TUI wrapper around the CLI, as I want it to integrate into an existing go app.