Added module for CPU methods
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine 2023-10-30 16:23:16 -04:00
parent 1d7b9c8f0f
commit 267436f6e9
2 changed files with 31 additions and 0 deletions

12
src/cmd/cpu.rb Normal file
View File

@ -0,0 +1,12 @@
# frozen_string_literal: true
# CPU command methods
module CMD
def cpu_stress
puts('CPU stress test.')
end
module_function :cpu_stress
end

View File

@ -5,6 +5,8 @@
require 'bundler/setup'
require 'dry/cli'
require_relative 'cmd/cpu'
module PCHWBM
module CLI
# Commands module for dry-cli
@ -12,6 +14,20 @@ module PCHWBM
extend Dry::CLI::Registry
# CPU subcommand definition
module CPU
# CPU stress test command
class Stress < Dry::CLI::Command
desc 'CPU tests.'
def call(*)
CMD.cpu_stress()
end
end
end
# Version subcommand definition
class Version < Dry::CLI::Command
@ -25,6 +41,9 @@ module PCHWBM
# Register commands with the CLI
register 'version', Version, aliases: ['v', '-v', '--version']
register 'cpu' do |prefix|
prefix.register('stress', CPU::Stress)
end
end
end