Sha256: 021ece630cba1d697ec226b2499274c67f1b7ff360d6fc5d2e7ddda2340b9138
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
module Legion class Cli class Chain < Thor desc 'create', 'create' def create(name) Legion::Service.new(cache: false, crypt: false, extensions: false, log_level: 'error') say "chain created, id: #{Legion::Data::Model::Chain.insert({ name: name })}", :green end desc 'show', 'show' option :limit, type: :numeric, required: true, default: 10, desc: 'how many tasks to return' def show Legion::Service.new(cache: false, crypt: false, extensions: false, log_level: 'error') rows = [%w[id name active]] Legion::Data::Model::Chain.limit(options[:limit]).order(:id).reverse_each do |row| rows.push([row.values[:id], row.values[:name], row.values[:active]]) end print_table rows end desc 'delete', 'delete' option :confirm, type: :boolean def delete(id) Legion::Service.new(cache: false, crypt: false, extensions: false, log_level: 'error') unless options[:confirm] return unless yes? "Are you sure you want to delete chain #{id} and all dependent relationships", :red end Legion::Data::Model::Chain[id].delete say 'Deleted!' end default_task :show end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
legion-cli-0.2.0 | lib/legion/cli/chain.rb |