Module: TrelloCli::CLI::Commands::Shared
Instance Method Summary collapse
- #actions(obj = self) ⇒ Object
- #ensure_credential_envs_set ⇒ Object
- #help ⇒ Object
- #shared_methods ⇒ Object
- #target_name ⇒ Object
Instance Method Details
#actions(obj = self) ⇒ Object
6 7 8 |
# File 'lib/trello_cli/cli/commands/shared.rb', line 6 def actions(obj = self) (obj.methods - obj.class.superclass.instance_methods).sort - shared_methods end |
#ensure_credential_envs_set ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/trello_cli/cli/commands/shared.rb', line 18 def ensure_credential_envs_set %w{TRELLO_MEMBER_TOKEN TRELLO_DEVELOPER_PUBLIC_KEY}.each do |e| unless ENV[e] puts "#{e} environment variable not set" exit 1 end end end |
#help ⇒ Object
27 28 29 30 |
# File 'lib/trello_cli/cli/commands/shared.rb', line 27 def help puts "Valid commands for #{target_name}: #{actions.join(', ')}" puts "For further help, append -h to sub command." end |
#shared_methods ⇒ Object
10 11 12 |
# File 'lib/trello_cli/cli/commands/shared.rb', line 10 def shared_methods TrelloCli::CLI::Commands::Shared.instance_methods end |
#target_name ⇒ Object
14 15 16 |
# File 'lib/trello_cli/cli/commands/shared.rb', line 14 def target_name self.class.name.downcase.split('::').last end |