Skip to content

Add list subcommand to enumerate release assets without downloading #357

Description

@fuleinist

Problem

dra download <repo> either prompts interactively (TTY) or requires the user to know a pattern (--select) or rely on automatic matching (--automatic). When scripting around dra — e.g. a setup script that wants to detect whether a repo ships an aarch64 build, a .deb package, or a portable tarball — there's no way to inspect what assets exist without entering the interactive picker or attempting a download. Pipelines that need to fail fast on missing assets can't detect the missing-asset case ahead of time.

Solution

Add a dra list <repo> subcommand that reuses the existing fetch_release_for + Release.assets path (already used by UntagHandler::run) and prints the available assets to stdout. Two output modes:

  • Default (human): one line per asset in name | display_name | size order, e.g. hello_1.0.0_amd64.deb | | 12.4MB.
  • --json: machine-readable, e.g. [{name: hello_1.0.0_amd64.deb, display_name: null, size_bytes: 13002342, download_url: ...}, ...]. Reuses the serde Serialize derive pattern from the Asset struct.

Optional --tag <v> flag to inspect a specific release (parallels the existing download --tag, reuses fetch_release_for(..., Some(tag))).

Use case

# Detect whether a repo ships an aarch64 Linux build before running setup
if dra list --json owner/repo | jq -e '.[] | select(.name | test("aarch64|arm64"))' >/dev/null; then
  dra download --select '<aarch64 asset>' owner/repo
else
  echo 'no aarch64 build available' >&2
  exit 1
fi

Today, the only option is to either guess the asset name (and have dra fail with a pattern-not-matched error after the network call) or run dra download interactively and capture stdout — neither fits a non-interactive setup script.

Distinct from existing

  • dra download --select <pattern> — requires a pattern, doesn't enumerate.
  • dra untag <repo> — interactive picker, then prints a single untagged name; doesn't expose the full asset list.
  • dra download --automatic — picks a single best match silently; doesn't expose the choices.

Disclosure

Filing from fuleinist, a recurring GitHub-issue contributor. Happy to send a PR if the maintainer is interested — the implementation should be ~50-80 lines (src/cli/list_handler.rs + a List variant on Command + clap derive for --tag/--json).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions