Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Commit

Permalink
Basic manpage.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis committed Apr 25, 2012
1 parent 8b636d7 commit 48f5604
Show file tree
Hide file tree
Showing 7 changed files with 457 additions and 20 deletions.
10 changes: 9 additions & 1 deletion Gemfile.lock
@@ -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
11 changes: 10 additions & 1 deletion Rakefile
Expand Up @@ -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
40 changes: 24 additions & 16 deletions ghi
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ghi.gemspec
Expand Up @@ -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
133 changes: 133 additions & 0 deletions 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\.

0 comments on commit 48f5604

Please sign in to comment.