How do I view a CRM as a grid matrix from the shell?
Table of Contents
Reproduce, from the command line, the removed desktop client's
cross-rates matrix grid layout – base currencies as rows, quote currencies as
columns – via the crm_commands shell command's --matrix flag.
The ores-shell block below is tangled into the runnable script
library as crm_rates_matrix.ores.
1. Question
How do I view a CRM as a grid matrix from ores.shell?
2. Answer
crm rates <crm-name> --matrix renders the same rows the flat
crm rates <crm-name> table would, reshaped into a grid keyed by
(base, quote) instead of one row per pair – the diagonal shows a
dash, an unconfigured pair shows blank. --matrix requires a named
CRM: mixing rows from more than one CRM into a single grid would be
ambiguous (a (base, quote) cell could exist in two different CRMs at
once), so crm rates --matrix with no CRM name is rejected with an
error rather than silently picking one.
crm rates majors --matrix logout
./ores.shell ${log_args} ${connect_args} ${login_args} << 'EOF'
<<crm-rates-matrix>>
EOF
3. Script
projects/ores.shell/scripts/library/marketdata/crm_rates_matrix.ores
– generated from this recipe's ores-shell block by compass build
--direct tangle_shell_scripts (do not edit the .ores by hand).
4. Tested by
Manual: run against a Acme-provisioned database (compass db
recreate -y -k then the Acme Corporation provisioning recipe), then
compass shell -u tenant_admin@acme_corporation -p Secure-Password-123 -f
crm_rates_matrix.ores. Confirms the grid renders with aligned
columns and a dash on the diagonal; separately confirm crm rates
--matrix (no CRM name) is rejected with a clear error.