File: actions-test-lib.sh

package info (click to toggle)
todotxt-cli 2.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 1,312 kB
  • sloc: sh: 5,393; makefile: 67
file content (36 lines) | stat: -rw-r--r-- 762 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

make_action()
{
    unset TODO_ACTIONS_DIR
    [ -d .todo.actions.d ] || mkdir .todo.actions.d
    cat > ".todo.actions.d/$1" <<EOF
#!/bin/bash
[ "\$1" = "usage" ] && {
    echo "    $1 ITEM#[, ITEM#, ...] [TERM...]"
    echo "      This custom action does $1."
    echo ""
    exit
}
echo "custom action $1"
EOF
chmod +x ".todo.actions.d/$1"
}

make_action_in_folder()
{
    unset TODO_ACTIONS_DIR
    [ -d .todo.actions.d ] || mkdir .todo.actions.d
    mkdir .todo.actions.d/$1
    cat > ".todo.actions.d/$1/$1" <<EOF
#!/bin/bash
[ "\$1" = "usage" ] && {
    echo "    $1 ITEM#[, ITEM#, ...] [TERM...]"
    echo "      This custom action does $1."
    echo ""
    exit
}
echo "custom action $1 in folder $1"
EOF
chmod +x ".todo.actions.d/$1/$1"
}