CATMANDU(1)
πΈ CATMANDU(1) β LibreCat command line tools, but make it bestie-coded π
π NAME π
catmandu β the LibreCat command line tools. Thatβs the name, thatβs the whole vibe, periodt.
β¨ SYNOPSIS β¨
Okay bestie, hereβs the shape of it:
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 MARC --fix myfixes.txt < 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("_id")'
catmandu export Solr --url http://localhost:8983/solr to JSON
catmandu export ElasticSearch --index_name mydb to JSON
# copy
catmandu copy MongoDB --database_name mydb to ElasticSearch --index_name mydb
# show the contents of catmandu.yml
catmandu config
# count items in a store
catmandu count test1
# delete items from store
catmandu delete test1 -q 'title:"My Rabbit"'
# run a fix script
$ catmandu run myfixes.fix
# or, create an executable fix script
$ cat myfixes.fix
#!/usr/local/bin/catmandu run
do importer(OAI,url:"http://biblio.ugent.be/oai")
retain(_id)
end
$ chmod 755 myfixes.fix
$ ./myfixes.fix
# configuration
$ cat catmandu.yml
---
store:
test1:
package: MongoDB
options:
database_name: mydb
catmandu import JSON to test1 < records.json
# show installed commands
$ catmandu info
$ catmandu info --namespace XML
π COMMANDS π
Hereβs the command roster, bestie. Slay.
π«Ά help COMMAND
Documentation about command line options. Thatβs it, thatβs the whole job.
π«Ά config
Displays the contents of the catmandu.yml files in your project.
π«Ά convert IMPORTER [OPTIONS] [[--fix FIX]] to EXPORTER [OPTIONS]
Convert data from one format to another format with help of Catmandu::Importers and Catmandu::Exporters. All options given on the command line will be sent 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
π«Ά copy STORE [OPTIONS] [-q QUERY] [--limit LIMIT] [[--fix FIX]] to STORE [OPTIONS]
Copy items from one Catmandu::Store to another. All options given on the command line will be sent 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.
π«Ά count STORE [OPTIONS]
Count the number of items in a Catmandu::Store. All options given on the command line will be sent to the store as initialization parameters. E.g.
catmandu count MongoDB --database_name mydb --bag data
π«Ά delete STORE [OPTIONS] [-q QUERY]
Delete items from a Catmandu::Store. All options given on the command line will be sent 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"
π«Ά export STORE [OPTIONS] [-q QUERY] [--limit LIMIT] [[--fix FIX]] to EXPORTER [OPTIONS]
Export items from a Catmandu::Store using a Catmandu::Exporter. All options given on the command line will be sent 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 exported by the exporter.
E.g.
catmandu export MongoDB --database_name mydb --bag data -q "title:Perl"
π«Ά import IMPORTER [OPTIONS] [[--fix FIX]] to STORE [OPTIONS]
Import items from a Catmandu::Importer to a Catmandu::Store. All options given on the command line will be sent 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
π«Ά info [OPTIONS]
List installed Catmandu modules (importers, exporters, stores, and fixes).
π«Ά run [FIX]
Execute a fix script or run an interactive Fix shell.
π OPTIONS π
-vβ verbose output. This includes progress of operations.-hβ listed as an option here; the page doesnβt give it a separate description, so Iβm not gonna invent one, bestie.-?β same energy: listed, no extra description in the source.--lib-path PATHβ specifies Perl library include paths, like perlβs-Ioption. This option is repeatable.-Iβ specifies Perl library include paths, like perlβs-Ioption. This option is repeatable.--load-path PATHβ search upwards from this path for configuration files and accompanying lib directories. This option is repeatable.-L PATHβ search upwards from this path for configuration files and accompanying lib directories. This option is repeatable.--var [NAME]=[VALUE]β Catmandu commands such asconvert,importandexportaccept command line variables that can be read by any fix script provided. For instance, if provenance information need to be added to the output, then this can be provided via the command line:
$ catmandu convert MARC --fix myfixes.txt --var source=Springer --var date=2016 < data.mrc
with myfixes.txt a file like:
add_field(source,{{source}})
add_field(data,{{date}})
...(other fixes)...
--debug [LEVEL]β set the debugging level for Catmandu.LEVELis one of:
1 - WARN messages
2 - INFO messages
3 - DEBUG messages
Requires an installation of Log::Log4perl and 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 Catmandu::Logger to enable logging for your own Catmandu packages.
-D[LEVEL]β set the debugging level for Catmandu.LEVELis one of:
1 - WARN messages
2 - INFO messages
3 - DEBUG messages
Requires an installation of Log::Log4perl and 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 Catmandu::Logger to enable logging for your own Catmandu packages.
π DATA OPTIONS π
--fix EXPRESSIONβ when exporting or storing, apply a fixEXPRESSIONon each item. This option is repeatable.--fix FILEβ when exporting or storing, apply all the fixes inFILEon each item. This option is repeatable.--start NUMβ when exporting or storing data, skip the firstNUMitems.--total NUMβ when exporting or storing data, process only a totalNUMof items.--replaceβ when storing data, first delete all the items in the Store or Bag.--query QUERYβ when a Store is searchable, execute and return the results.--cql-query QUERYβ when a Store is searchable, execute and return the results. Using the--cql-queryor-qoption the CQL query language can be used (if supported).-q QUERYβ when a Store is searchable, execute and return the results. Using the--cql-queryor-qoption the CQL query language can be used (if supported).--sort SORTβ set the sort order for the results returned from a searchable Store.--sru-sortkeys SORTβ set the sort order for the results returned from a searchable Store.--sru-sortkeysis only available if the Store supports CQL.--limit NUMβ limit the number of results returned from the searchable results toNUM.--countβ report the number of items processed.--versionβ return the installed version of Catmandu.
π SEE ALSO π
Catmandu::ImporterCatmandu::ExporterCatmandu::StoreCatmandu::MARCCatmandu::OAICatmandu::MongoDBCatmandu::SolrCatmandu::ElasticSearch
Okay, thatβs the whole page, bestie. The footer vibe is perl v5.42.3, dated 2023-02-08, with the man page label CATMANDU(1). Mwah π
π¦ where this page comes from
- nixos 26.05: perl5.42.3-Catmandu 1.2020
- nixpkgs unstable: perl5.42.3-Catmandu 1.2020
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms