fish: functions: Move HieDb helpers to functions
Using abbreviations for shell commands does not seem clean. They also seem out of place along with other cabal abbreviations. While at it, we also add a helper to nuke all Haskell build artefacts. This is convenient instead of running cabal clean in every project or relying on Kondo. For deleting directories, we replace -delete with -exec rm -rv {} + or -exec rm -rv {} \ which should delete directories recursively without error. + at the end will result in rm -rv file1 file2 ... while using \ will result in rm -rv file1; rm -rv file2; ...
This commit is contained in:
parent
386cc0c75b
commit
aab3d5bee3
4 changed files with 9 additions and 2 deletions
|
@ -37,5 +37,3 @@ abbr cpD 'cabal-plan dot'
|
||||||
abbr cpdp 'cabal-plan dot-png'
|
abbr cpdp 'cabal-plan dot-png'
|
||||||
abbr cpt 'cabal-plan topo'
|
abbr cpt 'cabal-plan topo'
|
||||||
abbr cplr 'cabal-plan license-reportate'
|
abbr cplr 'cabal-plan license-reportate'
|
||||||
abbr chi 'hiedb -D .hiedb index .hiefiles --src-base-dir .'
|
|
||||||
abbr chic 'find . -name .hiefiles | awk \'{print $1" "substr($1, 1, length($1) - length(".hiefiles"))}\' | xargs -n2 sh -c \'hiedb -D .hiedb index $0 --src-base-dir=$1 --skip-types\''
|
|
||||||
|
|
3
fish/.config/fish/functions/hclean.fish
Normal file
3
fish/.config/fish/functions/hclean.fish
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
function hclean --description "Clean all Haskell build artefacts"
|
||||||
|
find . -name .hiedb -type f -delete && find . -name .hiefiles -type d -exec rm -rf {} + && find . -name dist-newstyle -type d -exec rm -rf {} + && find . -name tags -type f -delete && find . -name ".ghc.environment*" -type f -delete
|
||||||
|
end
|
3
fish/.config/fish/functions/hieg.fish
Normal file
3
fish/.config/fish/functions/hieg.fish
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
function hieg --description "Generate HieDb"
|
||||||
|
hiedb -D .hiedb index .hiefiles --src-base-dir .
|
||||||
|
end
|
3
fish/.config/fish/functions/hier.fish
Normal file
3
fish/.config/fish/functions/hier.fish
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
function hier --description "Generate HieDb for multi-project workspace"
|
||||||
|
find . -name .hiefiles | awk '{print $1" "substr($1, 1, length($1) - length(".hiefiles"))}' | xargs -n2 sh -c 'hiedb -D .hiedb index $0 --src-base-dir=$1 --skip-types'
|
||||||
|
end
|
Loading…
Reference in a new issue