diff --git a/aliases/carapace.elv b/aliases/carapace.elv index 7cd7b3e..f13866e 100644 --- a/aliases/carapace.elv +++ b/aliases/carapace.elv @@ -1,4 +1,4 @@ -edit:add-var updatecarapace~ {|| +edit:add-var maj-carapace~ {|| use path var cur = (pwd) var wd = $E:HOME/Documents/OtherGo/github.com/rsteube/carapace-bin diff --git a/aliases/ffmpeg.elv b/aliases/ffmpeg.elv new file mode 100644 index 0000000..72542a0 --- /dev/null +++ b/aliases/ffmpeg.elv @@ -0,0 +1,14 @@ +edit:add-var vtt2srt~ {|@argv| + use re + use str + var cnv = {|vtt| + if (not (re:match '.*\.vtt$' $vtt)) { + echo $vtt 'n’est pas un fichier vtt' + } else { + var srt = (str:trim-suffix $vtt 'vtt')'srt' + e:ffmpeg -i $vtt $srt + } + } + + each $cnv $argv +} diff --git a/aliases/symfony.elv b/aliases/symfony.elv new file mode 100644 index 0000000..a62c30c --- /dev/null +++ b/aliases/symfony.elv @@ -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 +}