commands: ensure internal commands are files
commands: ensure internal commands are files

`Pathname#children(with_directory = false)` doesn't filter directories,
instead it returns path with basename.

Closes Homebrew/homebrew#45325.

Signed-off-by: Xu Cheng <9a05244150b861e40c78843b801eed71bca54eac@me.com>

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