Class: RubynCode::CLI::Commands::Chisel

Inherits:
Base
  • Object
show all
Defined in:
lib/rubyn_code/cli/commands/chisel.rb

Overview

Set or report the Chisel intensity. Chisel is the opt-in “write the minimum that works” enforcement layer; it is off by default and only changes the agent’s behavior once turned on here.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

aliases, all_names, hidden?

Class Method Details

.command_nameObject



10
# File 'lib/rubyn_code/cli/commands/chisel.rb', line 10

def self.command_name = '/chisel'

.descriptionObject



11
# File 'lib/rubyn_code/cli/commands/chisel.rb', line 11

def self.description = 'Set or show Chisel intensity (off|lite|full|ultra)'

Instance Method Details

#execute(args, ctx) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/rubyn_code/cli/commands/chisel.rb', line 13

def execute(args, ctx)
  arg = args.first
  return report(ctx) if arg.nil? || arg.strip.empty?

  mode = arg.strip.downcase
  return reject(mode, ctx) unless RubynCode::Chisel.valid?(mode)

  persist(mode, ctx)
end