Sha256: 06f3ce88420310b4450526c49edb2fa2fb26a5800cfe57768983c48b4cb9e18e

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

# encoding: utf-8

module GithubCLI
  class Commands::Forks < Command

    namespace :fork

    desc 'list <user> <repo>', 'Lists forks'
    long_desc <<-DESC
      List repository forks
      Parameters
        sort - newest, oldest, watchers, default: newest
    DESC
    method_option :sort, :type => :string, :aliases => ["-s"],
                  :desc => 'Sort by newest, oldest or watchers',
                  :banner => '<sort-category>'
    method_option :params, :type => :hash, :default => {},
                  :desc => 'Additional request parameters e.i per_page:100'
    def list(user, repo)
      if options[:sort]
        options[:params]['sort'] = options[:sort]
      end
      Fork.all user, repo, options[:params]
    end

    desc 'create <user> <repo>', 'Create a new Blob'
    method_option :org, :type => :string,
                  :desc => ' Organization login. The repository will be forked into this organization.'
    method_option :params, :type => :hash, :default => {},
                  :desc => 'Additonal request parameters e.i per_page:100'
    def create(user, repo)
      if options[:org]
        options[:params]['org'] = options[:org]
      end
      Fork.create user, repo, options[:params]
    end

  end # Forks
end # GithubCLI

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
github_cli-0.1.3 lib/github_cli/commands/forks.rb