github_cli 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/.travis.yml +0 -2
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +9 -3
- data/README.md +68 -48
- data/Rakefile +47 -1
- data/bin/gcli +18 -0
- data/bin/ghc +1 -17
- data/features/blob.feature +6 -6
- data/features/collaborator.feature +10 -10
- data/features/commit.feature +6 -6
- data/features/completion.feature +3 -3
- data/features/config.feature +55 -0
- data/features/content.feature +9 -9
- data/features/download.feature +11 -11
- data/features/email.feature +8 -8
- data/features/errors.feature +11 -9
- data/features/event.feature +20 -20
- data/features/executable.feature +4 -4
- data/features/follower.feature +13 -13
- data/features/fork.feature +6 -6
- data/features/gist.feature +22 -22
- data/features/hook.feature +14 -14
- data/features/init.feature +48 -0
- data/features/issue.feature +12 -12
- data/features/key.feature +12 -12
- data/features/label.feature +23 -23
- data/features/member.feature +13 -13
- data/features/milestone.feature +12 -12
- data/features/organization.feature +9 -9
- data/features/pull_request.feature +18 -18
- data/features/reference.feature +13 -13
- data/features/repository.feature +20 -20
- data/features/search.feature +10 -10
- data/features/search_commands.feature +4 -4
- data/features/support/hooks.rb +3 -1
- data/features/tag.feature +6 -6
- data/features/team.feature +28 -28
- data/features/tree.feature +5 -5
- data/features/usage.feature +3 -3
- data/features/user.feature +7 -7
- data/features/watching.feature +13 -13
- data/fixtures/simple_config +9 -8
- data/github_cli.gemspec +2 -2
- data/lib/github_cli/api.rb +3 -3
- data/lib/github_cli/cli.rb +96 -17
- data/lib/github_cli/config.rb +30 -9
- data/lib/github_cli/editor.rb +11 -6
- data/lib/github_cli/man/gcli-config.1 +102 -0
- data/lib/github_cli/man/gcli-config.1.txt +96 -0
- data/lib/github_cli/man/gcli-repo.1 +16 -0
- data/lib/github_cli/man/gcli-repo.1.txt +15 -0
- data/lib/github_cli/man/gcli.1 +34 -0
- data/lib/github_cli/man/gcli.1.txt +33 -0
- data/lib/github_cli/manpage.rb +42 -0
- data/lib/github_cli/pager.rb +1 -1
- data/lib/github_cli/terminal.rb +8 -2
- data/lib/github_cli/thor_ext.rb +12 -1
- data/lib/github_cli/vendor.rb +10 -0
- data/lib/github_cli/version.rb +1 -1
- data/lib/github_cli.rb +7 -2
- data/man/gcli-config.1.ronn +82 -0
- data/man/gcli-repo.1.ronn +7 -0
- data/man/gcli.1.ronn +29 -0
- data/spec/github_cli/config_spec.rb +21 -7
- metadata +43 -22
- data/features/settings.feature +0 -35
data/lib/github_cli/config.rb
CHANGED
@@ -4,10 +4,15 @@ module GithubCLI
|
|
4
4
|
class Config
|
5
5
|
|
6
6
|
COMMAND_KEY = 'commands'
|
7
|
+
|
7
8
|
COMMAND_HELP = 'help'
|
8
9
|
|
10
|
+
# Contains information of where the command is run from.
|
9
11
|
attr_reader :root
|
10
12
|
|
13
|
+
# Location scope of currently used configuration file.
|
14
|
+
attr_reader :location
|
15
|
+
|
11
16
|
def initialize(root, options={})
|
12
17
|
@root = root
|
13
18
|
@local_config = local_options_file
|
@@ -20,15 +25,15 @@ module GithubCLI
|
|
20
25
|
end
|
21
26
|
|
22
27
|
def [](key)
|
23
|
-
data[key] || data[COMMAND_KEY
|
28
|
+
data[key] || data["#{COMMAND_KEY}.#{key}"] rescue nil
|
24
29
|
end
|
25
30
|
|
26
31
|
def fetch(key, default=nil)
|
27
|
-
|
32
|
+
self[key] || default || raise(IndexError.new("key #{key} not found"))
|
28
33
|
end
|
29
34
|
|
30
35
|
def delete(key)
|
31
|
-
|
36
|
+
data.delete(key)
|
32
37
|
end
|
33
38
|
|
34
39
|
def data
|
@@ -39,11 +44,27 @@ module GithubCLI
|
|
39
44
|
data.keys
|
40
45
|
end
|
41
46
|
|
47
|
+
def all
|
48
|
+
data
|
49
|
+
end
|
50
|
+
|
51
|
+
def pretty(pattern="")
|
52
|
+
all.keys.zip(all.values).map do |el|
|
53
|
+
el.last.nil? ? [el.first, 'UNDEFINED'] : el
|
54
|
+
end.select { |el| el.first =~ /^#{pattern}.*$/i }
|
55
|
+
end
|
56
|
+
|
57
|
+
def location=(loc)
|
58
|
+
@location = loc
|
59
|
+
@data = nil
|
60
|
+
end
|
61
|
+
|
42
62
|
def save(config)
|
43
|
-
config[COMMAND_KEY] = {}
|
44
63
|
Command.all.each do |cmd|
|
45
|
-
|
46
|
-
|
64
|
+
composite_key = "#{COMMAND_KEY}.#{cmd.namespace}.#{cmd.name}"
|
65
|
+
if !cmd.namespace.empty? && cmd.name != COMMAND_HELP &&
|
66
|
+
!config.has_key?(composite_key)
|
67
|
+
config[composite_key]= {}
|
47
68
|
end
|
48
69
|
end
|
49
70
|
File.open(path, 'w', 0600) do |file|
|
@@ -62,7 +83,7 @@ module GithubCLI
|
|
62
83
|
end
|
63
84
|
|
64
85
|
def path
|
65
|
-
if File.exists?(local_options_file)
|
86
|
+
if location == 'local' || File.exists?(local_options_file)
|
66
87
|
local_options_file
|
67
88
|
else
|
68
89
|
global_options_file
|
@@ -80,7 +101,7 @@ module GithubCLI
|
|
80
101
|
Pathname.new File.join(Thor::Util.user_home, ".githubrc")
|
81
102
|
rescue ArgumentError
|
82
103
|
GithubCLI.ui.warn "Unable to find ~/.githubrc because the HOME environment variable is not set"
|
83
|
-
|
104
|
+
exit 1
|
84
105
|
end
|
85
106
|
end
|
86
107
|
|
@@ -88,7 +109,7 @@ module GithubCLI
|
|
88
109
|
unless data[key] == value
|
89
110
|
data[key] = value
|
90
111
|
data.delete(key) if value.nil?
|
91
|
-
save data
|
112
|
+
save data
|
92
113
|
end
|
93
114
|
value
|
94
115
|
end
|
data/lib/github_cli/editor.rb
CHANGED
@@ -4,22 +4,27 @@ module GithubCLI
|
|
4
4
|
# This class determines editor to use to open the output.
|
5
5
|
class Editor
|
6
6
|
|
7
|
-
|
7
|
+
attr_accessor :filename
|
8
|
+
|
9
|
+
def initialize(filename, options={})
|
10
|
+
@filename = filename
|
8
11
|
end
|
9
12
|
|
10
13
|
def editor
|
11
|
-
editors = [ ENV['
|
12
|
-
|
13
|
-
|
14
|
+
editors = [ ENV['GCLI_EDITOR'], ENV['VISUAL'], ENV['EDITOR'], 'vi' ]
|
15
|
+
editors.unshift(GithubCLI.config['core.editor'])
|
16
|
+
editors.compact.uniq.find { |editor| System.command? editor }
|
14
17
|
end
|
15
18
|
|
16
|
-
def open(name)
|
19
|
+
def open(name=nil)
|
17
20
|
if editor
|
18
|
-
command = "#{editor} #{
|
21
|
+
command = "#{editor} #{filename}"
|
19
22
|
success = system(command)
|
20
23
|
GithubCLI.ui.info "Could not run '#{command}'" unless success
|
24
|
+
exit success
|
21
25
|
else
|
22
26
|
GithubCLI.info("To open output, set $EDITOR or $VISUL")
|
27
|
+
exit 1
|
23
28
|
end
|
24
29
|
end
|
25
30
|
|
@@ -0,0 +1,102 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "GCLI\-CONFIG" "1" "July 2012" "" ""
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBgcli\-config\fR \- Get or set global or local configuration options
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
\fBgcli config\fR \-\-global|\-\-local name [value]
|
11
|
+
.
|
12
|
+
.br
|
13
|
+
\fBgcli config\fR \-\-global|\-\-local \fB\-l | \-list\fR [name_regex]
|
14
|
+
.
|
15
|
+
.br
|
16
|
+
\fBgcli config\fR \-\-global|\-\-local \fB\-e | \-\-edit\fR
|
17
|
+
.
|
18
|
+
.SH "DESCRIPTION"
|
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
|
20
|
+
.
|
21
|
+
.P
|
22
|
+
There two types of config files, global and project specific\. When modifying options ensure that you modifying the correct config\.
|
23
|
+
.
|
24
|
+
.P
|
25
|
+
This command line will fail (with the exit code ret) if:
|
26
|
+
.
|
27
|
+
.IP "1." 4
|
28
|
+
The config file is invalid\.
|
29
|
+
.
|
30
|
+
.IP "" 0
|
31
|
+
.
|
32
|
+
.SH "OPTIONS"
|
33
|
+
.
|
34
|
+
.TP
|
35
|
+
\fB\-\-global\fR
|
36
|
+
Writes configuration settings to global ~/\.githubrc file inside user home directory\.
|
37
|
+
.
|
38
|
+
.TP
|
39
|
+
\fB\-\-local\fR
|
40
|
+
Writes cofinguration settings inside the current directory to the \.githubrc file\.
|
41
|
+
.
|
42
|
+
.TP
|
43
|
+
\fB\-l, \-\-list\fR
|
44
|
+
List all variables set in config file\.
|
45
|
+
.
|
46
|
+
.TP
|
47
|
+
\fB\-e, \-\-edit\fR
|
48
|
+
Opens an editor to modify the specified config file\.
|
49
|
+
.
|
50
|
+
.IP
|
51
|
+
Defaults to \fBvi\fR editor if non specified\. It first looks inside \-\-global or \-\-local config, then searches environement variables \fBEDITOR\fR and \fBVISUAL\fR before assuming default\.
|
52
|
+
.
|
53
|
+
.SH "CONFIGURATION FILE"
|
54
|
+
The \fBgcli\fR configuration file contains a number of variables that affect the way the GitHub API is quried\.
|
55
|
+
.
|
56
|
+
.SS "SYNTAX"
|
57
|
+
The configuration file is written in \fByaml\fR\. Therfore all formatting rules are derived from yaml specification\.
|
58
|
+
.
|
59
|
+
.SS "VARIABLES"
|
60
|
+
.
|
61
|
+
.TP
|
62
|
+
\fBauth\.token\fR
|
63
|
+
Authentication token\.
|
64
|
+
.
|
65
|
+
.TP
|
66
|
+
\fBauth\.basic\fR
|
67
|
+
Basic credentials in the form \fBlogin:password\fR\.
|
68
|
+
.
|
69
|
+
.TP
|
70
|
+
\fBcore\.endpoint\fR
|
71
|
+
Sets host path used as the base for all requests to GitHub API v3\.
|
72
|
+
.
|
73
|
+
.TP
|
74
|
+
\fBcore\.editor\fR
|
75
|
+
Sets the editor to be used when opening files\. By default \fBvi\fR is specified\.
|
76
|
+
.
|
77
|
+
.TP
|
78
|
+
\fBcore\.pager\fR
|
79
|
+
The command that will be used to paginate output\. Can be overridden with PAGER environment variable\. less
|
80
|
+
.
|
81
|
+
.TP
|
82
|
+
\fBcore\.no\-pager\fR
|
83
|
+
false
|
84
|
+
.
|
85
|
+
.TP
|
86
|
+
\fBcore\.no\-color\fR
|
87
|
+
If set to true disables color output\. By default is set to false\.
|
88
|
+
.
|
89
|
+
.TP
|
90
|
+
\fBcore\.format\fR
|
91
|
+
Determines output formatting\. Defaults to table output\.
|
92
|
+
.
|
93
|
+
.TP
|
94
|
+
\fBcore\.auto\fR
|
95
|
+
Automatic pagination of requests to GitHub\.
|
96
|
+
.
|
97
|
+
.TP
|
98
|
+
\fBcore\.aliases\fR
|
99
|
+
Global aliases used by commands\.
|
100
|
+
.
|
101
|
+
.SH "AUTHOR"
|
102
|
+
Piotr Murach
|
@@ -0,0 +1,96 @@
|
|
1
|
+
GCLI-CONFIG(1) GCLI-CONFIG(1)
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
NAME
|
6
|
+
gcli-config - Get or set global or local configuration options
|
7
|
+
|
8
|
+
SYNOPSIS
|
9
|
+
gcli config --global|--local name [value]
|
10
|
+
gcli config --global|--local -l | -list [name_regex]
|
11
|
+
gcli config --global|--local -e | --edit
|
12
|
+
|
13
|
+
DESCRIPTION
|
14
|
+
You can query/set options with this command. The name is actually a
|
15
|
+
hash key string that is a composite one, nested with dots. If only name
|
16
|
+
is provided, a value will be retrieved. If two parameters are given
|
17
|
+
then value will be set or updated depending whether it already exists
|
18
|
+
or not.\n
|
19
|
+
|
20
|
+
There two types of config files, global and project specific. When mod-
|
21
|
+
ifying options ensure that you modifying the correct config.
|
22
|
+
|
23
|
+
This command line will fail (with the exit code ret) if:
|
24
|
+
|
25
|
+
1. The config file is invalid.
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
OPTIONS
|
30
|
+
--global
|
31
|
+
Writes configuration settings to global ~/.githubrc file inside
|
32
|
+
user home directory.
|
33
|
+
|
34
|
+
--local
|
35
|
+
Writes cofinguration settings inside the current directory to
|
36
|
+
the .githubrc file.
|
37
|
+
|
38
|
+
-l, --list
|
39
|
+
List all variables set in config file.
|
40
|
+
|
41
|
+
-e, --edit
|
42
|
+
Opens an editor to modify the specified config file.
|
43
|
+
|
44
|
+
Defaults to vi editor if non specified. It first looks inside
|
45
|
+
--global or --local config, then searches environement variables
|
46
|
+
EDITOR and VISUAL before assuming default.
|
47
|
+
|
48
|
+
CONFIGURATION FILE
|
49
|
+
The gcli configuration file contains a number of variables that affect
|
50
|
+
the way the GitHub API is quried.
|
51
|
+
|
52
|
+
SYNTAX
|
53
|
+
The configuration file is written in yaml. Therfore all formatting
|
54
|
+
rules are derived from yaml specification.
|
55
|
+
|
56
|
+
VARIABLES
|
57
|
+
auth.token
|
58
|
+
Authentication token.
|
59
|
+
|
60
|
+
auth.basic
|
61
|
+
Basic credentials in the form login:password.
|
62
|
+
|
63
|
+
core.endpoint
|
64
|
+
Sets host path used as the base for all requests to GitHub API
|
65
|
+
v3.
|
66
|
+
|
67
|
+
core.editor
|
68
|
+
Sets the editor to be used when opening files. By default vi is
|
69
|
+
specified.
|
70
|
+
|
71
|
+
core.pager
|
72
|
+
The command that will be used to paginate output. Can be over-
|
73
|
+
ridden with PAGER environment variable. less
|
74
|
+
|
75
|
+
core.no-pager
|
76
|
+
false
|
77
|
+
|
78
|
+
core.no-color
|
79
|
+
If set to true disables color output. By default is set to
|
80
|
+
false.
|
81
|
+
|
82
|
+
core.format
|
83
|
+
Determines output formatting. Defaults to table output.
|
84
|
+
|
85
|
+
core.auto
|
86
|
+
Automatic pagination of requests to GitHub.
|
87
|
+
|
88
|
+
core.aliases
|
89
|
+
Global aliases used by commands.
|
90
|
+
|
91
|
+
AUTHOR
|
92
|
+
Piotr Murach
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
July 2012 GCLI-CONFIG(1)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "GCLI\-REPO" "1" "July 2012" "" ""
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBgcli\-repo\fR \- Manage repository data
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
\fBgcli repo\fR \fBbranches\fR user repo
|
11
|
+
.
|
12
|
+
.br
|
13
|
+
\fBgcli repo\fR \fBcontribs|contributors\fR user repo
|
14
|
+
.
|
15
|
+
.br
|
16
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "GCLI" "1" "July 2012" "" ""
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBgcli\fR \- Command Line Access to GitHub API v3
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
\fBgcli\fR COMMAND SUBCOMMAND [\fIargs\fR]
|
11
|
+
.
|
12
|
+
.SH "DESCRIPTION"
|
13
|
+
The \fBgcli\fR utility integrates command line with GitHub API v3\.
|
14
|
+
.
|
15
|
+
.SH "OPTIONS"
|
16
|
+
.
|
17
|
+
.TP
|
18
|
+
\fB\-\-token\fR
|
19
|
+
Authentication token\.
|
20
|
+
.
|
21
|
+
.TP
|
22
|
+
\fB\-\-no\-color\fR
|
23
|
+
Prints output without color\.
|
24
|
+
.
|
25
|
+
.TP
|
26
|
+
\fB\-\-pager\fR
|
27
|
+
Sets command to be used for paging results\. This option can be also set in the configuration file\.
|
28
|
+
.
|
29
|
+
.TP
|
30
|
+
\fB\-\-verbose\fR
|
31
|
+
Include
|
32
|
+
.
|
33
|
+
.SH "AUTHOR"
|
34
|
+
Piotr Murach
|
@@ -0,0 +1,33 @@
|
|
1
|
+
GCLI(1) GCLI(1)
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
NAME
|
6
|
+
gcli - Command Line Access to GitHub API v3
|
7
|
+
|
8
|
+
SYNOPSIS
|
9
|
+
gcli COMMAND SUBCOMMAND [args]
|
10
|
+
|
11
|
+
DESCRIPTION
|
12
|
+
The gcli utility integrates command line with GitHub API v3.
|
13
|
+
|
14
|
+
OPTIONS
|
15
|
+
--token
|
16
|
+
Authentication token.
|
17
|
+
|
18
|
+
--no-color
|
19
|
+
Prints output without color.
|
20
|
+
|
21
|
+
--pager
|
22
|
+
Sets command to be used for paging results. This option can be
|
23
|
+
also set in the configuration file.
|
24
|
+
|
25
|
+
--verbose
|
26
|
+
Include
|
27
|
+
|
28
|
+
AUTHOR
|
29
|
+
Piotr Murach
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
July 2012 GCLI(1)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module GithubCLI
|
4
|
+
module Manpage
|
5
|
+
extend self
|
6
|
+
|
7
|
+
MANPAGES = %w[
|
8
|
+
gcli-config.1
|
9
|
+
]
|
10
|
+
|
11
|
+
def has?(command)
|
12
|
+
yield self if MANPAGES.include? command
|
13
|
+
end
|
14
|
+
|
15
|
+
# The groff command with extra arguments to turn
|
16
|
+
# roff into terminal output
|
17
|
+
def groff
|
18
|
+
"groff -Wall -mtty-char -mandoc -Tascii"
|
19
|
+
end
|
20
|
+
|
21
|
+
# Check if groff is installed on the system
|
22
|
+
def has_groff?
|
23
|
+
System.command? 'groff'
|
24
|
+
end
|
25
|
+
|
26
|
+
# Check if man is installed on the system
|
27
|
+
def has_man?
|
28
|
+
System.command? 'man'
|
29
|
+
end
|
30
|
+
|
31
|
+
def show(command)
|
32
|
+
root = File.expand_path("../man", __FILE__)
|
33
|
+
|
34
|
+
if has_groff?
|
35
|
+
system "#{groff} #{root}/#{command} | #{Pager.pager_command}"
|
36
|
+
else
|
37
|
+
system "#{Pager.pager_command} #{root}/#{command}.txt"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end # Manpage
|
42
|
+
end # GithubCLI
|
data/lib/github_cli/pager.rb
CHANGED
data/lib/github_cli/terminal.rb
CHANGED
@@ -68,7 +68,8 @@ module GithubCLI
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def print_command_not_found(cmd)
|
71
|
-
|
71
|
+
exec_name = GithubCLI.executable_name
|
72
|
+
GithubCLI.ui.info "#{exec_name}: '#{cmd}' is not a #{exec_name} command. See '#{exec_name} --help'."
|
72
73
|
end
|
73
74
|
|
74
75
|
def print_usage(flags, command='<command>')
|
@@ -76,11 +77,16 @@ module GithubCLI
|
|
76
77
|
|
77
78
|
#{GithubCLI.program_name}
|
78
79
|
|
79
|
-
Usage:
|
80
|
+
Usage: #{GithubCLI.executable_name} #{GithubCLI::Command::Usage.new(command, flags).format_usage }
|
80
81
|
|
81
82
|
TEXT
|
82
83
|
end
|
83
84
|
|
85
|
+
def print_config(pattern=nil)
|
86
|
+
GithubCLI.ui.info "Configuration options:"
|
87
|
+
GithubCLI.ui.print_table GithubCLI.config.pretty(pattern)
|
88
|
+
end
|
89
|
+
|
84
90
|
end
|
85
91
|
|
86
92
|
end # Terminal
|
data/lib/github_cli/thor_ext.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
1
|
+
$:.unshift File.expand_path('../vendor/thor', __FILE__)
|
2
2
|
require 'thor'
|
3
|
+
require 'github_cli'
|
3
4
|
|
4
5
|
class Thor
|
5
6
|
include Thor::Base
|
@@ -51,8 +52,18 @@ class Thor
|
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
55
|
+
MANPAGES = %w[
|
56
|
+
gcli-config.1
|
57
|
+
]
|
58
|
+
|
54
59
|
desc "help <command>", "Describe available commands or one specific command"
|
55
60
|
def help(task = nil, subcommand = false)
|
61
|
+
command = "gcli-#{task}.1"
|
62
|
+
|
63
|
+
GithubCLI::Manpage.has?(command) do |manpage|
|
64
|
+
manpage.show(command) && return
|
65
|
+
end
|
66
|
+
|
56
67
|
task ? self.class.task_help(shell, task) : self.class.help(shell, subcommand)
|
57
68
|
end
|
58
69
|
end # Thor
|
@@ -0,0 +1,10 @@
|
|
1
|
+
vendor_dir = File.expand_path('../vendor', __FILE__)
|
2
|
+
|
3
|
+
# Add any vendored libraries into search path
|
4
|
+
Dir.glob(vendor_dir + '/*').each do |dir|
|
5
|
+
$LOAD_PATH.unshift File.join(dir, 'lib')
|
6
|
+
end
|
7
|
+
$:.unshift File.expand_path('../vendor/thor', __FILE__)
|
8
|
+
|
9
|
+
require 'thor'
|
10
|
+
require 'thor/group'
|
data/lib/github_cli/version.rb
CHANGED
data/lib/github_cli.rb
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'yaml'
|
4
4
|
require 'pathname'
|
5
|
-
require '
|
6
|
-
require 'thor/group'
|
5
|
+
require 'github_cli/vendor'
|
7
6
|
require 'github_api'
|
8
7
|
require 'github_cli/thor_ext'
|
9
8
|
require 'github_cli/version'
|
@@ -19,6 +18,8 @@ module GithubCLI
|
|
19
18
|
autoload :Terminal, 'github_cli/terminal'
|
20
19
|
autoload :System, 'github_cli/system'
|
21
20
|
autoload :Pager, 'github_cli/pager'
|
21
|
+
autoload :Editor, 'github_cli/editor'
|
22
|
+
autoload :Manpage, 'github_cli/manpage'
|
22
23
|
autoload :Commands, 'github_cli/commands'
|
23
24
|
autoload :Helpers, 'github_cli/helpers'
|
24
25
|
autoload :Formatter, 'github_cli/formatter'
|
@@ -42,6 +43,10 @@ module GithubCLI
|
|
42
43
|
@ui ||= UI.new
|
43
44
|
end
|
44
45
|
|
46
|
+
def executable_name
|
47
|
+
File.basename($PROGRAM_NAME)
|
48
|
+
end
|
49
|
+
|
45
50
|
def default_configfile
|
46
51
|
Helpers.default_configfile
|
47
52
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
gcli-config(1) - Get or set global or local configuration options
|
2
|
+
=================================================================
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
`gcli config` --global|--local name [value]<br>
|
7
|
+
`gcli config` --global|--local `-l | -list` [name_regex]<br>
|
8
|
+
`gcli config` --global|--local `-e | --edit`
|
9
|
+
|
10
|
+
## DESCRIPTION
|
11
|
+
|
12
|
+
You can query/set options with this command. The name is actually a hash key
|
13
|
+
string that is a composite one, nested with dots. If only name is provided, a
|
14
|
+
value will be retrieved. If two parameters are given then value will be set
|
15
|
+
or updated depending whether it already exists or not.\n
|
16
|
+
|
17
|
+
There two types of config files, global and project specific. When modifying
|
18
|
+
options ensure that you modifying the correct config.
|
19
|
+
|
20
|
+
This command line will fail (with the exit code ret) if:
|
21
|
+
|
22
|
+
1. The config file is invalid.
|
23
|
+
|
24
|
+
## OPTIONS
|
25
|
+
|
26
|
+
* `--global`:
|
27
|
+
Writes configuration settings to global ~/.githubrc file inside user home directory.
|
28
|
+
|
29
|
+
* `--local`:
|
30
|
+
Writes cofinguration settings inside the current directory to the .githubrc file.
|
31
|
+
|
32
|
+
* `-l, --list`:
|
33
|
+
List all variables set in config file.
|
34
|
+
|
35
|
+
* `-e, --edit`:
|
36
|
+
Opens an editor to modify the specified config file.
|
37
|
+
|
38
|
+
Defaults to `vi` editor if non specified. It first looks inside --global or --local config, then searches environement variables `EDITOR` and `VISUAL` before assuming default.
|
39
|
+
|
40
|
+
## CONFIGURATION FILE
|
41
|
+
|
42
|
+
The `gcli` configuration file contains a number of variables that affect the way the GitHub API is quried.
|
43
|
+
|
44
|
+
### SYNTAX
|
45
|
+
|
46
|
+
The configuration file is written in `yaml`. Therfore all formatting rules are derived from yaml specification.
|
47
|
+
|
48
|
+
### VARIABLES
|
49
|
+
|
50
|
+
* `auth.token`:
|
51
|
+
Authentication token.
|
52
|
+
|
53
|
+
* `auth.basic`:
|
54
|
+
Basic credentials in the form `login:password`.
|
55
|
+
|
56
|
+
* `core.endpoint`:
|
57
|
+
Sets host path used as the base for all requests to GitHub API v3.
|
58
|
+
|
59
|
+
* `core.editor`:
|
60
|
+
Sets the editor to be used when opening files. By default `vi` is specified.
|
61
|
+
|
62
|
+
* `core.pager`:
|
63
|
+
The command that will be used to paginate output. Can be overridden with PAGER environment variable. less
|
64
|
+
|
65
|
+
* `core.no-pager`:
|
66
|
+
false
|
67
|
+
|
68
|
+
* `core.no-color`:
|
69
|
+
If set to true disables color output. By default is set to false.
|
70
|
+
|
71
|
+
* `core.format`:
|
72
|
+
Determines output formatting. Defaults to table output.
|
73
|
+
|
74
|
+
* `core.auto`:
|
75
|
+
Automatic pagination of requests to GitHub.
|
76
|
+
|
77
|
+
* `core.aliases`:
|
78
|
+
Global aliases used by commands.
|
79
|
+
|
80
|
+
## AUTHOR
|
81
|
+
|
82
|
+
Piotr Murach
|