Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So we aren't talking past each other, how do you delineate between cargo and a package manager? Does anaconda, pip (pypi) or homebrew also qualify?

Your scripts could have a prolog that installs rustup and calls cargo.

There is also https://github.com/ryankurte/cargo-binstall

Even after 20 years of bashing, my bash skills still suck. So many corner cases!

But if you include this, and call install_utils at the head of your scripts. It should install the tools on demand.

    #!/bin/bash

    RUST_PACKAGE_LIST='rg xsv tuc broot du-dust dutree'
    RUST_UTIL_LIST='rg xsv tuc broot dust dutree'


    function is_cargo {
        cargo > /dev/null
    }


    function is_utils {
        eval "which $RUST_UTIL_LIST" > /dev/null
    }


    function install_utils {
        if ! is_utils ; then
            if ! is_cargo; then
                curl https://sh.rustup.rs -sSf | sh -s -- -y
            fi
            eval "cargo install --locked $RUST_PACKAGE_LIST" > /dev/null
        fi
    }
I don't recommend using this, it is just illustrative.


My primary point is that if I stick to coreutils, I don't have to worry about any of this. I can reasonably expect anything in coreutils to already be installed and available. Your functions seem like they'll work just fine, but either requires build tools to be installed, or the package to support binstall. For me, thinking about all these things and maintaining something like that isn't worth it when I can just use coreutils.


I totally understand. My .vimrc has shrunk from over a hundred lines to 4 lines in the last years. But I really think you are doing yourself a disservice. It is easier than ever (homebrew, nix, cargo, pip) to get nice software everywhere.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: