github_cli 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +14 -3
- data/CHANGELOG.md +15 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +41 -44
- data/README.md +77 -14
- data/Rakefile +4 -2
- data/features/assignee.feature +1 -0
- data/features/blob.feature +1 -0
- data/features/collaborator.feature +1 -0
- data/features/commit.feature +2 -1
- data/features/config.feature +27 -28
- data/features/event.feature +1 -0
- data/features/init.feature +20 -23
- data/features/key.feature +5 -5
- data/features/milestone.feature +3 -2
- data/features/reference.feature +3 -2
- data/features/starring.feature +1 -0
- data/features/support/hooks.rb +1 -1
- data/features/tag.feature +2 -1
- data/features/tree.feature +17 -0
- data/features/watching.feature +1 -0
- data/fixtures/simple_config +3 -5
- data/github_cli.gemspec +1 -1
- data/lib/github_cli/api.rb +11 -6
- data/lib/github_cli/apis/event.rb +8 -8
- data/lib/github_cli/apis/label.rb +0 -12
- data/lib/github_cli/apis/starring.rb +5 -5
- data/lib/github_cli/apis/watching.rb +5 -5
- data/lib/github_cli/cli.rb +21 -30
- data/lib/github_cli/command.rb +1 -1
- data/lib/github_cli/commands/authorizations.rb +28 -2
- data/lib/github_cli/commands/collaborators.rb +12 -12
- data/lib/github_cli/commands/commits.rb +18 -2
- data/lib/github_cli/commands/events.rb +6 -8
- data/lib/github_cli/commands/followers.rb +1 -1
- data/lib/github_cli/commands/labels.rb +22 -20
- data/lib/github_cli/commands/milestones.rb +43 -13
- data/lib/github_cli/commands/references.rb +21 -6
- data/lib/github_cli/commands/starring.rb +3 -2
- data/lib/github_cli/commands/tags.rb +16 -1
- data/lib/github_cli/commands/trees.rb +11 -5
- data/lib/github_cli/commands/watching.rb +3 -2
- data/lib/github_cli/config.rb +15 -6
- data/lib/github_cli/dsl.rb +2 -2
- data/lib/github_cli/formatter.rb +2 -3
- data/lib/github_cli/formatters/csv.rb +29 -14
- data/lib/github_cli/formatters/table.rb +2 -3
- data/lib/github_cli/man/gcli-config.1 +17 -13
- data/lib/github_cli/man/gcli-config.1.txt +23 -21
- data/lib/github_cli/vendor/thor/actions/create_link.rb +3 -0
- data/lib/github_cli/vendor/thor/actions/directory.rb +29 -10
- data/lib/github_cli/vendor/thor/actions/file_manipulation.rb +9 -3
- data/lib/github_cli/vendor/thor/actions.rb +18 -18
- data/lib/github_cli/vendor/thor/base.rb +97 -89
- data/lib/github_cli/vendor/thor/{task.rb → command.rb} +16 -12
- data/lib/github_cli/vendor/thor/core_ext/hash_with_indifferent_access.rb +5 -0
- data/lib/github_cli/vendor/thor/core_ext/io_binary_read.rb +12 -0
- data/lib/github_cli/vendor/thor/error.rb +4 -7
- data/lib/github_cli/vendor/thor/group.rb +34 -32
- data/lib/github_cli/vendor/thor/invocation.rb +28 -26
- data/lib/github_cli/vendor/thor/parser/options.rb +66 -26
- data/lib/github_cli/vendor/thor/rake_compat.rb +3 -2
- data/lib/github_cli/vendor/thor/runner.rb +21 -20
- data/lib/github_cli/vendor/thor/shell/basic.rb +20 -16
- data/lib/github_cli/vendor/thor/shell/color.rb +13 -9
- data/lib/github_cli/vendor/thor/shell/html.rb +13 -9
- data/lib/github_cli/vendor/thor/util.rb +214 -210
- data/lib/github_cli/vendor/thor/version.rb +1 -1
- data/lib/github_cli/vendor/thor.rb +232 -153
- data/lib/github_cli/version.rb +1 -1
- data/man/gcli-config.1.ronn +14 -11
- data/spec/github_cli/commands/assignees_spec.rb +20 -0
- data/spec/github_cli/commands/blobs_spec.rb +21 -0
- data/spec/github_cli/commands/collaborators_spec.rb +31 -0
- data/spec/github_cli/commands/commits_spec.rb +26 -0
- data/spec/github_cli/commands/emails_spec.rb +24 -0
- data/spec/github_cli/commands/events_spec.rb +56 -0
- data/spec/github_cli/commands/followers_spec.rb +44 -0
- data/spec/github_cli/commands/keys_spec.rb +36 -0
- data/spec/github_cli/commands/labels_spec.rb +61 -0
- data/spec/github_cli/commands/milestones_spec.rb +47 -0
- data/spec/github_cli/commands/references_spec.rb +42 -0
- data/spec/github_cli/commands/starring_spec.rb +40 -0
- data/spec/github_cli/commands/tags_spec.rb +26 -0
- data/spec/github_cli/commands/trees_spec.rb +32 -0
- data/spec/github_cli/commands/watching_spec.rb +40 -0
- data/spec/github_cli/config_spec.rb +109 -116
- data/spec/github_cli/util/convert_value_spec.rb +19 -0
- data/spec/github_cli/util/convert_values_spec.rb +14 -0
- data/spec/github_cli/util_spec.rb +0 -29
- metadata +51 -19
- data/lib/github_cli/vendor/thor/core_ext/dir_escape.rb +0 -0
- data/lib/github_cli/vendor/thor/core_ext/file_binary_read.rb +0 -9
- data/lib/github_cli/vendor/thor/empty.txt +0 -0
@@ -6,6 +6,12 @@ module GithubCLI
|
|
6
6
|
namespace :milestone
|
7
7
|
|
8
8
|
desc 'list <user> <repo>', 'List milestones for a repository'
|
9
|
+
option :state, :type => :string, :default => "open",
|
10
|
+
:desc => "open, closed, default: open"
|
11
|
+
option :sort, :type => :string, :default => "due_date",
|
12
|
+
:desc => "due_date, completeness, default: due_date"
|
13
|
+
option :direction, :type => :string, :default => "desc",
|
14
|
+
:desc => "asc, desc, default: desc"
|
9
15
|
long_desc <<-DESC
|
10
16
|
Parameters
|
11
17
|
|
@@ -14,15 +20,24 @@ module GithubCLI
|
|
14
20
|
direction - asc, desc, default: desc\n
|
15
21
|
DESC
|
16
22
|
def list(user, repo)
|
17
|
-
|
23
|
+
params = options[:params].dup
|
24
|
+
params['state'] = options[:state] || 'open'
|
25
|
+
params['sort'] = options[:sort] || 'due_date'
|
26
|
+
params['direction'] = options[:direction] || 'desc'
|
27
|
+
Milestone.all user, repo, params, options[:format]
|
18
28
|
end
|
19
29
|
|
20
|
-
desc 'get <user> <repo> <
|
21
|
-
def get(user, repo,
|
22
|
-
Milestone.get user, repo,
|
30
|
+
desc 'get <user> <repo> <number>', 'Get a single milestone'
|
31
|
+
def get(user, repo, number)
|
32
|
+
Milestone.get user, repo, number, options[:params], options[:format]
|
23
33
|
end
|
24
34
|
|
25
35
|
desc 'create <user> <repo>', 'Create a milestone'
|
36
|
+
option :title, :type => :string, :required => true
|
37
|
+
option :state, :type => :string, :default => "open",
|
38
|
+
:desc => "open, closed, default: open"
|
39
|
+
option :desc, :type => :string
|
40
|
+
option :due_on, :type => :string, :desc => "Optional string - ISO 8601 time"
|
26
41
|
long_desc <<-DESC
|
27
42
|
Parameters
|
28
43
|
|
@@ -33,13 +48,23 @@ module GithubCLI
|
|
33
48
|
|
34
49
|
Example
|
35
50
|
|
36
|
-
ghc milestone create wycats thor --
|
51
|
+
ghc milestone create wycats thor --title=new
|
37
52
|
DESC
|
38
53
|
def create(user, repo)
|
39
|
-
|
54
|
+
params = options[:params].dup
|
55
|
+
params['title'] = options[:title]
|
56
|
+
params['state'] = options[:state] if options[:state]
|
57
|
+
params['description'] = options[:desc] if options[:desc]
|
58
|
+
params['due_on'] = options[:due_on] if options[:due_on]
|
59
|
+
Milestone.create user, repo, params, options[:format]
|
40
60
|
end
|
41
61
|
|
42
|
-
desc 'update <user> <repo> <
|
62
|
+
desc 'update <user> <repo> <number>', 'Update a milestone'
|
63
|
+
option :title, :type => :string
|
64
|
+
option :state, :type => :string, :default => "open",
|
65
|
+
:desc => "open, closed, default: open"
|
66
|
+
option :desc, :type => :string
|
67
|
+
option :due_on, :type => :string, :desc => "Optional string - ISO 8601 time"
|
43
68
|
long_desc <<-DESC
|
44
69
|
Parameters
|
45
70
|
|
@@ -50,15 +75,20 @@ module GithubCLI
|
|
50
75
|
|
51
76
|
Example
|
52
77
|
|
53
|
-
ghc milestone update wycats thor 1 --
|
78
|
+
ghc milestone update wycats thor 1 --title=new
|
54
79
|
DESC
|
55
|
-
def update(user, repo,
|
56
|
-
|
80
|
+
def update(user, repo, number)
|
81
|
+
params = options[:params].dup
|
82
|
+
params['title'] = options[:title] if options[:title]
|
83
|
+
params['state'] = options[:state] if options[:state]
|
84
|
+
params['description'] = options[:desc] if options[:desc]
|
85
|
+
params['due_on'] = options[:due_on] if options[:due_on]
|
86
|
+
Milestone.update user, repo, number, params, options[:format]
|
57
87
|
end
|
58
88
|
|
59
|
-
desc 'delete <user> <repo> <
|
60
|
-
def delete(user, repo,
|
61
|
-
Milestone.delete user, repo,
|
89
|
+
desc 'delete <user> <repo> <number>', 'Delete a milestone'
|
90
|
+
def delete(user, repo, number)
|
91
|
+
Milestone.delete user, repo, number, options[:params], options[:format]
|
62
92
|
end
|
63
93
|
|
64
94
|
end # Milestones
|
@@ -6,12 +6,13 @@ module GithubCLI
|
|
6
6
|
namespace :ref
|
7
7
|
|
8
8
|
desc 'list <user> <repo>', 'List all References'
|
9
|
-
|
9
|
+
option :ref, :type => :string, :banner => 'branch reference'
|
10
10
|
def list(user, repo)
|
11
|
+
params = options[:params].dup
|
11
12
|
if options[:ref]
|
12
|
-
|
13
|
+
params['ref'] = options[:ref]
|
13
14
|
end
|
14
|
-
Reference.list user, repo,
|
15
|
+
Reference.list user, repo, params, options[:format]
|
15
16
|
end
|
16
17
|
|
17
18
|
desc 'get <user> <repo> <ref>', 'Get a Reference'
|
@@ -20,17 +21,28 @@ module GithubCLI
|
|
20
21
|
end
|
21
22
|
|
22
23
|
desc 'create <user> <repo>', 'Create a new Reference'
|
24
|
+
option :ref, :type => :string, :required => true, :banner => "<ref>",
|
25
|
+
:desc => "String of the name of the fully qualified reference (ie: refs/heads/master). If it doesn’t start with ‘refs’ and have at least two slashes, it will be rejected."
|
26
|
+
option :sha, :type => :string, :required => true,
|
27
|
+
:desc => "String of the SHA1 value to set this reference to."
|
23
28
|
long_desc <<-DESC
|
24
29
|
Inputs
|
25
30
|
|
26
31
|
ref - String of the name of the fully qualified reference (ie: refs/heads/master). If it doesn’t start with ‘refs’ and have at least two slashes, it will be rejected.\n
|
27
|
-
sha - String of the SHA1 value to set this reference to
|
32
|
+
sha - String of the SHA1 value to set this reference to.
|
28
33
|
DESC
|
29
34
|
def create(user, repo)
|
30
|
-
|
35
|
+
params = options[:params].dup
|
36
|
+
params['ref'] = options[:ref] if options[:ref]
|
37
|
+
params['sha'] = options[:sha] if options[:sha]
|
38
|
+
Reference.create user, repo, params, options[:format]
|
31
39
|
end
|
32
40
|
|
33
41
|
desc 'update <user> <repo> <ref>', 'Update a Reference'
|
42
|
+
option :sha, :type => :string, :required => true,
|
43
|
+
:desc => "String of the SHA1 value to set this reference to."
|
44
|
+
option :force => false, :default => 'false', :aliases => ["-f"],
|
45
|
+
:desc => "Boolean indicating whether to force the update or to make sure the update is a fast-forward update."
|
34
46
|
long_desc <<-DESC
|
35
47
|
Inputs
|
36
48
|
|
@@ -38,7 +50,10 @@ module GithubCLI
|
|
38
50
|
force - Boolean indicating whether to force the update or to make sure the update is a fast-forward update. The default is <tt>false</tt>, so leaving this out or setting it to false will make sure you’re not overwriting work.
|
39
51
|
DESC
|
40
52
|
def update(user, repo, ref)
|
41
|
-
|
53
|
+
params = options[:params].dup
|
54
|
+
params['sha'] = options[:sha] if options[:sha]
|
55
|
+
params['force'] = options[:force] || false
|
56
|
+
Reference.update user, repo, ref, params, options[:format]
|
42
57
|
end
|
43
58
|
|
44
59
|
desc 'delete <user> <repo> <ref>', 'Delete a Reference'
|
@@ -14,10 +14,11 @@ module GithubCLI
|
|
14
14
|
method_option :user, :type => :string, :aliases => ["-u"],
|
15
15
|
:desc => 'Starred repositories for <user>'
|
16
16
|
def starred
|
17
|
+
params = options[:params].dup
|
17
18
|
if options[:user]
|
18
|
-
|
19
|
+
params['user'] = options[:user]
|
19
20
|
end
|
20
|
-
Starring.starred
|
21
|
+
Starring.starred params, options[:format]
|
21
22
|
end
|
22
23
|
|
23
24
|
desc 'starring <user> <repo>', 'Check if you are starring a repository'
|
@@ -13,6 +13,14 @@ module GithubCLI
|
|
13
13
|
end
|
14
14
|
|
15
15
|
desc 'create <user> <repo>', 'Create a Tag Object'
|
16
|
+
option :tag, :type => :string, :desc => "String of the tag"
|
17
|
+
option :message, :type => :string, :aliases => ["-m"],
|
18
|
+
:desc => "String of the tag message"
|
19
|
+
option :object, :type => :string, :banner => "<SHA>",
|
20
|
+
:desc => "String of the SHA of the git object this is tagging"
|
21
|
+
option :type, :type => :string, :banner => "commit/tree/blob",
|
22
|
+
:desc => "String of the type of the object we're tagging."
|
23
|
+
option :tagger, :type => :hash, :desc => "Tag author information"
|
16
24
|
long_desc <<-DESC
|
17
25
|
Note that creating a tag object does not create the reference that
|
18
26
|
makes a tag in Git. If you want to create an annotated tag in Git,
|
@@ -31,7 +39,14 @@ module GithubCLI
|
|
31
39
|
tagger.date - Timestamp of when this object was tagged \n
|
32
40
|
DESC
|
33
41
|
def create(user, repo)
|
34
|
-
|
42
|
+
params = options[:params].dup
|
43
|
+
params['tag'] = options[:tag] if options[:tag]
|
44
|
+
params['message'] = options[:message] if options[:message]
|
45
|
+
params['object'] = options[:object] if options[:object]
|
46
|
+
params['type'] = optiosn[:type] if options[:type]
|
47
|
+
params['tagger'] = options[:tagger] if options[:tagger]
|
48
|
+
|
49
|
+
Tag.create user, repo, params, options[:format]
|
35
50
|
end
|
36
51
|
|
37
52
|
end # Tag
|
@@ -9,13 +9,16 @@ module GithubCLI
|
|
9
9
|
method_option :recursive, :type => :boolean, :aliases => ["-r"],
|
10
10
|
:desc => 'get a tree recursively'
|
11
11
|
def get(user, repo, sha)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
Tree.get user, repo, sha, options[:params], options[:format]
|
12
|
+
params = options[:params].dup
|
13
|
+
params['recursive'] = options[:recursive] if options[:recursive]
|
14
|
+
Tree.get user, repo, sha, params, options[:format]
|
16
15
|
end
|
17
16
|
|
18
17
|
desc 'create <user> <repo>', 'Create a new Tree'
|
18
|
+
option :base_tree, :type => :string, :banner => "<SHA>",
|
19
|
+
:desc => "optional string of the SHA1 of the tree you want to update with new data"
|
20
|
+
option :tree, :type => :array,
|
21
|
+
:desc => "array of hash objects(of :path, :mode, :type and sha)"
|
19
22
|
long_desc <<-DESC
|
20
23
|
The tree creation API will take nested entries as well.
|
21
24
|
If both a tree and a nested path modifying that tree are specified,
|
@@ -33,7 +36,10 @@ module GithubCLI
|
|
33
36
|
tree.content - String of content you want this file to have - GitHub will write this blob out and use the SHA for this entry. Use either this or tree.sha
|
34
37
|
DESC
|
35
38
|
def create(user, repo)
|
36
|
-
|
39
|
+
params = options[:params].dup
|
40
|
+
params['base_tree'] = options[:base_tree] if options[:base_tree]
|
41
|
+
params['tree'] = options[:tree] if options[:tree]
|
42
|
+
Tree.create user, repo, params, options[:format]
|
37
43
|
end
|
38
44
|
|
39
45
|
end # Blobs
|
@@ -14,10 +14,11 @@ module GithubCLI
|
|
14
14
|
method_option :user, :type => :string, :aliases => ["-u"],
|
15
15
|
:desc => 'Watch repositories for <user>'
|
16
16
|
def watched
|
17
|
+
params = options[:params].dup
|
17
18
|
if options[:user]
|
18
|
-
|
19
|
+
params['user'] = options[:user]
|
19
20
|
end
|
20
|
-
Watching.watched
|
21
|
+
Watching.watched params, options[:format]
|
21
22
|
end
|
22
23
|
|
23
24
|
desc 'watching <user> <repo>', 'Check if you are watching a repository'
|
data/lib/github_cli/config.rb
CHANGED
@@ -3,9 +3,11 @@
|
|
3
3
|
module GithubCLI
|
4
4
|
class Config
|
5
5
|
|
6
|
-
COMMAND_KEY = 'commands'
|
6
|
+
COMMAND_KEY = 'commands'.freeze
|
7
7
|
|
8
|
-
COMMAND_HELP = 'help'
|
8
|
+
COMMAND_HELP = 'help'.freeze
|
9
|
+
|
10
|
+
DEFAULT_NAME = '.githubrc'.freeze
|
9
11
|
|
10
12
|
# Contains information of where the command is run from.
|
11
13
|
attr_reader :root
|
@@ -13,8 +15,15 @@ module GithubCLI
|
|
13
15
|
# Location scope of currently used configuration file.
|
14
16
|
attr_reader :location
|
15
17
|
|
18
|
+
# Name for the confiugration file
|
19
|
+
attr_accessor :filename
|
20
|
+
|
21
|
+
# Initialize a Config
|
22
|
+
#
|
23
|
+
# @api public
|
16
24
|
def initialize(root, options={})
|
17
|
-
@root
|
25
|
+
@root = root
|
26
|
+
@filename = options.fetch(:filename) { DEFAULT_NAME }
|
18
27
|
@local_config = local_options_file
|
19
28
|
@global_config = global_options_file
|
20
29
|
end
|
@@ -64,7 +73,7 @@ module GithubCLI
|
|
64
73
|
composite_key = "#{COMMAND_KEY}.#{cmd.namespace}.#{cmd.name}"
|
65
74
|
if !cmd.namespace.empty? && cmd.name != COMMAND_HELP &&
|
66
75
|
!config.has_key?(composite_key)
|
67
|
-
config[composite_key]=
|
76
|
+
config[composite_key]= nil
|
68
77
|
end
|
69
78
|
end
|
70
79
|
File.open(path, 'w', 0600) do |file|
|
@@ -93,12 +102,12 @@ module GithubCLI
|
|
93
102
|
private
|
94
103
|
|
95
104
|
def local_options_file
|
96
|
-
Pathname.new "#{root}
|
105
|
+
Pathname.new "#{root}/#{filename}"
|
97
106
|
end
|
98
107
|
|
99
108
|
def global_options_file
|
100
109
|
begin
|
101
|
-
Pathname.new File.join(Thor::Util.user_home,
|
110
|
+
Pathname.new File.join(Thor::Util.user_home, filename)
|
102
111
|
rescue ArgumentError
|
103
112
|
GithubCLI.ui.warn "Unable to find ~/.githubrc because the HOME environment variable is not set"
|
104
113
|
exit 1
|
data/lib/github_cli/dsl.rb
CHANGED
data/lib/github_cli/formatter.rb
CHANGED
@@ -21,9 +21,8 @@ module GithubCLI
|
|
21
21
|
def determine_output_formatter
|
22
22
|
case format.to_s
|
23
23
|
when 'table', /table:v.*/, /table:h.*/
|
24
|
-
formatter = Formatters::Table.new(response,
|
25
|
-
:transform => format.to_s.split(':').last
|
26
|
-
)
|
24
|
+
formatter = Formatters::Table.new(response.body,
|
25
|
+
:transform => format.to_s.split(':').last)
|
27
26
|
formatter.format
|
28
27
|
when 'csv'
|
29
28
|
formatter = Formatters::CSV.new(response)
|
@@ -4,34 +4,49 @@ module GithubCLI
|
|
4
4
|
module Formatters
|
5
5
|
class CSV
|
6
6
|
|
7
|
+
attr_reader :response
|
8
|
+
|
7
9
|
def initialize(response)
|
8
10
|
@response = response
|
9
11
|
end
|
10
12
|
|
11
13
|
def format
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
render_line indx, item
|
14
|
+
if response.respond_to?(:to_ary)
|
15
|
+
render_headers(response.first)
|
16
|
+
response.each_with_index do |item, indx|
|
17
|
+
render_line(indx, item)
|
17
18
|
Terminal.newline
|
18
19
|
end
|
19
|
-
|
20
|
-
render_headers
|
21
|
-
render_line
|
20
|
+
elsif response.respond_to?(:keys)
|
21
|
+
render_headers(response)
|
22
|
+
render_line(1, response)
|
22
23
|
else
|
23
|
-
Terminal.line "#{
|
24
|
+
Terminal.line "#{response}\n"
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
|
-
def render_headers(
|
28
|
-
output =
|
29
|
-
|
28
|
+
def render_headers(header)
|
29
|
+
output = header
|
30
|
+
if header.respond_to?(:to_hash)
|
31
|
+
output = GithubCLI::Util.flatten_hash(header.to_hash)
|
32
|
+
output = "Index,#{output.keys.join(',')}\n"
|
33
|
+
elsif header.respond_to?(:to_ary)
|
34
|
+
output = "Index,#{header.join(',')}\n"
|
35
|
+
end
|
36
|
+
|
37
|
+
Terminal.line output
|
30
38
|
end
|
31
39
|
|
32
40
|
def render_line(index, item)
|
33
|
-
output =
|
34
|
-
|
41
|
+
output = item
|
42
|
+
if item.respond_to?(:to_hash)
|
43
|
+
output = GithubCLI::Util.flatten_hash(item.to_hash)
|
44
|
+
output = output.values.join(',')
|
45
|
+
elsif item.respond_to?(:to_ary)
|
46
|
+
output = item.join(',')
|
47
|
+
end
|
48
|
+
|
49
|
+
$stdout.printf "%d,%s", index, output
|
35
50
|
end
|
36
51
|
|
37
52
|
end # CSV
|
@@ -70,8 +70,7 @@ module GithubCLI
|
|
70
70
|
# Builds output array from response hash
|
71
71
|
#
|
72
72
|
def build_output
|
73
|
-
|
74
|
-
when Array
|
73
|
+
if response.respond_to?(:to_ary)
|
75
74
|
case transform
|
76
75
|
when :horizontal
|
77
76
|
array = [flatten_hash(response[0].to_hash).keys]
|
@@ -88,7 +87,7 @@ module GithubCLI
|
|
88
87
|
array
|
89
88
|
end
|
90
89
|
end
|
91
|
-
|
90
|
+
elsif response.respond_to?(:to_hash)
|
92
91
|
output = flatten_hash(response)
|
93
92
|
case transform
|
94
93
|
when :horizontal
|
@@ -1,19 +1,19 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "GCLI\-CONFIG" "1" "
|
4
|
+
.TH "GCLI\-CONFIG" "1" "March 2013" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBgcli\-config\fR \- Get or set global or local configuration options
|
8
8
|
.
|
9
9
|
.SH "SYNOPSIS"
|
10
|
-
\fBgcli config\fR \-\-
|
10
|
+
\fBgcli config\fR [\-\-local] name [value]
|
11
11
|
.
|
12
12
|
.br
|
13
|
-
\fBgcli config\fR \-\-
|
13
|
+
\fBgcli config\fR [\-\-local] \fB\-l | \-list\fR [name_regex]
|
14
14
|
.
|
15
15
|
.br
|
16
|
-
\fBgcli config\fR \-\-
|
16
|
+
\fBgcli config\fR [\-\-local] \fB\-e | \-\-edit\fR
|
17
17
|
.
|
18
18
|
.SH "DESCRIPTION"
|
19
19
|
You can query/set options with this command\. The name is actually a hash key string that is a composite one, nested with dots\. If only name is provided, a value will be retrieved\. If two parameters are given then value will be set or updated depending whether it already exists or not\.\en
|
@@ -32,10 +32,6 @@ The config file is invalid\.
|
|
32
32
|
.SH "OPTIONS"
|
33
33
|
.
|
34
34
|
.TP
|
35
|
-
\fB\-\-global\fR
|
36
|
-
Writes configuration settings to global ~/\.githubrc file inside user home directory\.
|
37
|
-
.
|
38
|
-
.TP
|
39
35
|
\fB\-\-local\fR
|
40
36
|
Writes cofinguration settings inside the current directory to the \.githubrc file\.
|
41
37
|
.
|
@@ -59,12 +55,20 @@ The configuration file is written in \fByaml\fR\. Therfore all formatting rules
|
|
59
55
|
.SS "VARIABLES"
|
60
56
|
.
|
61
57
|
.TP
|
62
|
-
\
|
58
|
+
\fBuser\.token\fR
|
63
59
|
Authentication token\.
|
64
60
|
.
|
65
61
|
.TP
|
66
|
-
\
|
67
|
-
Basic credentials
|
62
|
+
\fBuser\.login\fR
|
63
|
+
Basic login credentials\.
|
64
|
+
.
|
65
|
+
.TP
|
66
|
+
\fBuser\.password\fR
|
67
|
+
Basic password credentials\.
|
68
|
+
.
|
69
|
+
.TP
|
70
|
+
\fBcore\.adapter\fR
|
71
|
+
Sets http adapter used to perform requests to GitHub API v3\.
|
68
72
|
.
|
69
73
|
.TP
|
70
74
|
\fBcore\.endpoint\fR
|
@@ -80,7 +84,7 @@ The command that will be used to paginate output\. Can be overridden with PAGER
|
|
80
84
|
.
|
81
85
|
.TP
|
82
86
|
\fBcore\.no\-pager\fR
|
83
|
-
|
87
|
+
Switched off results paging\.
|
84
88
|
.
|
85
89
|
.TP
|
86
90
|
\fBcore\.no\-color\fR
|
@@ -91,7 +95,7 @@ If set to true disables color output\. By default is set to false\.
|
|
91
95
|
Determines output formatting\. Defaults to table output\.
|
92
96
|
.
|
93
97
|
.TP
|
94
|
-
\fBcore\.
|
98
|
+
\fBcore\.auto_pagination\fR
|
95
99
|
Automatic pagination of requests to GitHub\.
|
96
100
|
.
|
97
101
|
.TP
|
@@ -6,9 +6,9 @@ NAME
|
|
6
6
|
gcli-config - Get or set global or local configuration options
|
7
7
|
|
8
8
|
SYNOPSIS
|
9
|
-
gcli config --
|
10
|
-
gcli config --
|
11
|
-
gcli config --
|
9
|
+
gcli config [--local] name [value]
|
10
|
+
gcli config [--local] -l | -list [name_regex]
|
11
|
+
gcli config [--local] -e | --edit
|
12
12
|
|
13
13
|
DESCRIPTION
|
14
14
|
You can query/set options with this command. The name is actually a
|
@@ -27,12 +27,8 @@ DESCRIPTION
|
|
27
27
|
|
28
28
|
|
29
29
|
OPTIONS
|
30
|
-
--global
|
31
|
-
Writes configuration settings to global ~/.githubrc file inside
|
32
|
-
user home directory.
|
33
|
-
|
34
30
|
--local
|
35
|
-
Writes
|
31
|
+
Writes cofinguration settings inside the current directory to
|
36
32
|
the .githubrc file.
|
37
33
|
|
38
34
|
-l, --list
|
@@ -41,48 +37,54 @@ OPTIONS
|
|
41
37
|
-e, --edit
|
42
38
|
Opens an editor to modify the specified config file.
|
43
39
|
|
44
|
-
Defaults
|
40
|
+
Defaults to vi editor if non specified. It first looks inside
|
45
41
|
--global or --local config, then searches environement variables
|
46
42
|
EDITOR and VISUAL before assuming default.
|
47
43
|
|
48
44
|
CONFIGURATION FILE
|
49
|
-
The
|
45
|
+
The gcli configuration file contains a number of variables that affect
|
50
46
|
the way the GitHub API is quried.
|
51
47
|
|
52
48
|
SYNTAX
|
53
|
-
The
|
49
|
+
The configuration file is written in yaml. Therfore all formatting
|
54
50
|
rules are derived from yaml specification.
|
55
51
|
|
56
52
|
VARIABLES
|
57
|
-
|
53
|
+
user.token
|
58
54
|
Authentication token.
|
59
55
|
|
60
|
-
|
61
|
-
Basic credentials
|
56
|
+
user.login
|
57
|
+
Basic login credentials.
|
58
|
+
|
59
|
+
user.password
|
60
|
+
Basic password credentials.
|
61
|
+
|
62
|
+
core.adapter
|
63
|
+
Sets http adapter used to perform requests to GitHub API v3.
|
62
64
|
|
63
65
|
core.endpoint
|
64
|
-
Sets
|
66
|
+
Sets host path used as the base for all requests to GitHub API
|
65
67
|
v3.
|
66
68
|
|
67
69
|
core.editor
|
68
|
-
Sets
|
70
|
+
Sets the editor to be used when opening files. By default vi is
|
69
71
|
specified.
|
70
72
|
|
71
73
|
core.pager
|
72
|
-
The
|
74
|
+
The command that will be used to paginate output. Can be over-
|
73
75
|
ridden with PAGER environment variable. less
|
74
76
|
|
75
77
|
core.no-pager
|
76
|
-
|
78
|
+
Switched off results paging.
|
77
79
|
|
78
80
|
core.no-color
|
79
|
-
If
|
81
|
+
If set to true disables color output. By default is set to
|
80
82
|
false.
|
81
83
|
|
82
84
|
core.format
|
83
85
|
Determines output formatting. Defaults to table output.
|
84
86
|
|
85
|
-
core.
|
87
|
+
core.auto_pagination
|
86
88
|
Automatic pagination of requests to GitHub.
|
87
89
|
|
88
90
|
core.aliases
|
@@ -93,4 +95,4 @@ AUTHOR
|
|
93
95
|
|
94
96
|
|
95
97
|
|
96
|
-
|
98
|
+
March 2013 GCLI-CONFIG(1)
|
@@ -38,6 +38,7 @@ class Thor
|
|
38
38
|
# destination<String>:: the relative path to the destination root.
|
39
39
|
# config<Hash>:: give :verbose => false to not log the status.
|
40
40
|
# If :recursive => false, does not look for paths recursively.
|
41
|
+
# If :mode => :preserve, preserve the file mode from the source.
|
41
42
|
#
|
42
43
|
# ==== Examples
|
43
44
|
#
|
@@ -73,26 +74,44 @@ class Thor
|
|
73
74
|
def execute!
|
74
75
|
lookup = Util.escape_globs(source)
|
75
76
|
lookup = config[:recursive] ? File.join(lookup, '**') : lookup
|
76
|
-
lookup =
|
77
|
+
lookup = file_level_lookup(lookup)
|
77
78
|
|
78
|
-
|
79
|
+
files(lookup).sort.each do |file_source|
|
79
80
|
next if File.directory?(file_source)
|
80
81
|
file_destination = File.join(given_destination, file_source.gsub(source, '.'))
|
81
82
|
file_destination.gsub!('/./', '/')
|
82
83
|
|
83
84
|
case file_source
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
when /\.empty_directory$/
|
86
|
+
dirname = File.dirname(file_destination).gsub(/\/\.$/, '')
|
87
|
+
next if dirname == given_destination
|
88
|
+
base.empty_directory(dirname, config)
|
89
|
+
when /\.tt$/
|
90
|
+
destination = base.template(file_source, file_destination[0..-4], config, &@block)
|
91
|
+
else
|
92
|
+
destination = base.copy_file(file_source, file_destination, config, &@block)
|
92
93
|
end
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
97
|
+
if RUBY_VERSION < '2.0'
|
98
|
+
def file_level_lookup(previous_lookup)
|
99
|
+
File.join(previous_lookup, '{*,.[a-z]*}')
|
100
|
+
end
|
101
|
+
|
102
|
+
def files(lookup)
|
103
|
+
Dir[lookup]
|
104
|
+
end
|
105
|
+
else
|
106
|
+
def file_level_lookup(previous_lookup)
|
107
|
+
File.join(previous_lookup, '*')
|
108
|
+
end
|
109
|
+
|
110
|
+
def files(lookup)
|
111
|
+
Dir.glob(lookup, File::FNM_DOTMATCH)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
96
115
|
end
|
97
116
|
end
|
98
117
|
end
|