Hacker News new | ask | show | jobs
by c0wb0yc0d3r 1181 days ago
Do you have an example?
1 comments

    import {alias, _export, _eval} from './util.js'
    
    export default async function config() {
      git()
    }
    
    function git() {
      alias({
        gpsuom: 'git push --set-upstream origin master',
        gpsuvm: 'git push --set-upstream vjpr master',
        gpsu: 'git push --set-upstream',
        gmvd: 'git merge vjpr/dev',
        gmvdgp: 'git merge vjpr/dev && git push',
        gprom: 'git pull --rebase origin master',
        gpuohm: 'git push origin head:master',
        gpom: 'git pull origin master',
        grhh: 'git reset --hard HEAD',
        gisquash: 'git reset --soft HEAD~$(git rev-list --count HEAD ^master)',
        gacp: "git add . && git commit --message 'Update' && git push",
        gacmu: "git add . && git commit --message 'Update'",
        gacmup: "git add . && git commit --message 'Update' && git push",
      })
    }
    
    function brew() {
      alias('bbrew', 'br')
      alias({
        br: 'HOMEBREW_NO_AUTO_UPDATE=1 brew',
        // x86_64
        ibrew: 'arch -x86_64 /usr/local/bin/brew',
        abrew: '/opt/homebrew/bin/brew',
      })
      _eval(`$(/opt/homebrew/bin/brew shellenv)`)
    }
I take it, then, in your .bashrc file you have a line to the effect: bun run bashrc.ts?
Yeh something like that. I am using unix pipes to communicate with the shell, basically just eval'ing commands. I did this because bun didn't support sockets yet, which is probably a better approach. Pipes have crazy edge cases.