linkapps: modernize
linkapps: modernize

Simplify code by using `Pathname` methods as much as possible. Also
avoid calling external commands for basic functionality like symlink
creation, refactor code that can be shared with `brew unlinkapps`, and
print a summary line at the end (if symlinks were created).

JCount/brew,nandub/brew,vitorgalvao/brew,hanxue/linuxbrew,tonyg/homebrew,mahori/brew,amar-laksh/brew_sudo,alyssais/brew,DomT4/brew,bfontaine/brew,EricFromCanada/brew,reelsense/brew,rwhogg/brew,tonyg/homebrew,zmwangx/brew,EricFromCanada/brew,konqui/brew,sjackman/homebrew,jmsundar/brew,gregory-nisbet/brew,staticfloat/brew,gregory-nisbet/brew,jmsundar/brew,ilovezfs/brew,zmwangx/brew,Linuxbrew/brew,aw1621107/brew,amar-laksh/brew_sudo,vitorgalvao/brew,toonetown/homebrew,maxim-belkin/brew,rwhogg/brew,JCount/brew,hanxue/linuxbrew,MikeMcQuaid/brew,palxex/brew,nandub/brew,AnastasiaSulyagina/brew,alyssais/brew,toonetown/homebrew,jmsundar/brew,Homebrew/brew,bfontaine/brew,reitermarkus/brew,vitorgalvao/brew,staticfloat/brew,EricFromCanada/brew,MikeMcQuaid/brew,Linuxbrew/brew,muellermartin/dist,claui/brew,gordonmcshane/homebrew,mahori/brew,AnastasiaSulyagina/brew,mahori/brew,pseudocody/brew,muellermartin/dist,hanxue/linuxbrew,MikeMcQuaid/brew,bfontaine/brew,gordonmcshane/homebrew,DomT4/brew,EricFromCanada/brew,gordonmcshane/homebrew,alyssais/brew,DomT4/brew,tonyg/homebrew,muellermartin/dist,nandub/brew,reelsense/brew,aw1621107/brew,maxim-belkin/brew,gregory-nisbet/brew,Homebrew/brew,zmwangx/brew,Homebrew/brew,Homebrew/brew,JCount/brew,reitermarkus/brew,maxim-belkin/brew,vitorgalvao/brew,konqui/brew,amar-laksh/brew_sudo,mgrimes/brew,AnastasiaSulyagina/brew,mgrimes/brew,ilovezfs/brew,MikeMcQuaid/brew,konqui/brew,pseudocody/brew,JCount/brew,reitermarkus/brew,mistydemeo/homebrew,mistydemeo/homebrew,nandub/brew,claui/brew,reitermarkus/brew,Linuxbrew/brew,rwhogg/brew,mistydemeo/homebrew,claui/brew,claui/brew,Linuxbrew/brew,palxex/brew,DomT4/brew,sjackman/homebrew,pseudocody/brew,sjackman/homebrew,toonetown/homebrew,reelsense/brew,konqui/brew,aw1621107/brew,mahori/brew,sjackman/homebrew,ilovezfs/brew,staticfloat/brew,mgrimes/brew,palxex/brew