blob: 604f92e3c6a20d4bb9b7b0e362168eb4d0e45e50 (
about) (
plain) (
blame)
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
|
{ lib
, writeShellApplication
, python3
, pywikibot-scripts
, pywikibot
}:
writeShellApplication {
name = "pywb";
text = ''
pwbs="${pywikibot-scripts}/${python3.sitePackages}/scripts"
cmd="''${1:-}"; shift
if [ -z "$cmd" ]; then
echo "not specified command to run" >&2
exit 2
fi
if [ -f "$pwbs/$cmd.py" ]; then
exec "${pywikibot}/bin/pwb" "$pwbs/$cmd" "$@"
elif [ -f "$pwbs/$cmd" ]; then
exec "${pywikibot}/bin/pwb" "$pwbs/$cmd" "$@"
else
if [ "$cmd" = "__get_path" ]; then
echo "$pwbs"
exit
elif [ "$cmd" = "--ls" ]; then
ls "$pwbs" "$@"
exit
fi
echo "$cmd not found in pywkibot's scripts folder (make sure it doesn't end in .py)" >&2
exit 1
fi
'';
}
|