doc it

Fri, 09 Dec 2016 15:20:22 -0800

author
Meredith Howard <mhoward@roomag.org>
date
Fri, 09 Dec 2016 15:20:22 -0800
changeset 441
650cbc95b9b0
parent 440
aacbd4032a4c
child 442
eefccfe398e9

doc it

bin/git-ctags file | annotate | diff | comparison | revisions
--- a/bin/git-ctags
+++ b/bin/git-ctags
@@ -1,24 +1,6 @@
 #!/usr/bin/env ruby
-
-# Meant for use as a git hook:
-#   CTAGS_HOOK=1 ~/.git_helpers/ctags &>/dev/null </dev/null &
-# or an aliased cmd on demand:
-#   git config alias.ctags '!.git/hooks/ctags'
-# or disable when you wish:
-#   CTAGS_SKIP=1 git rebase
-
-# Create a tags file (target) using git's list of tracked files.  If
-# .git/ctags.conf exists in the repo it is passed to the ctags invocation.
-#
-# When run w/o env, immediately run ctags and replace tags file.
-#
-# When run with CTAGS_HOOK, it's assumed to be a BG process and we want to wait
-# for git to be done applying changes no matter how the hook is triggered.
-# Wait five seconds, then bail if we can't get a lock on the tags file or if
-# it's been updated within the last minute. Only then, run ctags and replace
-# the tags file.
-
 exit if ENV['CTAGS_SKIP']
+ARGV.each { |o| exec('perldoc', $0) if o.match('help') }
 
 ctags  = 'ctags'
 
@@ -45,5 +27,33 @@ open(target, File::RDONLY|File::CREAT, 0
   CMD
 end
 
+exit 0
 
+<<'=cut'
+=head1 NAME
 
+git-ctags - run ctags on git tracked files
+
+=head1 SYNOPSIS
+
+ git ctags
+
+ echo 'CTAGS_HOOK=1 git ctags &' >> .git/hooks/post-checkout
+
+ git checkout some/branch
+ CTAGS_SKIP=1 git checkout some/branch
+
+=head1 DESCRIPTION
+
+Create a .tags file (target) using git's list of tracked files.  If
+C<.git/ctags.conf> exists in the repo it is passed to the ctags invocation.
+
+When run w/o env, immediately run ctags and replace tags file.
+
+When run with C<CTAGS_HOOK>, it's assumed to be a BG process and we want to
+wait for git to be done applying changes no matter how the hook is triggered.
+Wait five seconds, then bail if we can't get a lock on the tags file or if it's
+been updated within the last minute. Only then, run ctags and replace the tags
+file.
+
+=cut

mercurial