Sha256: 5970f3e04543ae30b0229740720903b6b38e2c2b6ced4274989685ffa9ae46f3

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

# encoding: utf-8

module GithubCLI
  class Commands::Forks < Command

    namespace :fork

    option :sort, :type => :string, :aliases => ["-s"],
           :banner => '<sort-category>',
           :desc => 'Sort by newest, oldest or watchers'
    desc 'list <user> <repo>', 'Lists forks'
    long_desc <<-DESC
      List repository forks

      Parameters

      sort - newest, oldest, watchers, default: newest
    DESC
    def list(user, repo)
      global_options = options.dup
      params = options[:params].dup
      params['sort'] = options[:sort] if options[:sort]
      Util.hash_without!(global_options, params.keys + ['params'])
      Fork.all user, repo, params, global_options
    end

    option :org, :type => :string,
           :desc => 'Organization login. The repository will be forked into this organization.'
    desc 'create <user> <repo>', 'Create a new fork'
    def create(user, repo)
      global_options = options.dup
      params = options[:params].dup
      params['organization'] = options[:org] if options[:org]
      Util.hash_without!(global_options, params.keys + ['params', 'org'])
      Fork.create user, repo, params, global_options
    end

  end # Forks
end # GithubCLI

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
github_cli-0.6.2 lib/github_cli/commands/forks.rb
github_cli-0.6.1 lib/github_cli/commands/forks.rb
github_cli-0.6.0 lib/github_cli/commands/forks.rb