Permalink
Browse files

Basic manpage.

  • Loading branch information...
1 parent 8b636d7 commit 48f56044415a6c52c79022b3a2b1fdf411115c53 @stephencelis committed Apr 25, 2012
Showing with 457 additions and 20 deletions.
  1. +9 −1 Gemfile.lock
  2. +10 −1 Rakefile
  3. +24 −16 ghi
  4. +2 −2 ghi.gemspec
  5. +133 −0 man/ghi.1
  6. +167 −0 man/ghi.1.html
  7. +112 −0 man/ghi.1.ronn
View
@@ -1,14 +1,22 @@
PATH
remote: .
specs:
- ghi (1.0.0.dev)
+ ghi (0.9.0.20120424)
GEM
remote: http://rubygems.org/
specs:
+ hpricot (0.8.4)
+ mustache (0.99.4)
+ rdiscount (1.6.8)
+ ronn (0.7.3)
+ hpricot (>= 0.8.2)
+ mustache (>= 0.7.0)
+ rdiscount (>= 1.5.8)
PLATFORMS
ruby
DEPENDENCIES
ghi!
+ ronn
View
@@ -34,9 +34,18 @@ task :build do
end
end
+desc 'Build the manuals'
+task :man do
+ `ronn man/*.ronn --manual='GHI Manual' --organization='Stephen Celis'`
+end
+
desc 'Install the standalone script'
-task :install => :build do
+task :install => [:build, :man] do
prefix = ENV['PREFIX'] || ENV['prefix'] || '/usr/local'
+
FileUtils.mkdir_p "#{prefix}/bin"
FileUtils.cp 'ghi', "#{prefix}/bin"
+
+ FileUtils.mkdir_p "#{prefix}/share/man/man1"
+ FileUtils.cp Dir["man/*.1"], "#{prefix}/share/man/man1"
end
View
40 ghi
@@ -93,6 +93,12 @@ EOF
exit 1
end
+ def config key
+ var = key.gsub('core', 'git').gsub('.', '_').upcase
+ value = ENV[var] || `git config #{key}`.chomp
+ value unless value.empty?
+ end
+
attr_accessor :v
alias v? v
@@ -1768,7 +1774,14 @@ module GHI
def page header = nil, throttle = 0
if paginate?
- $stdout = IO.popen('less -EKRX -b1', 'w')
+ pager = GHI.config('ghi.pager') || GHI.config('core.pager')
+ pager ||= ENV['PAGER']
+ pager ||= 'less -EKRX -b1'
+
+ if pager && !pager.empty? && pager != 'cat'
+ $stdout = IO.popen pager, 'w'
+ end
+
puts header if header
end
@@ -2174,7 +2187,7 @@ module GHI
class << self
def token
return @token if defined? @token
- @token = config 'ghi.token'
+ @token = GHI.config 'ghi.token'
end
def authorize! user = username, pass = password, local = true
@@ -2218,19 +2231,12 @@ EOF
def username
return @username if defined? @username
- @username = config 'github.user'
+ @username = GHI.config 'github.user'
end
def password
return @password if defined? @password
- @password = config 'github.password'
- end
-
- private
-
- def config key
- value = ENV["#{key.upcase.gsub '.', '_'}"] || `git config #{key}`.chomp
- value unless value.empty?
+ @password = GHI.config 'github.password'
end
end
end
@@ -2375,9 +2381,9 @@ module GHI
private
def editor
- editor = ENV['GHI_EDITOR']
- editor ||= ENV['GIT_EDITOR']
- editor ||= `git config core.editor`.split.first
+ editor = GHI.config 'ghi.editor'
+ editor ||= GHI.config 'core.editor'
+ editor ||= ENV['VISUAL']
editor ||= ENV['EDITOR']
editor ||= 'vi'
end
@@ -2449,8 +2455,10 @@ module GHI
def repo
return @repo if defined? @repo
- @repo = ENV['GHI_REPO'] || `git config --local ghi.repo`.chomp
- @repo = detect_repo if @repo.empty?
+ @repo = GHI.config('ghi.repo') || detect_repo
+ unless @repo.include? '/'
+ @repo = [Authorization.username, @repo].join '/'
+ end
@repo
end
alias extract_repo repo
View
@@ -13,10 +13,10 @@ EOF
s.executables = %w(ghi)
s.has_rdoc = false
- # s.extra_rdoc_files = %w(README.markdown)
- # s.rdoc_options = %w(--main README.markdown)
s.author = 'Stephen Celis'
s.email = 'stephen@stephencelis.com'
s.homepage = 'https://github.com/stephencelis/ghi'
+
+ s.add_development_dependency 'ronn'
end
View
133 man/ghi.1
@@ -0,0 +1,133 @@
+.\" generated with Ronn/v0.7.3
+.\" http://github.com/rtomayko/ronn/tree/0.7.3
+.
+.TH "GHI" "1" "April 2012" "Stephen Celis" "GHI Manual"
+.
+.SH "NAME"
+\fBghi\fR \- the stupid issue tracker
+.
+.SH "SYNOPSIS"
+\fBghi\fR [\fB\-\-version\fR] [\fB\-p\fR|\fB\-\-paginate\fR|\fB\-\-no\-pager\fR] [\fB\-\-help\fR] \fIcommand\fR [\fIargs\fR]
+.
+.br
+\fB\fR \fB\fR \fB\fR \fB\fR [ \fB\-\-\fR [\fIuser\fR/]\fIrepo\fR]]
+.
+.SH "DESCRIPTION"
+GHI is the alphabetical acronym for GitHub Issues\. GHI provides an easy way to manage your issues from the comfort of the command line and your editor of choice\.
+.
+.P
+GHI should look familiar if you\'re familiar with Git\. When invoked from a repository directory with a GitHub remote, GHI will default to work with the repository\'s issues\. Otherwise, GHI will work with your global issues or with a repository terminating its arguments\.
+.
+.P
+The \fIcommand\fR is either the name of a GHI command (see below) or an alias\.
+.
+.SH "OPTIONS"
+.
+.TP
+\fB\-\-version\fR
+Prints the GHI version number\.
+.
+.TP
+\fB\-\-help\fR
+Prints the synopsis and a list of commonly\-used commands\. If a GHI command is named, this option will bring up the manual page for that command\.
+.
+.IP
+See \fBghi\-help\fR(1) for more information\.
+.
+.TP
+\fB\-p\fR, \fB\-\-paginate\fR
+Pipe all output into less if standard output is a terminal\.
+.
+.TP
+\fB\-\-no\-pager\fR
+Do not pipe output into a pager\.
+.
+.TP
+\fB\-\-[no\-]color\fR
+Toggle colorized output\.
+.
+.SH "GHI COMMANDS"
+.
+.TP
+\fBghi\-assign\fR(1)
+Assign an issue to yourself (or someone else)\.
+.
+.TP
+\fBghi\-close\fR(1)
+Close an issue\.
+.
+.TP
+\fBghi\-comment\fR(1)
+Leave a comment on an issue\.
+.
+.TP
+\fBghi\-config\fR(1)
+Configure GHI\.
+.
+.TP
+\fBghi\-edit\fR(1)
+Modify an existing issue\.
+.
+.TP
+\fBghi\-label\fR(1)
+Create, list, modify, or delete labels\.
+.
+.TP
+\fBghi\-list\fR(1)
+List your issues (or a repository\'s)\.
+.
+.TP
+\fBghi\-milestone\fR(1)
+Manage project milestones\.
+.
+.TP
+\fBghi\-open\fR(1)
+Open (or reopen) an issue\.
+.
+.TP
+\fBghi\-show\fR(1)
+Show an issue\'s details\.
+.
+.SH "ENVIRONMENT VARIABLES"
+Various GHI commands use the following environment variables:
+.
+.TP
+\fIGHI_REPO\fR
+The GitHub repository to be used by the issued GHI command\.
+.
+.TP
+\fIGHI_TOKEN\fR
+The OAuth access token used to authenticate you\.
+.
+.TP
+\fIGHI_PAGER\fR
+This environment variable overrides \fI$GIT_PAGER\fR and \fI$PAGER\fR\. If it is set to an empty string or to the value "cat", git will not launch a pager\.
+.
+.TP
+\fIGHI_EDITOR\fR
+This environment variable overrides \fI$GIT_EDITOR\fR, \fI$VISUAL\fR, and \fI$EDITOR\fR\.
+.
+.TP
+\fIGITHUB_USER\fR
+Your GitHub username: used to authenticate and identify you\.
+.
+.TP
+\fIGITHUB_PASSWORD\fR
+If you store your GitHub password in an environment variable, GHI will automatically attempt to fetch an access token using it\.
+.
+.P
+All environment variables may also be stored in Git configuration files where the variable is in lowercase form and the underscore is a period (e\.g\., \fI$GHI_REPO\fR would become the ghi\.repo option)\.
+.
+.SH "AUTHORS"
+GHI is maintained by Stephen Celis\. A full list of contributors can be found at \fIhttps://github\.com/stephencelis/ghi/contributors\fR\.
+.
+.SH "REPORTING BUGS"
+.
+.nf
+
+ghi open \-\- stephencelis/ghi
+.
+.fi
+.
+.P
+Or visit \fIhttps://github\.com/stephencelis/ghi/issues\fR\.
Oops, something went wrong.

0 comments on commit 48f5604

Please sign in to comment.