2024-07-16 01:30:14 +00:00
|
|
|
#!/bin/env fish
|
|
|
|
begin
|
|
|
|
function processContent -a content
|
|
|
|
echo "$content"
|
|
|
|
end
|
|
|
|
|
|
|
|
function addProfileStatement -a name title shellBin extension profileRoot content
|
|
|
|
set -l file (mktemp)
|
|
|
|
|
2024-07-16 12:15:05 +00:00
|
|
|
if [ -z "$title" ]
|
2024-12-11 00:13:02 +00:00
|
|
|
set title "$name"
|
2024-07-16 12:15:05 +00:00
|
|
|
end
|
|
|
|
|
2024-07-16 01:30:14 +00:00
|
|
|
if [ -z "$content" ]
|
2024-07-28 14:57:36 +00:00
|
|
|
read -z content
|
2024-07-16 01:30:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
begin
|
|
|
|
printf %s\n \
|
|
|
|
"#!$shellBin" \
|
|
|
|
"# $title" \
|
|
|
|
(processContent "$content")
|
2024-10-06 19:25:34 +00:00
|
|
|
end >"$file"
|
2024-07-16 01:30:14 +00:00
|
|
|
|
|
|
|
sudo install -Dm755 "$file" "$profileRoot/$name.$extension"
|
|
|
|
end
|
|
|
|
end
|