From f68d1a89ce927a16feb076857405947fc6ea98a6 Mon Sep 17 00:00:00 2001 From: Benjamin VAUDOUR Date: Sun, 20 Mar 2022 18:29:23 +0100 Subject: [PATCH] =?UTF-8?q?Compatibilit=C3=A9=20elvish=200.18=20+=20hack?= =?UTF-8?q?=20starship=20en=20attendant=20que=20cela=20soit=20corrig=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aliases/checklinks.elv | 4 ++-- aliases/pdf.elv | 2 +- aliases/symfony.elv | 6 +++--- rc.elv | 7 +++++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/aliases/checklinks.elv b/aliases/checklinks.elv index 4d966da..87c9ed6 100644 --- a/aliases/checklinks.elv +++ b/aliases/checklinks.elv @@ -4,10 +4,10 @@ fn -check {|f| use str var @missings = (try { sudo ldd $f 2>/dev/null | grep 'not found' | eawk {|_ m @_| put $m } - } except e { + } catch e { }) if (> (count $missings) 1) { - var p = (LC_ALL=C pacman -Qo $f) + var p = (tmp E:LC_ALL = C; pacman -Qo $f) printf "%s seem broken: missing %s\n" $p (str:join ', ' $missings) } } diff --git a/aliases/pdf.elv b/aliases/pdf.elv index 9db455f..2f3ea97 100644 --- a/aliases/pdf.elv +++ b/aliases/pdf.elv @@ -403,7 +403,7 @@ edit:add-var pdf~ {|action @args| must-valid $t {|e| and (> (count $e) 0) (has-key $extr $e[0])} $extr[$t[0]] $in $out } - } except e { + } catch e { rm -rf $out fail $e } diff --git a/aliases/symfony.elv b/aliases/symfony.elv index a62c30c..a5196fb 100644 --- a/aliases/symfony.elv +++ b/aliases/symfony.elv @@ -3,11 +3,11 @@ edit:add-var maj-symfony~ {|@argv| 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 { + } catch e { fail 'Impossible de récupérer les infos sur la dernière version' } } @@ -23,7 +23,7 @@ edit:add-var maj-symfony~ {|@argv| #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 { + } catch e { cd $cdir rm -rf $tmp fail (printf 'Impossible de récupérer symfony %s' $version) diff --git a/rc.elv b/rc.elv index 65d54a8..ed63dff 100644 --- a/rc.elv +++ b/rc.elv @@ -23,8 +23,11 @@ set edit:insert:binding[Ctrl-H] = $edit:histlist:start~ #set edit:rprompt = { nop } # Starship prompt : https://starship.rs/ -eval (starship init elvish) -#eval (starship init elvish --print-full-init | upgrade-scripts-for-0.17 -lambda | slurp) +#eval (starship init elvish) +{ + use re + eval (re:replace 'except' 'catch' (starship init elvish --print-full-init | slurp)) +} # Carapace completion : https://github.com/rsteube/carapace-bin eval (carapace _carapace|slurp)