-
Notifications
You must be signed in to change notification settings - Fork 1
/
added-tools-examples
39 lines (29 loc) · 1.1 KB
/
added-tools-examples
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env zsh
# Copyright (c) 2021 Domizio Demichelis
# Released under GNU3 license
# https://www.gnu.org/licenses/gpl-3.0.en.html
show-variables() {
cat <<-VARS |
This function shows a few internal variables available to your tools.
Retry it after filtering with a query and/or selecting multiple items.
view: $view
query: $query
items:
${(@F)items}
lines:
${(@F)lines}
VARS
less && fm__notify "The 'show-variable' function works!"
}
fm add \
--tool 'show-variables' \
--title 'Show Variables Example' \
--key 'f6' \
--usage 'Show a few internal variables available to your tools'
fm add \
--tool 'ls -l $items[1] | less' \
--title 'Direct Command Example' \
--usage "$( print "Example of running a direct command as an added tool, even passing the selected dir without defining any function.\n\nSelect a dir and run it: you will get the ls of the selected dir paginated with less.\n\nNotice that there is no --key defined for this menu, so you must select the dir and pick this menu from the Menu Panel")"
fm add \
--tool 'return 2' \
--title 'Will Fail Command Example'