Renommage carapace + ajout maj symfony + ajout conversion .vtt en .srt

This commit is contained in:
Benjamin VAUDOUR 2022-03-15 17:19:55 +01:00
parent 4f516d7cbe
commit c70fe4ea35
3 changed files with 81 additions and 1 deletions

View File

@ -1,4 +1,4 @@
edit:add-var updatecarapace~ {|| edit:add-var maj-carapace~ {||
use path use path
var cur = (pwd) var cur = (pwd)
var wd = $E:HOME/Documents/OtherGo/github.com/rsteube/carapace-bin var wd = $E:HOME/Documents/OtherGo/github.com/rsteube/carapace-bin

14
aliases/ffmpeg.elv Normal file
View File

@ -0,0 +1,14 @@
edit:add-var vtt2srt~ {|@argv|
use re
use str
var cnv = {|vtt|
if (not (re:match '.*\.vtt$' $vtt)) {
echo $vtt 'nest pas un fichier vtt'
} else {
var srt = (str:trim-suffix $vtt 'vtt')'srt'
e:ffmpeg -i $vtt $srt
}
}
each $cnv $argv
}

66
aliases/symfony.elv Normal file
View File

@ -0,0 +1,66 @@
edit:add-var maj-symfony~ {|@argv|
var repo = symfony-cli/symfony-cli
var bin = /usr/local/bin/symfony
var tmp = (mktemp -u /tmp/symfony.XXXXXXXX)
var cdir = (pwd)
fn lastVersion {||
try {
curl -s (printf 'https://api.github.com/repos/%s/releases/latest' $repo) | grep 'tag_name' | awk '{print substr($2, 3, length($2)-4) }'
} except e {
fail 'Impossible de récupérer les infos sur la dernière version'
}
}
fn currentVersion {||
$bin -V --no-ansi | awk '{print $4}'
}
fn download {|version|
mkdir $tmp
cd $tmp
try {
#wget -O symfony.tar.gz (printf 'https://github.com/%s/archive/refs/tags/v%s.tar.gz' $repo $version)
wget -O symfony.tar.gz (printf 'https://github.com/%s/releases/download/v%s/symfony-cli_linux_amd64.tar.gz' $repo $version)
tar -xzf symfony.tar.gz
} except e {
cd $cdir
rm -rf $tmp
fail (printf 'Impossible de récupérer symfony %s' $version)
}
}
fn install {|version|
#cd (printf '%s/symfony-cli-%s' $tmp $version)
#go mod vendor
#go build -mod=vendor -o symfony main.go
cd $tmp
cp -fa $bin{,.old}
cp -fa symfony $bin
}
fn info {|msg|
echo (styled $msg bold yellow)
}
fn error {|msg|
echo (styled $msg bold red)
}
var cv = (currentVersion)
var lv = (lastVersion)
if (eq $cv $lv) {
info (printf 'Vous avez la dernière version de symfony (%s)' $cv)
return
}
info (printf 'Récupération de symfony %s' $lv)
download $lv
info (printf 'Mise à jour de symfony %s vers %s' $cv $lv)
install $lv
cd $cdir
rm -rf $tmp
}