.TH "corm" 1 "corm" \" -*- nroff -*-
.ad l
.nh
.SH NAME
corm \- corm(1)
.PP
Corm command-line tool — create, query, and associate persistent maps\&.
.PP
Simple CLI for the Corm engine\&. Replaces the old \fBqdb\fP and links directly against libcorm\&.
.SS "Overview"
Creates/opens key-value databases in memory or on disk; supports queries, associations, mirrors, and iteration\&. Supports \fIuint32_t\fP and \fIstring\fP types\&. \fBAuto-index is only active if the key type is \fRa\fP\&.\fP
.SS "Installation"
See: https://github.com/tty-pt/ci/blob/main/docs/install.md#install-ttypt-packages
.SS "Usage"
.PP
.nf
corm [\-qa ARG] [[\-rl] [\-RpdgmcD ARG] \&.\&.\&.] file[[:k]:v]
.fi
.PP
.PP
Use \fR\&.\fP as the KEY for all keys\&. Run \fRcorm -?\fP to show the full help\&.
.SS "Options"
.IP "\(bu" 2
\fR-r\fP reverse operation\&.
.IP "\(bu" 2
\fR-l\fP list all values\&.
.IP "\(bu" 2
\fR-L\fP list "missing" values (\fBrequires \fR-q\fP\fP to specify the paired database)\&.
.IP "\(bu" 2
\fR-q\fP \fIfile[:k[:v]]\fP db to use for string lookups and printing\&.
.IP "\(bu" 2
\fR-a\fP \fIfile[:k[:v]]\fP db to use for reversed string lookups and printing\&.
.IP "\(bu" 2
\fR-R\fP \fIKEY\fP get random value of key (empty key for any)\&.
.IP "\(bu" 2
\fR-p\fP \fIKEY[:VAL]\fP put a key/value pair\&.
.IP "\(bu" 2
\fR-d\fP \fIKEY[:VAL]\fP delete key/value pair (first match for multivalue maps)\&.
.IP "\(bu" 2
\fR-D\fP \fIKEY[:VAL]\fP delete ALL entries with key (multivalue support)\&.
.IP "\(bu" 2
\fR-g\fP \fIKEY\fP get value(s) of a key (first match for multivalue maps; \fR\&.\fP = all)\&.
.IP "\(bu" 2
\fR-m\fP \fIKEY\fP get ALL values for a key (multivalue iteration)\&.
.IP "\(bu" 2
\fR-c\fP \fIKEY\fP count entries for a key\&.
.IP "\(bu" 2
\fR-x\fP when printing associations, bail on the first result\&.
.IP "\(bu" 2
\fR-k\fP also print keys (for \fR-g\fP, \fR-m\fP, and \fR-R\fP)\&.
.IP "\(bu" 2
\fR-X\fP \fIEXPR\fP composed set query (runs at \fR-g \&.\fP if present, else once after all ops); leaves \fBNAME\fP [label:\fBNAME\fP]; operators \fR( ) AND OR EXCEPT NOT\fP (uppercase); \fRA EXCEPT B\fP = set minus; \fRNOT X\fP = complement; structure only — parameters go in flags (\fR--NAME=VALUE\fP / \fR--NAME@LABEL=VALUE\fP)\&.
.IP "\(bu" 2
\fR-t\fP \fIN\fP cap result count (0 = all)\&.
.IP "\(bu" 2
\fR-b\fP \fIF\fP score floor\&.
.IP "\(bu" 2
\fR--NAME=VALUE\fP per-axis config; forwarded to every bound axis plugin that declares \fBNAME\fP\&.
.IP "\(bu" 2
\fR--list-axes\fP list loaded axes and exit\&.
.IP "\(bu" 2
\fR-?\fP display this message\&.
.PP
.PP
\fR-q\fP/\fR-a\fP options are processed in order; each entry extends the lookup chain\&.
.SS "Type specifiers (\fRk\fP and \fRv\fP)"
.PP
.nf
u uint32_t
s string (default for both key and value)
a key only: uint32_t with auto\-index
2 key only: multivalue support (enables CM_MULTIVALUE|CM_SORTED)
.fi
.PP
.SS "Notes"
.IP "\(bu" 2
\fR-r\fP is counter-intuitive: when enabled, lookups are done \fBby primary keys\fP\&.
.IP "\(bu" 2
\fR-q\fP/\fR-a\fP options are processed in order; each entry extends the lookup chain\&.
.IP "\(bu" 2
Multivalue maps (type \fR2\fP) automatically enable \fRCM_MULTIVALUE|CM_SORTED\fP flags\&.
.IP "\(bu" 2
For multivalue maps with non-string keys, use \fR-r\fP to look up by the key type\&.
.PP
.SS "Examples"
.PP
.nf
# Automatic IDs: key 'a', values as strings
corm \-p Mathew owners\&.db:a:s # \-> Mathew's ID
corm \-p cat pets\&.db:a:s # \-> cat's ID
# Association (no duplicates)
corm \-p 1:1 assoc\&.db:u:u # owner_id:pet_id
# Get Mathew's pet (use \-q/\-a to resolve names/IDs)
corm \-q owners\&.db:a:s \-a pets\&.db:a:s \-g Mathew assoc\&.db:u:u
# Random value for a KEY
corm \-q owners\&.db:a:s \-a pets\&.db:a:s \-R Mathew assoc\&.db:u:u
# Chained lookups (multiple \-q/\-a in order)
corm \-q owners\&.db:a:s \-q pets\&.db:a:s \-g Mathew assoc\&.db:u:u
# Multivalue support \- duplicate keys
corm \-p 100:value1 multi\&.db:2u:s # Create multivalue map
corm \-p 100:value2 multi\&.db:2u:s # Add duplicate key
corm \-p 100:value3 multi\&.db:2u:s # Add another
corm \-r \-g 100 multi\&.db:2u:s # \-> value1 (first match)
corm \-r \-m 100 multi\&.db:2u:s # \-> value1 value2 value3 (all)
corm \-r \-c 100 multi\&.db:2u:s # \-> 3 (count)
corm \-r \-d 100 multi\&.db:2u:s # Delete first only
corm \-r \-D 100 multi\&.db:2u:s # Delete all with key 100
.fi
.PP
.PP
\fBSee also\fP
.RS 4
corm_handle
.PP
corm_common
.PP
corm_assoc
.PP
corm_iteration
.PP
corm_type
.RE
.PP