Sha256: 906308737105d7dcb0169477961370ae5d033f7fb03927fda717d39403a922a0

Contents?: true

Size: 1.27 KB

Versions: 13

Compression:

Stored size: 1.27 KB

Contents

module FaaStRuby
  module Command
    class Help < BaseCommand
      def initialize(args)
        @args = args
      end

      def run
        puts "FaaStRuby CLI - Manage workspaces and functions hosted at faastruby.io"
        puts
        puts "Usage: faastruby [--region REGION, -h, -v] COMMAND ARGS"
        puts
        puts 'help, -h, --help     # Displays this help'
        puts '-v                   # Print version and exit'
        puts '--region tor1        # Specify a region. "tor1" (default) is the only region available'
        workspaces = ["Workspaces:"]
        functions = ["Functions:"]
        credentials = ["Credentials:"]
        FaaStRuby::Command::COMMANDS.each do |command, klass|
          next if command == 'upgrade'
          next if klass.to_s.match(/.+Command::Help$/)
          next if klass.to_s.match(/.+Command::Version$/)
          section = functions if klass.to_s.match(/.+::Function::.+/)
          section = workspaces if klass.to_s.match(/.+::Workspace::.+/)
          section = credentials if klass.to_s.match(/.+::Credentials::.+/)
          section ||= []
          section << "  #{klass.help}"
        end
        puts workspaces
        puts
        puts functions
        puts
        puts credentials
        puts
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
faastruby-0.4.18 lib/faastruby/cli/commands/help.rb
faastruby-0.4.17 lib/faastruby/cli/commands/help.rb
faastruby-0.4.16 lib/faastruby/cli/commands/help.rb
faastruby-0.4.15 lib/faastruby/cli/commands/help.rb
faastruby-0.4.14 lib/faastruby/cli/commands/help.rb
faastruby-0.4.12 lib/faastruby/cli/commands/help.rb
faastruby-0.4.11 lib/faastruby/cli/commands/help.rb
faastruby-0.4.10 lib/faastruby/cli/commands/help.rb
faastruby-0.4.9 lib/faastruby/cli/commands/help.rb
faastruby-0.4.8 lib/faastruby/cli/commands/help.rb
faastruby-0.4.7 lib/faastruby/cli/commands/help.rb
faastruby-0.4.6 lib/faastruby/cli/commands/help.rb
faastruby-0.4.5 lib/faastruby/cli/commands/help.rb