nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.22k stars 42 forks source link

[Feature request] Update or install from a config file #94

Closed gibfahn closed 5 years ago

gibfahn commented 6 years ago

It would be really useful to be able to pass a file to cargo-install-update that specifies a set of packages, and to have it either install or update them as necessary.

You can sort of hack this right now with:

rust_crates=(fd-find ripgrep xsv exa bat tally watchexec runiq stringsext hex hyperfine)
cargo install-update -a
cargo install-update -i "${rust_crates[@]}"

but it means two calls.

What would be ideal is something like brew bundle, which defines a simple config file in which you specify package names and options (like the things that cargo-install-update-config lets you set).

nabijaczleweli commented 6 years ago

Hmm, I'd rather not parse even more files, but I should probably make -ia with packageset work.

As for passing a file with a packageset, is there anything that wouldn't work for you in the following example?

xargs -d '\n' -a cargo-packages.list cargo install-update -ia
gibfahn commented 6 years ago

I should probably make -ia with packageset work.

@nabijaczleweli supporting -ia would do 90% of what I want, no problems.

is there anything that wouldn't work for you in the following example?

I'd probably want to support comments, so maybe:

sed 's/#.*//' cargo-packages.list | xargs cargo install-update -ia

But yes that would absolutely meet my use-case.

brew bundle does have a few other nice features, but actually it's implemented as a separate extension on top of brew, so there's no reason why the same shouldn't be true for cargo-install-update.

$ brew bundle --help
brew bundle command:
    Bundler for non-Ruby dependencies from Homebrew.

    bundle [install] [-v|--verbose] [--no-upgrade] [--file=path|--global]:
    Install or upgrade all dependencies in a Brewfile.

    brew bundle dump [--force] [--describe] [--file=path|--global]
    Write all installed casks/formulae/taps into a Brewfile.

    brew bundle cleanup [--force] [--zap] [--file=path|--global]
    Uninstall all dependencies not listed in a Brewfile.

    brew bundle check [--no-upgrade] [--file=path|--global] [--verbose]
    Check if all dependencies are installed in a Brewfile. Missing dependencies are listed in verbose mode. check will exit on the first category missing a dependency unless in verbose mode.

    brew bundle exec command
    Run an external command in an isolated build environment.

    brew bundle list [--all|--brews|--casks|--taps|--mas] [--file=path|--global]
    List all dependencies present in a Brewfile, optionally limiting by types.
    By default, only brew dependencies are output.

    If -v or --verbose are passed, print verbose output.

    If --no-upgrade is passed, don't run brew upgrade outdated dependencies.
    Note they may still be upgraded by brew install if needed.

    If --force is passed, uninstall dependencies or overwrite an existing Brewfile.

    If --zap is passed, casks will be removed using the zap command instead of uninstall.

    If --file=path is passed, the Brewfile path is set accordingly
    Use --file=- to output to console.

    If --global is passed, set Brewfile path to $HOME/.Brewfile.

    If --describe is passed, output a description comment above each line.
    This comment will not be output if the dependency does not have a description.

    If -h or --help are passed, print this help message and exit.
nabijaczleweli commented 6 years ago

Check, if you'd be so kind, current master branch for whether it works as you'd expect?

I don't use Ruby and am therefore unfamiliar with its ecosystem, are you, mayhaps, proposing some more features therefrom?

gibfahn commented 5 years ago

Check, if you'd be so kind, current master branch for whether it works as you'd expect?

Thanks, works perfectly!

image

I don't use Ruby and am therefore unfamiliar with its ecosystem, are you, mayhaps, proposing some more features therefrom?

I was just saying that any other features could easily be implemented in a wrapper around cargo-update.

nabijaczleweli commented 5 years ago

Ah, lovely! (Though another layer on top of cargo-update would be hilarious.)

Released in v1.7.0.