svenfuchs/cl

View on GitHub
examples/readme/secret

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby
$: << File.expand_path('lib')

class Add < Cl::Cmd
  register :add

  opt '--pass PASS', secret: true

  def run
    p(
      secret?: self.class.opts[:pass].secret?,
      tainted?: pass.tainted?
    )
  end
end

Cl.new('owners').run(%w(add --pass pass))

# Output:
#
#   {:secret?=>true, :tainted?=>true}