Sha256: e315b3f82236a94cf7292f3c1cd5de39e5995193566949b6938a1a4f24edefc4
Contents?: true
Size: 690 Bytes
Versions: 4
Compression:
Stored size: 690 Bytes
Contents
module Kontena::Cli::Etcd class ListCommand < Clamp::Command include Kontena::Cli::Common parameter "KEY", "Etcd key" option "--recursive", :flag, "List keys recursively", default: false def execute require_api_url token = require_token opts = [] opts << 'recursive=true' if recursive? response = client(token).get("etcd/#{current_grid}/#{key}?#{opts.join('&')}") if response['children'] children = response['children'].map{|c| c['key'] } puts children.join("\n") elsif response['value'] abort "Not a directory" elsif response['error'] abort response['error'] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems