Sha256: f127507ee6835bcbead9c82c0f49e348969bb1e064d223bd9e0094482ec489f0

Contents?: true

Size: 842 Bytes

Versions: 8

Compression:

Stored size: 842 Bytes

Contents

module TrelloCli
  module CLI
    module Commands
      module Shared

        def actions(obj = self)
          (obj.methods - obj.class.superclass.instance_methods).sort - shared_methods
        end

        def shared_methods
          TrelloCli::CLI::Commands::Shared.instance_methods
        end

        def target_name
          self.class.name.downcase.split('::').last
        end

        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

        def help
          puts "Valid commands for #{target_name}: #{actions.join(', ')}"
          puts "For further help, append -h to sub command."
        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
trello_cli-0.5.0 lib/trello_cli/cli/commands/shared.rb
trello_cli-0.4.1 lib/trello_cli/cli/commands/shared.rb
trello_cli-0.4.0 lib/trello_cli/cli/commands/shared.rb
trello_cli-0.3.0 lib/trello_cli/cli/commands/shared.rb
trello_cli-0.2.1 lib/trello_cli/cli/commands/shared.rb
trello_cli-0.2.0 lib/trello_cli/cli/commands/shared.rb
trello_cli-0.1.0 lib/trello_cli/cli/commands/shared.rb
trello_cli-0.0.4 lib/trello_cli/cli/commands/shared.rb