crew: Add a new command for showing disk statistics (#12622)

* crew: Add `diskstat` command

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Remove workarounds

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Make rubocop happy

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Allow customizing package count

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Also check for runtime directory size

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Fix file size display

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Bump version

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Minor fixes

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Suggested changes

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

---------

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>
This commit is contained in:
SupeChicken666
2025-08-25 06:59:28 +08:00
committed by GitHub
parent 83846238a2
commit d067fa3654
8 changed files with 149 additions and 53 deletions

View File

@@ -15,23 +15,10 @@ require 'mkmf'
require 'open3'
require 'tmpdir'
require 'uri'
begin
require_relative '../commands/check'
rescue LoadError
# Older crew installs won't have the commands dir in the sparse checkout,
# so disable sparse checkout if those files are missing.
system 'git sparse-checkout disable'
require_relative '../commands/check'
end
require_relative '../commands/const'
require_relative '../commands/files'
require_relative '../commands/help'
require_relative '../commands/list'
require_relative '../commands/prop'
require_relative '../commands/remove'
require_relative '../commands/search'
require_relative '../commands/sysinfo'
require_relative '../commands/whatprovides'
# Load commands
Dir.glob("#{__dir__}/../commands/*.rb") { |cmd| require_relative cmd }
require_relative '../lib/const'
require_relative '../lib/crew_lockfile'
require_gem 'pry-byebug' if CREW_DEBUG
@@ -1879,6 +1866,8 @@ def deps_command(args)
end
end
def diskstat_command(args) = Command.diskstat(args['--all'], args['<count>'] ? args['<count>'].to_i : 25)
def download_command(args)
args = { '<name>' => args.split } if args.is_a? String
args['<name>'].each do |name|