]> git.donarmstrong.com Git - bin.git/blob - bibtex_to_paper
more work on bibtex to paper
[bin.git] / bibtex_to_paper
1 #!/usr/bin/perl
2 # bibtex_to_paper opens the paper corresponding to a bibtex key
3 # and is released under the terms of the GNU GPL version 3, or any
4 # later version, at your option. See the file README and COPYING for
5 # more information.
6 # Copyright 2014 by Don Armstrong <don@donarmstrong.com>.
7
8
9 use warnings;
10 use strict;
11
12 use Getopt::Long;
13 use Pod::Usage;
14
15 use File::Find;
16 use Text::Bibtex;
17
18 =head1 NAME
19
20 bibtex_to_paper - opens the paper corresponding to a bibtex key
21
22 =head1 SYNOPSIS
23
24 bibtex_to_paper [options] bibtexkey
25
26  Options:
27   --bibtex, -b bibtex file to look up key in
28   --bibtex-cache, -c bibtex cache file
29   --build-cache, -B build cache using bibtex files
30   --pdf-dir pdf directory
31   --pdfviewer, -p pdf viewer to use
32   --debug, -d debugging level (Default 0)
33   --help, -h display this help
34   --man, -m display manual
35
36 =head1 OPTIONS
37
38 =over
39
40 =item B<--bibtex, -b>
41
42 Bibtex file to look key up in
43
44 =item B<--bibtex-cache, -c>
45
46 Bibtex cache file; rebuilt if bibtex file changes
47
48 =item B<--pdfviewer, -p>
49
50 PDF viewer to use; defaults to evince unless a .xoj exists, in which
51 case xournal is used.
52
53 =item B<--debug, -d>
54
55 Debug verbosity. (Default 0)
56
57 =item B<--help, -h>
58
59 Display brief usage information.
60
61 =item B<--man, -m>
62
63 Display this manual.
64
65 =back
66
67 =head1 EXAMPLES
68
69 bibtex_to_paper
70
71 =cut
72
73
74 use vars qw($DEBUG);
75
76 my %options = (debug           => 0,
77                help            => 0,
78                man             => 0,
79               );
80
81 GetOptions(\%options,
82            'build_cache|build-cache|B!',
83            'bibtex|b=s',
84            'bibtex_cache|bibtex-cache|c=s',
85            'pdfviewer|p=s',
86            'debug|d+','help|h|?','man|m');
87
88 pod2usage() if $options{help};
89 pod2usage({verbose=>2}) if $options{man};
90
91 $DEBUG = $options{debug};
92
93 my @USAGE_ERRORS;
94 if (not exists $options{bibtex} and
95     not exists $options{bibtex_cache}) {
96     push @USAGE_ERRORS,
97         "You must give at least one of --bibtex".
98         "or --bibtex-cache";
99 }
100
101 pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
102
103 sub parse_bibtex_file {
104     
105 }
106
107
108 sub initialize_database {
109     my 
110 }
111
112 __END__