@@ -288,33 +288,58 @@ cabal preferences. It is very useful when you are e.g. first configuring
288
288
cabal path
289
289
^^^^^^^^^^
290
290
291
- ``cabal path `` prints the file system paths used by ``cabal `` for
292
- cache, store, installed binaries, and so on. When run without any
293
- options, it will show all paths, labeled with how they are namen in
294
- the configuration file:
291
+ ``cabal path `` allows to query for paths used by ``cabal ``.
292
+ For example, it allows to query for the directories of the cache, store,
293
+ installed binaries, and so on. When queried, each path output is labelled by their respective flag name.
294
+
295
+ The command ``cabal path `` requires the ``output-format `` argument (e.g., ``json `` or ``key-value ``)
296
+ that specifies the format of the output:
297
+
298
+ ::
299
+
300
+ $ cabal path --output-format=key-value
301
+ cache-dir: /home/haskell/.cache/cabal/packages
302
+ logs-dir: /home/haskell/.cache/cabal/logs
303
+ store-dir: /home/haskell/.local/state/cabal/store
304
+ config-file: /home/haskell/.config/cabal/config
305
+ installdir: /home/haskell/.local/bin
306
+ ...
307
+
308
+ Or using the json output:
295
309
296
310
::
297
- $ cabal path
298
- cache-dir: /home/haskell/.cache/cabal/packages
299
- logs-dir: /home/haskell/.cache/cabal/logs
300
- store-dir: /home/haskell/.local/state/cabal/store
301
- config-file: /home/haskell/.config/cabal/config
302
- installdir: /home/haskell/.local/bin
303
- ...
304
311
305
- If ``cabal path `` is passed a single option naming a path, then that
312
+ $ cabal path --output-format=json
313
+
314
+ .. code-block :: json
315
+
316
+ {
317
+ "cabal-version" : " 3.11.0.0" ,
318
+ "compiler" : {
319
+ "flavour" : " ghc" ,
320
+ "id" : " ghc-9.6.4" ,
321
+ "path" : " /home/user/.ghcup/bin/ghc"
322
+ },
323
+ "cache-dir" : " /home/user/.cabal/packages" ,
324
+ "logs-dir" : " /home/user/.cabal/logs" ,
325
+ "store-dir" : " /home/user/.cabal/store" ,
326
+ "config-file" : " /home/user/.cabal/config" ,
327
+ "installdir" : " /home/user/.cabal/bin"
328
+ }
329
+
330
+ If ``cabal path --output-format=key-value `` is passed a single option naming a path, then that
306
331
path will be printed *without * any label:
307
332
308
333
::
309
334
310
- $ cabal path --installdir
335
+ $ cabal path --output-format=key-value -- installdir
311
336
/home/haskell/.local/bin
312
337
313
- This is a stable interface and is intended to be used for scripting.
314
- For example:
338
+ While this interface is intended to be used for scripting, it is an experimental command .
339
+ Scripting example:
315
340
316
341
::
317
- $ ls $(cabal path --installdir)
342
+ $ ls $(cabal path --output-format=key-value -- installdir)
318
343
...
319
344
320
345
.. _command-group-database :
@@ -1381,8 +1406,8 @@ to Hackage.
1381
1406
1382
1407
.. option :: -t TOKEN or -tTOKEN , --token=TOKEN
1383
1408
1384
- Your Hackage authentication token. You can create and delete
1385
- authentication tokens on Hackage's `account management page
1409
+ Your Hackage authentication token. You can create and delete
1410
+ authentication tokens on Hackage's `account management page
1386
1411
<https://hackage.haskell.org/users/account-management> `__.
1387
1412
1388
1413
.. option :: -u USERNAME or -uUSERNAME , --username=USERNAME
@@ -1416,8 +1441,8 @@ cabal report
1416
1441
1417
1442
.. option :: -t TOKEN or -tTOKEN , --token=TOKEN
1418
1443
1419
- Your Hackage authentication token. You can create and delete
1420
- authentication tokens on Hackage's `account management page
1444
+ Your Hackage authentication token. You can create and delete
1445
+ authentication tokens on Hackage's `account management page
1421
1446
<https://hackage.haskell.org/users/account-management> `__.
1422
1447
1423
1448
.. option :: -u USERNAME or -uUSERNAME , --username=USERNAME
0 commit comments