File: on-exit.shadow-file

package info (click to toggle)
task 2.5.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,588 kB
  • ctags: 8,723
  • sloc: cpp: 36,161; python: 11,324; perl: 8,697; ansic: 7,400; sh: 673; makefile: 19
file content (36 lines) | stat: -rwxr-xr-x 1,287 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/env bash

# This hook script replaces the shadow file feature, found in Taskwarrior
# prior to version 2.4.0.
#
# This script assumes that the legacy shadow file settings are still used.
# Although those settings are now not recognized by Taskwarrior, іt is
# harmless to store configuration settings for extensions in .taskrc.

# The command to run, to generate the shadow file. If this is not available,
# then the default.command is used.
SHADOW_COMMAND=$(task _get rc.shadow.command)
if [[ -z "$SHADOW_COMMAND" ]]
then
  SHADOW_COMMAND=$(task _get rc.default.command)
fi

# The file to overwrite.
SHADOW_FILE=$(task _get rc.shadow.file)

# Run the command, inserting a series of override settings:
#   rc.detection=off       Disables terminal size detection
#   rc.gc=off              Disables GC, thus not changing IDs unexpectedly
#   rc.color=off           Disable color in the shadow file
#   rc.locking=off         Disable file locking, to prevent race condition
#   rc.hooks=off           Disable hooks, to prevent race condition
task $SHADOW_COMMAND rc.detection=off rc.gc=off rc.color=off rc.locking=off rc.hooks=off > $SHADOW_FILE 2>/dev/null
if [[ $? != 0 ]]
then
  echo Could not create $SHADOW_FILE
  exit 1
fi

echo Shadow file $SHADOW_FILE updated.
exit 0