| 1 | #!/bin/bash |
| 2 | #arch-wiki-docs-search |
| 3 | #requires arch-wiki-docs package |
| 4 | |
| 5 | wiki_title='Archers Guide to Galaxy - DO NOT PANIC!'; |
| 6 | html_docs='/usr/share/doc/arch-wiki/html/'; |
| 7 | |
| 8 | search="harvie"; |
| 9 | search=$(zenity --entry --title="$wiki_title" --text='Enter regular expression to search'); |
| 10 | |
| 11 | file=$( |
| 12 | fgrep -Ri "$search" "$html_docs" | cut -d ':' -f 1 | sort -u | while read file; do |
| 13 | title=$(fgrep -m 1 -i '<title>' "$file" | head -n 1 | cut -d '>' -f 2- | cut -d '<' -f 1); |
| 14 | echo -ne "FALSE\x00$title\x00$file\x00"; |
| 15 | done | xargs -0 zenity --width=800 --height=300 --list --title="$wiki_title" --text='Select page to view' --radiolist --column 'X' --column 'Page' --column 'File' --print-column=3; |
| 16 | ); |
| 17 | |
| 18 | echo retu: $?; |
| 19 | echo file: $file; |
| 20 | |
| 21 | |