Sha256: 2cfa8648ae21f8cbfaa76ed8b92e7a32b5b8ed5cd468eb01a370664fafc1a42b

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

require "optparse"
require "json"

require "nightcrawler_swift/cli/opt_parser"
require "nightcrawler_swift/cli/runner"
require "nightcrawler_swift/cli/formatters/basic"
require "nightcrawler_swift/cli/commands/url_for"

module NightcrawlerSwift
  module CLI
    CONFIG_FILE = ".nswiftrc"
    CACHE_FILE = ".nswift_cache"

    COMMANDS = {
      "list" => {
        description: "Lists all files of the bucket/container. Ex: nswift list",
        command: NightcrawlerSwift::List
      },

      "download" => {
        description: "Downloads a file by path. Format: nswift download <swift_path> Ex: nswift download assets/robots.txt > my-robots.txt",
        command: NightcrawlerSwift::Download
      },

      "upload" => {
        description: "Uploads some file. Format: nswift upload <real_path> <swift_path> Ex: nswift upload assets/robots.txt robots.txt",
        command: NightcrawlerSwift::Upload
      },

      "delete" => {
        description: "Deletes a file by path. Format: nswift delete <swift_path> Ex: nswift delete robots.txt",
        command: NightcrawlerSwift::Delete
      },

      "url-for" => {
        description: "Returns the public url of an object. Format: nswift url-for <swift_path> Ex: nswift url-for robots.txt",
        command: NightcrawlerSwift::CLI::UrlFor
      }
    }

    def self.sample_rcfile
      JSON.pretty_generate({
        bucket: "<bucket/container name>",
        tenant_name: "<tenant name>",
        username: "<username>",
        password: "<password>",
        auth_url: "<auth url, ex: https://auth.url.com:123/v2.0/tokens>"
      })
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nightcrawler_swift-0.7.0 lib/nightcrawler_swift/cli.rb
nightcrawler_swift-0.6.0 lib/nightcrawler_swift/cli.rb
nightcrawler_swift-0.5.0 lib/nightcrawler_swift/cli.rb