27 lines
600 B
Fish
Executable file
27 lines
600 B
Fish
Executable file
#!/bin/env fish
|
|
begin
|
|
function processContent -a content
|
|
echo "$content"
|
|
end
|
|
|
|
function addProfileStatement -a name title shellBin extension profileRoot content
|
|
set -l file (mktemp)
|
|
|
|
if [ -z "$title" ]
|
|
set -l title "$name"
|
|
end
|
|
|
|
if [ -z "$content" ]
|
|
read -z content
|
|
end
|
|
|
|
begin
|
|
printf %s\n \
|
|
"#!$shellBin" \
|
|
"# $title" \
|
|
(processContent "$content")
|
|
end >"$file"
|
|
|
|
sudo install -Dm755 "$file" "$profileRoot/$name.$extension"
|
|
end
|
|
end
|