Created
August 2, 2021 06:51
-
-
Save RyanGreenup/cb87a261f75099e4bc94ee4cbc2e4670 to your computer and use it in GitHub Desktop.
If yuu're running a local mediawiki, this will fzf over the filenames and offer a text preview before opening the page in the browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SERVER_DIR="/srv/http/" | |
DB="${SERVER_DIR}/mediawiki/data/my_wiki.sqlite" | |
IP="localhost" | |
PORT="80" | |
page_name="$(sqlite3 "${DB}" 'SELECT page_title FROM page;' | sk --ansi --preview "sqlite3 "${DB}" 'SELECT old_text FROM text WHERE old_id is ( SELECT content_id FROM content where content_sha1 is ( SELECT rev_sha1 FROM revision WHERE rev_id is ( SELECT page_latest FROM page WHERE page_title is \"{}\")));' | bat --color=always -l org")" | |
firefox "http://${IP}:${PORT}/mediawiki/index.php/${page_name}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment