-
Notifications
You must be signed in to change notification settings - Fork 3
Complex Scripts
The C table
, also called as command table, helps with script/programmable data into the V column. The data can be made executable depending on the macro into which it is passed to. This section explains how to enable/disable the functionality in a shell script at one's convenience.
The same method becomes applicable if the user prefers to use with a different application instead of a shell script.
In case of complex scripts spanning multiple lines or perhaps a set of highly dependent functions, it is cumbersome to add data into the table. Instead, following the steps listed below can be very efficient in enabling/disabling a specific function(s).
- source : makes the script accessible globally
- unset : disables the function globally
The above functions are usually part of core utils.
Get the template file to add the data
qkw -gettemplate cmdinput.data
Enable template followed by Disable template. The expl column helps understand how to use the script and any other information.
value:
path=/this/is/very/far/dir;
source $path/script.sh;
expl:
enable the function "myfunc" globally
Usage:
-----------------------------
myfunc <option-1> <option-2>
-----------------------------
Note:
- myfunc: makes use of f1,f2 with two arguments
Warning:
- dont use when in a specific directory
---
label:
myfunc.disable
value:
unset myfunc;
expl:
disable my func, as sourced from
path=/this/is/very/far/dir
---
Add the information into the C-table
qkw -C -if cmdinput.data
To see what's added, search for it
qkw -sC myfunc
The output should look something like this
Enabling/disabling the function "myfunc"
# enable
rfs myfunc.enable
# Using myfunc from the terminal, like a native application
myfunc <option-1> <option-2>
# disable
rfs myfunc.disable
myfunc # will throw an error
rfs
is the shell macro which is sourced by default