From 4f5dd6ea112be4c3090202e972b361d11b6bc8eb Mon Sep 17 00:00:00 2001 From: Benjamin VAUDOUR Date: Tue, 9 Aug 2022 13:32:42 +0200 Subject: [PATCH] Beaucoup de changements, du coup, je ne sais plus lesquels --- aliases/adguard.elv | 6 +++--- aliases/aliases.elv | 5 ++++- aliases/checklinks.elv | 8 ++++---- aliases/transfer.elv | 21 +++++++++++++++++++++ aliases/upd.elv | 2 +- aliases/vi.elv | 3 ++- rc.elv | 6 ++++-- 7 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 aliases/transfer.elv diff --git a/aliases/adguard.elv b/aliases/adguard.elv index 9a8155e..c01e542 100644 --- a/aliases/adguard.elv +++ b/aliases/adguard.elv @@ -1,11 +1,11 @@ edit:add-var adguard~ {|@argv| use str - sudo chattr -i /etc/resolv.conf + doas chattr -i /etc/resolv.conf var beg = 's|^.*\(192\.168\.0\.25\)|' var end = 'nameserver \1|' if (and (> (count $argv) 0) (str:has-prefix $argv[0] u)) { set end = '# '$end } - sudo sed -i $beg$end /etc/resolv.conf - sudo chattr +i /etc/resolv.conf + doas sed -i $beg$end /etc/resolv.conf + doas chattr +i /etc/resolv.conf } diff --git a/aliases/aliases.elv b/aliases/aliases.elv index 218ccb4..0c62fa4 100644 --- a/aliases/aliases.elv +++ b/aliases/aliases.elv @@ -10,10 +10,13 @@ edit:add-var du~ {|@argv| e:du -h $@argv } #edit:add-var git~ $e:hub~ edit:add-var grep~ {|@argv| e:grep --color=tty -d skip $@argv } #edit:add-var grep~ {|@argv| e:ack $@argv } +edit:add-var hx~ {|@argv| e:helix $@argv } edit:add-var mv~ {|@argv| e:mv -iv $@argv } edit:add-var pf~ {|@argv| e:pkgfile -vri $@argv } edit:add-var rm~ {|@argv| e:rm -Iv $@argv } edit:add-var rename~ $e:go-rename~ +edit:add-var sudo~ {|@argv| fail 'Use doas instead'} edit:add-var timidity~ {|@argv| e:timidity -a -K -1 $@argv } edit:add-var tree~ {|@argv| e:tree -puhC --dirsfirst --du -D $@argv } -edit:add-var wget~ {|@argv| e:wget2 $@argv } +edit:add-var ungron~ {|@argv| e:gron --ungron $@argv } +#edit:add-var wget~ {|@argv| e:wget2 $@argv } diff --git a/aliases/checklinks.elv b/aliases/checklinks.elv index 87c9ed6..5204f8a 100644 --- a/aliases/checklinks.elv +++ b/aliases/checklinks.elv @@ -3,7 +3,7 @@ use str fn -check {|f| use str var @missings = (try { - sudo ldd $f 2>/dev/null | grep 'not found' | eawk {|_ m @_| put $m } + doas ldd $f 2>/dev/null | grep 'not found' | eawk {|_ m @_| put $m } } catch e { }) if (> (count $missings) 1) { @@ -20,17 +20,17 @@ fn -check-executable {|f| fn -cbin {|| echo (styled 'Searching broken binaries…' bold bright-yellow) - sudo find /usr/bin -maxdepth 1 -type f 2>/dev/null | each $-check~ + doas find /usr/bin -maxdepth 1 -type f 2>/dev/null | each $-check~ } fn -clib {|| echo (styled 'Searching broken libs…' bold bright-yellow) - sudo find /usr/lib/*.so* -maxdepth 1 -type f 2>/dev/null | each $-check-executable~ + doas find /usr/lib/*.so* -maxdepth 1 -type f 2>/dev/null | each $-check-executable~ } fn -copt {|| echo (styled 'Searching broken binariess in opt…' bold bright-yellow) - sudo find /opt -maxdepth 3 -type f 2>/dev/null | each $-check-executable~ + doas find /opt -maxdepth 3 -type f 2>/dev/null | each $-check-executable~ } edit:add-var checklinks~ {|| diff --git a/aliases/transfer.elv b/aliases/transfer.elv new file mode 100644 index 0000000..607a5c3 --- /dev/null +++ b/aliases/transfer.elv @@ -0,0 +1,21 @@ +var domain = https://transfer.hostux.net/ +edit:add-var transfer~ {|@argv| + use path + if (not-eq (count $argv) 0) { + fail('Usage: transfer ') + } + var file = $argv[0] + var filename = (basename $file) + var is_dir = (path:is-dir &follow-symlink=$true $file) + var is_regular = (path:is-regular &follow-symlink=$true $file) + if (not (and is_dir is_regular)) { + fail("'"$file"' n’existe pas") + } + if is_dir { + set filename = $filename'.tar.gz' + cd $file + tar -c . | e:curl --progress-bar --upload-file - $domain$filename | tee /dev/null + } else { + cat $file | e:curl --progress-bar --upload-file - $domain$filename | teee /dev/null + } +} diff --git a/aliases/upd.elv b/aliases/upd.elv index 2e4fa89..b69d7a3 100644 --- a/aliases/upd.elv +++ b/aliases/upd.elv @@ -1,6 +1,6 @@ edit:add-var upd~ {|@args| if ?(mirror-check --fast) { - sudo pacman -Syu + doas pacman -Syu } } diff --git a/aliases/vi.elv b/aliases/vi.elv index 0fb6014..2a25be1 100644 --- a/aliases/vi.elv +++ b/aliases/vi.elv @@ -1,4 +1,5 @@ -var cmd = $e:vim~ +var cmd = $e:nvim~ +#var cmd = $e:helix~ #var cmd = $e:kak~ #var cmd = $e:emacs~ diff --git a/rc.elv b/rc.elv index 9c445b0..9943056 100644 --- a/rc.elv +++ b/rc.elv @@ -1,7 +1,9 @@ #set-env BAT_THEME Coldark-Cold set-env BAT_PAGER 'less -RF' -set-env EDITOR vim -set-env VIEW 'vim -R' +#set-env EDITOR vim +set-env EDITOR kak +#set-env VIEW 'vim -R' +set-env VIEW 'kak -ro' set-env CURRENT_SHELL 'elvish' set-env STARSHIP_CONFIG ~/.config/starship/starship.toml set-env PERL5LIB /home/benjamin/perl5/lib/perl5