/usr/bin/catmandu is in libcatmandu-perl 0.9206-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | #!/usr/bin/env perl
use Catmandu;
use Catmandu::CLI;
use Cwd ();
Catmandu->default_load_path(Cwd::getcwd);
Catmandu::CLI->run // exit(2);
=head1 NAME
catmandu - LibreCat command line tools
=head1 SYNOPSIS
catmandu [-D|-D2|-D3] [-I path] [-L path] [COMMAND] [-?hqv] [long options...] [ARGS]
catmandu --version
catmandu help
# convert
catmandu convert JSON to YAML < file.json
catmandu convert YAML to JSON < file.yaml
catmandu convert YAML < file.yaml # 'to JSON' is implicit
catmandu convert MARC < records.mrc
catmandu convert MARC --fix 'marc_map(245,title)' < records.mrc
catmandu convert OAI --url https://biblio.ugent.be/oai
catmandu convert SRU --base http://www.unicat.be/sru --query dna
# import
catmandu import JSON to MongoDB --database_name mydb < records.json
catmandu import MARC to MongoDB --database_name mydb < records.mrc
catmandu import MARC to ElasticSearch --index_name mydb < records.mrc
catmandu import MARC to ElasticSearch --index_name mydb --fix 'marc_map("245a","title")' < records.mrc
# export
catmandu export MongoDB --database_name mydb --bag data to JSON
catmandu export MongoDB --database_name mydb --bag data to JSON --fix 'retain_field("_id")'
catmandu export Solr --url http://localhost:8983/solr to JSON
catmandu export ElasticSearch --index_name mydb to JSON
# configuration
$ cat catmandu.yml
---
store:
test1:
package: MongoDB
options:
database_name: mydb
catmandu import JSON to test1 < records.json
catmandu config # show the contents of catmandu.yml
catmandu count test1
catmandu delete test1 -q 'title:"My Rabbit"'
=head1 COMMANDS
=head2 help COMMAND
Documentation about command line options.
=head2 config
Display the contents of the catmandu.yml files in your project.
=head2 convert IMPORTER [OPTIONS] [[--fix FIX]] to EXPORTER [OPTIONS]
Convert data from one format to another format with help of L<Catmandu::Importer>s and
L<Catmandu::Exporter>s. All options given on the command line will be send to the Importer
or Exporter as initialization parameters. E.g.
catmandu convert OAI --url BASEURL --metadataPrefx PREFIX \
to \
CSV --header 1 --sep_char '|'
Look at the documentation of all the importers and exporters to see which options are
available.
All importers accept one or more --fix options with the name of a fix file or file command.
catmandu convert JSON --fix fixes.txt
catmandu convert JSON --fix 'remove_field(abc)'
The JSON exporter is implicit and is optional.
catmandu convert YAML to JSON
catmandu convert YAML # shorter
=head2 count STORE [OPTIONS]
Count the number of items in a L<Catmandu::Store>. All options given on the command line
will be send to the store as initialization parameters. E.g.
catmandu count MongoDB --database_name mydb --bag data
=head2 delete STORE [OPTIONS] [-q QUERY]
Delete items from a L<Catmandu::Store>. All options given on the command line
will be send to the store as initialization parameters. Optionally a QUERY can
be provided to select the items to delete. E.g.
catmandu delete MongoDB --database_name mydb --bag data -q "title:Delete me"
=head2 export STORE [OPTIONS] [-q QUERY] [--limit LIMIT] [[--fix FIX]] to EXPORTER [OPTIONS]
Export items from a L<Catmandu::Store> using a L<Catmandu::Exporter>. All options given
on the command line will be send to the Store or Exporter as initialization parameters.
Optionally a QUERY and LIMIT can be provided to selectively export items from the Store.
Optionally a FIX can be provided to be executed on all the items before they are
exporter by the exporter.
E.g.
catmandu export MongoDB --database_name mydb --bag data -q "title:Perl"
=head2 import IMPORTER [OPTIONS] [[--fix FIX]] to STORE [OPTIONS]
Import items from a L<Catmandu::Importer> to a L<Catmandu::Store>. All options given
on the command line will be send to the Importer or Store as initialization parameters.
Optionally a FIX can be provided to be executed on all the items before they are
stored into the Store.
catmandu import JSON to MongoDB --database_name mydb < records.json
=head2 move STORE [OPTIONS] [-q QUERY] [--limit LIMIT] [[--fix FIX]] to STORE [OPTIONS]
Move items from one L<Catmandu::Store> to another. All options given
on the command line will be send to the Stores as initialization parameters.
Optionally a QUERY and LIMIT can be provided to selectively export items from the Store.
Optionally a FIX can be provided to be executed on all the items before they are
stored.
=head2 data [LONG_OPTIONS]
Low level data manipulation command. See DATA OPTIONS below for full documentation.
=head1 OPTIONS
=over 4
=item -v
Verbose output.
=item -h
=item -?
=item --lib-path PATH
=item -I
Specifies Perl library include paths, like perl's -I option. This option is
repeatable.
=item --load-path PATH
=item -L PATH
Search upwards from this path for configuration files and accompanying lib
directories. This option is repeatable.
=item --debug [LEVEL]
=item -D[LEVEL]
Set the debugging level for Catmandu. LEVEL is one of:
1 - WARN messages
2 - INFO messages
3 - DEBUG messages
Requires an installation of L<Log::Log4perl> and L<Log::Any::Adapter::Log4perl>. By
default an internal log4perl configuration file is used that sends all debug messages
to stderr. Optionally in the catmandu.yml the path to a log4perl configuration file
can be set. E.g.
catmandu.yml:
log4perl: /etc/log4perl.conf
or
log4perl: "
log4perl.category.Catmandu=$level,$appender
log4perl.appender.STDOUT=Log::Log4perl::Appender::Screen
log4perl.appender.STDOUT.stderr=0
log4perl.appender.STDOUT.utf8=1
log4perl.appender.STDOUT.layout=PatternLayout
log4perl.appender.STDOUT.layout.ConversionPattern=%d [%P] - %p %l %M time=%r : %m%n
log4perl.appender.STDERR=Log::Log4perl::Appender::Screen
log4perl.appender.STDERR.stderr=0
log4perl.appender.STDERR.utf8=1
log4perl.appender.STDERR.layout=PatternLayout
log4perl.appender.STDERR.layout.ConversionPattern=%d [%P] - %l : %m%n
"
See also L<Catmandu::Logger> to enable logging for your own Catmandu packages.
=back
=head1 DATA OPTIONS
These low level options are available to the "catmandu data" command.
=over 4
=item --from-store STORE
Read items from a Catmandu::Store such as: DBI, MongoDB, Solr, ElasticSearch, ...
=item --from-importer IMPORTER
Read items from a Catmandu::Importer such as: YAML, JSON, CSV, MARC, OAI ...
=item --from-bag BAG_NAME
This option should be used in combination with a --from-store. Select from the Store
only the items belonging to the bag BAG_NAME.
=item --from-OPTION OPTION_VALUE
To include configuration options to a Catmandu::Store or Catmandu::Importer an
argument with prefix '--from-' can be used. E.g. to provide an 'file' to an Importer
use:
--from-file /my/path/to/file.txt
=item --into-exporter EXPORTER
Add each item read into a Catmandu::Exporter such as: JSON, YAML, Template, XLS, ...
=item --into-store STORE
Add each item read into a Catmandu::Store such as: DBI, MongoDB, Solr, ElasticSearch, ...
=item --into-bag BAG_NAME
This option should be used in combination with a --into-store. Add each item into the
Store with bag BAG_NAME.
=item --into-OPTION OPTION_VALUE
To include configuration options to a Catmandu::Store or Catmandu::Exporter an
argument with prefix '--into-' can be used. E.g. to provide an 'file' to an Exporter
use:
--into-file /tmp/file.txt
=item --fix EXPRESSION
=item --fix FILE
When exporting or storing apply a fix EXPRESSION or all the fixes in FILE on
each item. This option is repeatable. FILE can also be an arbitrary executable
if Catmandu::Fix::cmd is installed.
=item --start NUM
When exporting or storing data skip the first NUM items.
=item --total NUM
When exporting of storing data process only a total NUM of items.
=item --replace
When storing data first delete all the items in the Store or Bag.
=item --query QUERY
=item --cql-query QUERY | -q QUERY
When a Store is searchable execute and return the results. Using the --cql-query or -q
option the CQL query language can be used (if supported).
=item --limit NUM
Limit the number of results returned from the searchable results to NUM.
=item --count
Report the number of items processed.
=item --version
Return the installed version of Catmandu.
=back
=head1 SEE ALSO
L<Catmandu::Importer>
L<Catmandu::Exporter>
L<Catmandu::Store>
L<Catmandu::MARC>
L<Catmandu::OAI>
L<Catmandu::MongoDB>
L<Catmandu::Solr>
L<Catmandu::ElasticSearch>
=cut
|