@@ -298,5 +298,109 @@ mutation {
298298}
299299```
300300
301+ ## Using CLI client
302+
303+ If the application is built with the ` client ` feature enabled, there is a
304+ ` client ` subcommand available from the CLI to query and configure the service.
305+ The help covers the basic use.
306+
307+ <details ><summary >Output from `numtracker client --help`</summary >
308+
309+ ```
310+ View and update beamline configurations provided by an instance of the service
311+
312+ Usage: numtracker client [OPTIONS] <COMMAND>
313+
314+ Commands:
315+ configuration Query existing configurations
316+ configure Update or add new configurations
317+ visit-directory Query for templated data
318+ help Print this message or the help of the given subcommand(s)
319+
320+ Options:
321+ -H, --host <HOST> [env: NUMTRACKER_SERVICE_HOST=]
322+ --auth <AUTH> [env: NUMTRACKER_AUTH_HOST=]
323+ -h, --help Print help
324+
325+ Logging/Debug:
326+ -v, --verbose... Increase the level of logs written to stderr
327+ -q, --quiet Disable all output to stderr/stdout
328+ ```
329+ </details >
330+
331+ ### Configure
332+
333+ The ` configure ` subcommand corresponds to the ` configure ` mutation from graphql.
334+ If a beamline is already present, this can be used to update individual fields.
335+ If the beamline is not present, all template fields must be present.
336+
337+ ``` bash
338+ $ numtracker client configure i22 \
339+ --visit ' /tmp/{instrument}/data/{year}/{visit}' \
340+ --scan ' {subdirectory}/{instrument}-{scan_number}' \
341+ --detector ' {subdirectory}/{scan_number}/{instrument}-{scan_number}-{detector}'
342+ Visit Template: /tmp/{instrument}/data/{year}/{visit}
343+ Scan Template: {subdirectory}/{instrument}-{scan_number}
344+ Detector Template: {subdirectory}/{scan_number}/{instrument}-{scan_number}-{detector}
345+ DB Scan Number: 0
346+ File Scan Number: 122
347+ Tracker File Extension: None
348+ ```
349+
350+ ### Configurations
351+
352+ The ` configuration ` subcommand corresponds to the ` configurations ` graphql
353+ query. If no beamlines are included in the command, all configurations are
354+ returned, otherwise only those matching the given beamlines are returned
355+ (possible none if no beamlines match).
356+
357+ #### List all configurations
358+ ``` bash
359+ $ numtracker client configuration
360+ Beamline: i11
361+ Visit Template: ...
362+ Scan Template: ...
363+ Detector Template: ...
364+ DB Scan Number: ...
365+ File Scan Number: ...
366+ Tracker File Extension: ...
367+ Beamline: i22
368+ Visit Template: ...
369+ Scan Template: ...
370+ Detector Template: ...
371+ DB Scan Number: ...
372+ File Scan Number: ...
373+ Tracker File Extension: ...
374+ Beamline: b21
375+ Visit Template: ...
376+ Scan Template: ...
377+ Detector Template: ...
378+ DB Scan Number: ...
379+ File Scan Number: ...
380+ Tracker File Extension: ...
381+ ```
382+
383+ #### Filter configurations
384+ ``` bash
385+ $ numtracker client configuration -b i22
386+ Beamline: i22
387+ Visit Template: ...
388+ Scan Template: ...
389+ Detector Template: ...
390+ DB Scan Number: ...
391+ File Scan Number: ...
392+ Tracker File Extension: ...
393+ ```
394+
395+ ### Visit Directory
396+
397+ The ` visit-directory ` subcommand is a reduced version of the ` paths ` graphql
398+ query. It only returns the directory path.
399+
400+ ``` bash
401+ $ numtracker client visit-directory i22 cm12345-6
402+ /tmp/i22/data/2025/cm12345-6/
403+ ```
404+
301405[ _graphiql ] :https://github.com/graphql/graphiql/
302406[ _jq ] :https://jqlang.github.io/jq/
0 commit comments