ubicloud/cli-commands/gh/post/list-cache-entries.rb
Jeremy Evans 4d68fa2831 Add support for managing github installations/repositories/cache entries to the CLI
This adds the following CLI commands:

```
ubi gh installation list
ubi gh installation installation-name list-repositories
ubi gh installation-name/repository-name list-cache-entries
ubi gh installation-name/repository-name remove-cache-entry cache-entry-id
```

This adds Clover.humanize_size, so the list-cache-entries CLI command can
reuse the logic.
2025-11-01 02:46:00 +09:00

16 lines
546 B
Ruby

# frozen_string_literal: true
UbiCli.on("gh").run_on("list-cache-entries") do
desc "List cache entries for a GitHub repository"
key = :cache_entries_list
options("ubi gh installation-name/repository-name list-cache-entries [options]", key:) do
on("-N", "--no-headers", "do not show headers")
end
run do |opts|
cache_entries = @repository.cache_entries.each { it.values[:size] = Clover.humanize_size(it[:size]) }
response(format_rows(%i[id size key], cache_entries, headers: opts[key][:"no-headers"] != false))
end
end