@@ -9,7 +9,66 @@ Examples
99--------
1010Listing all the compressed NIfTI files in ``fsaverage ``::
1111
12- $ templateflow ls fsaverage -x .nii.gz
13- ~/.cache/templateflow/tpl-fsaverage/tpl-fsaverage_res-01_den-41k_T1w.nii.gz
14- ~/.cache/templateflow/tpl-fsaverage/tpl-fsaverage_res-01_desc-brain_mask.nii.gz
15- ~/.cache/templateflow/tpl-fsaverage/tpl-fsaverage_res-01_T1w.nii.gz
12+ $ templateflow ls fsaverage -x .nii.gz
13+ ~/.cache/templateflow/tpl-fsaverage/tpl-fsaverage_res-01_den-41k_T1w.nii.gz
14+ ~/.cache/templateflow/tpl-fsaverage/tpl-fsaverage_res-01_desc-brain_mask.nii.gz
15+ ~/.cache/templateflow/tpl-fsaverage/tpl-fsaverage_res-01_T1w.nii.gz
16+
17+ Managing client configuration
18+ -----------------------------
19+ The ``templateflow `` CLI transparently manipulates the same cache configuration used
20+ by :class: `templateflow.client.TemplateFlowClient `. Running ``templateflow config ``
21+ exposes the options stored in the underlying :class: `templateflow.conf.cache.CacheConfig `
22+ instance::
23+
24+ $ templateflow config show
25+ TEMPLATEFLOW_HOME=/home/user/.cache/templateflow
26+ TEMPLATEFLOW_USE_DATALAD=0
27+ TEMPLATEFLOW_AUTOUPDATE=1
28+ TEMPLATEFLOW_GET_TIMEOUT=10
29+
30+ Changing a value updates the cached client configuration immediately. For example,
31+ enabling the DataLad backend is equivalent to instantiating a client with
32+ ``TemplateFlowClient(use_datalad=True) `` because the command mutates the
33+ ``CacheConfig `` object used by the global client::
34+
35+ $ templateflow config set TEMPLATEFLOW_USE_DATALAD 1
36+ Updated TEMPLATEFLOW_USE_DATALAD → 1 (DataLad downloads will be used on next access)
37+
38+ When the CLI is invoked afterwards, the cache will be re-initialized using
39+ ``use_datalad=True `` without requiring any additional Python code. The same
40+ mechanism applies to paths (``TEMPLATEFLOW_HOME ``), origins, and timeout
41+ settings provided via ``templateflow config ``.
42+
43+ Updating an existing cache
44+ --------------------------
45+ The :mod: `templateflow.conf ` module exposes an ``update `` helper that the CLI
46+ mirrors through ``templateflow update ``. Executing the command instructs the
47+ underlying :class: `templateflow.conf.cache.TemplateFlowCache ` instance to refresh
48+ its content using the currently selected backend::
49+
50+ $ templateflow update --silent
51+ Cache mode: S3
52+ Cache root: /home/user/.cache/templateflow
53+ TemplateFlow cache is up to date
54+
55+ If ``TEMPLATEFLOW_USE_DATALAD `` (or ``--use-datalad ``) is enabled, the command
56+ delegates to :class: `templateflow.conf.cache.DataladManager ` and performs a
57+ recursive ``datalad update ``. Otherwise the S3 manager fetches new or changed
58+ files while keeping existing downloads intact.
59+
60+ Wiping the cache
61+ ----------------
62+ The ``templateflow wipe `` command is a thin wrapper around
63+ :meth: `templateflow.conf.cache.TemplateFlowCache.wipe `. It clears the local cache
64+ and invalidates the in-memory layout so that subsequent ``templateflow `` CLI
65+ calls or new :class: `templateflow.client.TemplateFlowClient ` instances trigger a clean re-install::
66+
67+ $ templateflow wipe
68+ Removing cache at /home/user/.cache/templateflow …
69+ Cache cleared; next access will reinstall the archive
70+
71+ In DataLad mode the wipe operation reports that no deletion occurs because
72+ ``TemplateFlowCache `` delegates to :class: `~templateflow.conf.cache.DataladManager `,
73+ preserving the working tree. This makes it safe to toggle between backends via
74+ ``templateflow config `` without unintentionally removing a managed repository.
0 commit comments