mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
tool for opening scripts shorter and etc
This commit is contained in:
parent
5cb4c6deea
commit
f58d4cc2d0
31
.local/bin/dcf
Executable file
31
.local/bin/dcf
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
# IT CAN TAKE ONLY ONE FLAG
|
||||
# example: " dcf h -33 <command> " or " dcf c -n <command>"
|
||||
|
||||
one="$1" ; two="$2" ; three="$3" ; four="$4"
|
||||
|
||||
#If no function is used, work as "which"
|
||||
[ -z "$two" ] && which $one && break && exit
|
||||
|
||||
#Shift values, if there is no flag
|
||||
[ -z "$three" ] && three="$two" && two=""
|
||||
|
||||
# Tells you which package owns that command,
|
||||
p() { pacman "${two:--Qo}" $( which "$three" ) ; }
|
||||
# or give it a file directly (for lib or share, which aren't executable)
|
||||
pl() { pacman "${two:--Qo}" $( echo "$three" ) ; }
|
||||
|
||||
# Print || read || modify that script
|
||||
c() { cat $two $( which "$three" ) ; }
|
||||
l() { less $two $( which "$three" ) ; }
|
||||
v() { nvim $two $( which "$three" ) ; }
|
||||
h() { head $two $( which "$three" ) ; }
|
||||
t() { tail $two $( which "$three" ) ; }
|
||||
|
||||
#grep has 1 argument more, shift again.
|
||||
g() { [ -z "$four" ] && four="$three" && three="$two" && two="" ;
|
||||
grep --color=auto $two "$three" $( which "$four" ) ; }
|
||||
|
||||
$1
|
||||
|
||||
#pro-tip: alias "dcf v" to "dcfv" to immediately open a script in vim.
|
||||
Loading…
x
Reference in New Issue
Block a user