commit d6b6f5b5401491ea46bebc3a7a4a424c8ff31509
parent 7d38bb6b5e61de4fe6ada75ce940d36a897f8cc3
Author: parazyd <parazyd@dyne.org>
Date: Tue, 29 Dec 2015 15:55:01 +0100
index function
Diffstat:
M | gtomb | | | 27 | +++++++++++++++++++++++++++ |
1 file changed, 27 insertions(+), 0 deletions(-)
diff --git a/gtomb b/gtomb
@@ -340,6 +340,8 @@ function _main {
"forge" "Forge a new key used to lock tombs" \
"lock" "Lock a non-locked tomb using an existing key" \
"open" "Open an existing tomb" \
+ "index" "Index the contents of all tombs." \
+ "search" "Search the content of indexed tombs." \
"list" "List all open tombs and information on them" \
"close" "Close a specific tomb (or all)" \
"slam" "Slam a tomb (or all) killing all programs using it" \
@@ -587,6 +589,8 @@ function _list {
--text="What do you want to do with this tomb?" \
--column=Command \
--column=Description \
+ "disindex" "Disable indexing of this tomb."
+ "enindex" "Enable indexing of this tomb."
"close" "Close the selected tomb." \
"slam" "Slam the selected tomb."`
@@ -613,6 +617,18 @@ function _list {
_zeninfo "Success" "Tomb slammed successfully!"
exec _main
;;
+ disindex)
+ tombloc=`tomb list $tombname --get-mountpoint`
+ touch "$tombloc/.noindex"
+ _zeninfo "Success" "Indexing disabled for this tomb."
+ exec _main
+ ;;
+ enindex)
+ tombloc=`tomb list $tombname --get-mountpoint`
+ rm "$tombloc/.noindex"
+ _zeninfo "Success" "Indexing of this tomb is enabled."
+ exec _main
+ ;;
# See what else to add
esac
@@ -898,6 +914,17 @@ function _exhume {
}
# }}}
+# {{{ index - index the contents of open tombs
+function _index {
+ which mlocate || _zenwarn "Warning" "mlocate is not installed. Install it and try again" && exec _main
+
+ $TOMBPATH index | _zenprognc "Indexing" "Please wait while the open tombs are being indexed..."
+ _zeninfo "Success" "Tombs indexed!"
+
+ exec _main
+}
+# }}}
+
if [ ! -f $TOMBPATH ]; then
_zenwarn "Warning" "Tomb binary is nonexistent in the current path. Install it or edit the script to point to the correct path."
else