1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# NOTE: spack-completion.bash is auto-generated by:
#
# $ spack commands --aliases --format=bash
# --header=bash/spack-completion.bash --update=spack-completion.bash
#
# Please do not manually modify this file.
# The following global variables are set by Bash programmable completion:
#
# COMP_CWORD: An index into ${COMP_WORDS} of the word containing the
# current cursor position
# COMP_KEY: The key (or final key of a key sequence) used to invoke
# the current completion function
# COMP_LINE: The current command line
# COMP_POINT: The index of the current cursor position relative to the
# beginning of the current command
# COMP_TYPE: Set to an integer value corresponding to the type of
# completion attempted that caused a completion function
# to be called
# COMP_WORDBREAKS: The set of characters that the readline library treats
# as word separators when performing word completion
# COMP_WORDS: An array variable consisting of the individual words in
# the current command line
#
# The following global variable is used by Bash programmable completion:
#
# COMPREPLY: An array variable from which bash reads the possible
# completions generated by a shell function invoked by the
# programmable completion facility
#
# See `man bash` for more details.
if test -n "${ZSH_VERSION:-}" ; then
if [[ "$(emulate)" = zsh ]] ; then
if ! typeset -f compdef >& /dev/null ; then
# ensure base completion support is enabled, ignore insecure directories
autoload -U +X compinit && compinit -i
fi
if ! typeset -f complete >& /dev/null ; then
# ensure bash compatible completion support is enabled
autoload -U +X bashcompinit && bashcompinit
fi
emulate sh -c "source '$0:A'"
return # stop interpreting file
fi
fi
# compgen -W doesn't work in some versions of zsh, so use this instead.
# see https://www.zsh.org/mla/workers/2011/msg00582.html
_compgen_w() {
if test -n "${ZSH_VERSION:-}" ; then
typeset -a words
words=( ${~=1} )
local find="$2"
results=(${(M)words[@]:#$find*})
echo "${results[@]}"
else
compgen -W "$1" -- "$2"
fi
}
# Bash programmable completion for Spack
_bash_completion_spack() {
# In all following examples, let the cursor be denoted by brackets, i.e. []
# For our purposes, flags should not affect tab completion. For instance,
# `spack install []` and `spack -d install --jobs 8 []` should both give the same
# possible completions. Therefore, we need to ignore any flags in COMP_WORDS.
local -a COMP_WORDS_NO_FLAGS
local index=0
while [[ "$index" -lt "$COMP_CWORD" ]]
do
if [[ "${COMP_WORDS[$index]}" == [a-z]* ]]
then
COMP_WORDS_NO_FLAGS+=("${COMP_WORDS[$index]}")
fi
let index++
done
# Options will be listed by a subfunction named after non-flag arguments.
# For example, `spack -d install []` will call _spack_install
# and `spack compiler add []` will call _spack_compiler_add
local subfunction=$(IFS='_'; echo "_${COMP_WORDS_NO_FLAGS[*]}")
# Translate dashes to underscores, as dashes are not permitted in
# compatibility mode. See https://github.com/spack/spack/pull/4079
subfunction=${subfunction//-/_}
# However, the word containing the current cursor position needs to be
# added regardless of whether or not it is a flag. This allows us to
# complete something like `spack install --keep-st[]`
COMP_WORDS_NO_FLAGS+=("${COMP_WORDS[$COMP_CWORD]}")
# Since we have removed all words after COMP_CWORD, we can safely assume
# that COMP_CWORD_NO_FLAGS is simply the index of the last element
local COMP_CWORD_NO_FLAGS=$((${#COMP_WORDS_NO_FLAGS[@]} - 1))
# There is no guarantee that the cursor is at the end of the command line
# when tab completion is envoked. For example, in the following situation:
# `spack -d [] install`
# if the user presses the TAB key, a list of valid flags should be listed.
# Note that we cannot simply ignore everything after the cursor. In the
# previous scenario, the user should expect to see a list of flags, but
# not of other subcommands. Obviously, `spack -d list install` would be
# invalid syntax. To accomplish this, we use the variable list_options
# which is true if the current word starts with '-' or if the cursor is
# not at the end of the line.
local list_options=false
if [[ "${COMP_WORDS[$COMP_CWORD]}" == -* || "$COMP_POINT" -ne "${#COMP_LINE}" ]]
then
list_options=true
fi
# In general, when envoking tab completion, the user is not expecting to
# see optional flags mixed in with subcommands or package names. Tab
# completion is used by those who are either lazy or just bad at spelling.
# If someone doesn't remember what flag to use, seeing single letter flags
# in their results won't help them, and they should instead consult the
# documentation. However, if the user explicitly declares that they are
# looking for a flag, we can certainly help them out.
# `spack install -[]`
# and
# `spack install --[]`
# should list all flags and long flags, respectively. Furthermore, if a
# subcommand has no non-flag completions, such as `spack arch []`, it
# should list flag completions.
local cur=${COMP_WORDS_NO_FLAGS[$COMP_CWORD_NO_FLAGS]}
# If the cursor is in the middle of the line, like:
# `spack -d [] install`
# COMP_WORDS will not contain the empty character, so we have to add it.
if [[ "${COMP_LINE:$COMP_POINT-1:1}" == " " ]]
then
cur=""
fi
# Uncomment this line to enable logging
#_test_vars >> temp
# Make sure function exists before calling it
local rgx #this dance is necessary to cover bash and zsh regex
rgx="$subfunction.*function.* "
if [[ "$(LC_ALL=C type $subfunction 2>&1)" =~ $rgx ]]
then
$subfunction
COMPREPLY=($(_compgen_w "$SPACK_COMPREPLY" "$cur"))
fi
# if every completion is an alias for the same thing, just return that thing.
_spack_compress_aliases
}
# Helper functions for subcommands
# Results of each query are cached via environment variables
_subcommands() {
if [[ -z "${SPACK_SUBCOMMANDS:-}" ]]
then
SPACK_SUBCOMMANDS="$(spack commands)"
fi
SPACK_COMPREPLY="$SPACK_SUBCOMMANDS"
}
_all_packages() {
if [[ -z "${SPACK_ALL_PACKAGES:-}" ]]
then
SPACK_ALL_PACKAGES="$(spack list)"
fi
SPACK_COMPREPLY="$SPACK_ALL_PACKAGES"
}
_all_resource_hashes() {
if [[ -z "${SPACK_ALL_RESOURCES_HASHES:-}" ]]
then
SPACK_ALL_RESOURCE_HASHES="$(spack resource list --only-hashes)"
fi
SPACK_COMPREPLY="$SPACK_ALL_RESOURCE_HASHES"
}
_installed_packages() {
if [[ -z "${SPACK_INSTALLED_PACKAGES:-}" ]]
then
SPACK_INSTALLED_PACKAGES="$(spack --color=never find --no-groups)"
fi
SPACK_COMPREPLY="$SPACK_INSTALLED_PACKAGES"
}
_installed_compilers() {
if [[ -z "${SPACK_INSTALLED_COMPILERS:-}" ]]
then
SPACK_INSTALLED_COMPILERS="$(spack compilers | egrep -v "^(-|=)")"
fi
SPACK_COMPREPLY="$SPACK_INSTALLED_COMPILERS"
}
_providers() {
if [[ -z "${SPACK_PROVIDERS:-}" ]]
then
SPACK_PROVIDERS="$(spack providers)"
fi
SPACK_COMPREPLY="$SPACK_PROVIDERS"
}
_mirrors() {
if [[ -z "${SPACK_MIRRORS:-}" ]]
then
SPACK_MIRRORS="$(spack mirror list | awk '{print $1}')"
fi
SPACK_COMPREPLY="$SPACK_MIRRORS"
}
_repos() {
if [[ -z "${SPACK_REPOS:-}" ]]
then
SPACK_REPOS="$(spack repo list | awk '{print $1}')"
fi
SPACK_COMPREPLY="$SPACK_REPOS"
}
_unit_tests() {
if [[ -z "${SPACK_TESTS:-}" ]]
then
SPACK_TESTS="$(spack unit-test -l)"
fi
SPACK_COMPREPLY="$SPACK_TESTS"
}
_environments() {
if [[ -z "${SPACK_ENVIRONMENTS:-}" ]]
then
SPACK_ENVIRONMENTS="$(spack env list)"
fi
SPACK_COMPREPLY="$SPACK_ENVIRONMENTS"
}
_keys() {
if [[ -z "${SPACK_KEYS:-}" ]]
then
SPACK_KEYS="$(spack gpg list)"
fi
SPACK_COMPREPLY="$SPACK_KEYS"
}
_config_sections() {
if [[ -z "${SPACK_CONFIG_SECTIONS:-}" ]]
then
SPACK_CONFIG_SECTIONS="$(spack config list)"
fi
SPACK_COMPREPLY="$SPACK_CONFIG_SECTIONS"
}
_extensions() {
if [[ -z "${SPACK_EXTENSIONS:-}" ]]
then
SPACK_EXTENSIONS="$(spack extensions)"
fi
SPACK_COMPREPLY="$SPACK_EXTENSIONS"
}
# Testing functions
# Function for unit testing tab completion
# Syntax: _spack_completions spack install py-
_spack_completions() {
local COMP_CWORD COMP_KEY COMP_LINE COMP_POINT COMP_TYPE COMP_WORDS COMPREPLY
# Set each variable the way bash would
COMP_LINE="$*"
COMP_POINT=${#COMP_LINE}
COMP_WORDS=("$@")
if [[ ${COMP_LINE: -1} == ' ' ]]
then
COMP_WORDS+=('')
fi
COMP_CWORD=$((${#COMP_WORDS[@]} - 1))
COMP_KEY=9 # ASCII 09: Horizontal Tab
COMP_TYPE=64 # ASCII 64: '@', to list completions if the word is not unmodified
# Run Spack's tab completion function
_bash_completion_spack
# Return the result
echo "${COMPREPLY[@]:-}"
}
# Log the environment variables used
# Syntax: _test_vars >> temp
_test_vars() {
echo "-----------------------------------------------------"
echo "Variables set by bash:"
echo
echo "COMP_LINE: '$COMP_LINE'"
echo "# COMP_LINE: '${#COMP_LINE}'"
echo "COMP_WORDS: $(_pretty_print COMP_WORDS[@])"
echo "# COMP_WORDS: '${#COMP_WORDS[@]}'"
echo "COMP_CWORD: '$COMP_CWORD'"
echo "COMP_KEY: '$COMP_KEY'"
echo "COMP_POINT: '$COMP_POINT'"
echo "COMP_TYPE: '$COMP_TYPE'"
echo "COMP_WORDBREAKS: '$COMP_WORDBREAKS'"
echo
echo "Intermediate variables:"
echo
echo "COMP_WORDS_NO_FLAGS: $(_pretty_print COMP_WORDS_NO_FLAGS[@])"
echo "# COMP_WORDS_NO_FLAGS: '${#COMP_WORDS_NO_FLAGS[@]}'"
echo "COMP_CWORD_NO_FLAGS: '$COMP_CWORD_NO_FLAGS'"
echo
echo "Subfunction: '$subfunction'"
if $list_options
then
echo "List options: 'True'"
else
echo "List options: 'False'"
fi
echo "Current word: '$cur'"
}
# Pretty-prints one or more arrays
# Syntax: _pretty_print array1[@] ...
_pretty_print() {
for arg in $@
do
local array=("${!arg}")
printf "$arg: ["
printf "'%s'" "${array[0]}"
printf ", '%s'" "${array[@]:1}"
echo "]"
done
}
complete -o bashdefault -o default -F _bash_completion_spack spack
# Completion for spacktivate
complete -o bashdefault -o default -F _bash_completion_spack spacktivate
_spacktivate() {
_spack_env_activate
}
# Simple function to get the spack alias for a command
_spack_get_alias() {
local possible_alias="${1-}"
local IFS=";"
# spack aliases are a ;-separated list of :-separated pairs
for item in $SPACK_ALIASES; do
# maps a possible alias to its command
eval "local real_command=\"\${item#*${possible_alias}:}\""
if [ "$real_command" != "$item" ]; then
SPACK_ALIAS="$real_command"
return
fi
done
# no alias found -- just return $1
SPACK_ALIAS="$possible_alias"
}
# If all commands in COMPREPLY alias to the same thing, set COMPREPLY to
# just the real command, not the aliases.
_spack_compress_aliases() {
# If there are zero or one completions, don't do anything
# If this isn't the first argument, bail because aliases currently only apply
# to top-level commands.
if [ "${#COMPREPLY[@]}" -le "1" ] || [ "$COMP_CWORD_NO_FLAGS" != "1" ]; then
return
fi
# get the alias of the first thing in the list of completions
_spack_get_alias "${COMPREPLY[@]:0:1}"
local first_alias="$SPACK_ALIAS"
# if anything in the list would alias to something different, stop
for comp in "${COMPREPLY[@]:1}"; do
_spack_get_alias "$comp"
if [ "$SPACK_ALIAS" != "$first_alias" ]; then
return
fi
done
# all commands alias to first alias; just return that
COMPREPLY=("$first_alias")
}
# Spack commands
#
# Everything below here is auto-generated.
SPACK_ALIASES="concretise:concretize;containerise:containerize;rm:remove"
_spack() {
if $list_options
then
SPACK_COMPREPLY="-h --help -H --all-help --color -c --config -C --config-scope -d --debug --timestamp --pdb -e --env -D --env-dir -E --no-env --use-env-repo -k --insecure -l --enable-locks -L --disable-locks -m --mock -b --bootstrap -p --profile --sorted-profile --lines -v --verbose --stacktrace --backtrace -V --version --print-shell-vars"
else
SPACK_COMPREPLY="add arch audit blame bootstrap build-env buildcache cd change checksum ci clean clone commands compiler compilers concretize concretise config containerize containerise create debug deconcretize dependencies dependents deprecate dev-build develop diff docs edit env extensions external fetch find gc gpg graph help info install license list load location log-parse maintainers make-installer mark mirror module patch pkg providers pydoc python reindex remove rm repo resource restage solve spec stage style tags test test-env tutorial undevelop uninstall unit-test unload url verify versions view"
fi
}
_spack_add() {
if $list_options
then
SPACK_COMPREPLY="-h --help -l --list-name"
else
_all_packages
fi
}
_spack_arch() {
SPACK_COMPREPLY="-h --help -g --generic-target --known-targets -p --platform -o --operating-system -t --target -f --frontend -b --backend"
}
_spack_audit() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="configs externals packages-https packages list"
fi
}
_spack_audit_configs() {
SPACK_COMPREPLY="-h --help"
}
_spack_audit_externals() {
if $list_options
then
SPACK_COMPREPLY="-h --help --list"
else
SPACK_COMPREPLY=""
fi
}
_spack_audit_packages_https() {
if $list_options
then
SPACK_COMPREPLY="-h --help --all"
else
SPACK_COMPREPLY=""
fi
}
_spack_audit_packages() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_audit_list() {
SPACK_COMPREPLY="-h --help"
}
_spack_blame() {
if $list_options
then
SPACK_COMPREPLY="-h --help -t --time -p --percent -g --git --json"
else
_all_packages
fi
}
_spack_bootstrap() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="now status enable disable reset root list add remove mirror"
fi
}
_spack_bootstrap_now() {
SPACK_COMPREPLY="-h --help --dev"
}
_spack_bootstrap_status() {
SPACK_COMPREPLY="-h --help --optional --dev"
}
_spack_bootstrap_enable() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope"
else
SPACK_COMPREPLY=""
fi
}
_spack_bootstrap_disable() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope"
else
SPACK_COMPREPLY=""
fi
}
_spack_bootstrap_reset() {
SPACK_COMPREPLY="-h --help -y --yes-to-all"
}
_spack_bootstrap_root() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope"
else
SPACK_COMPREPLY=""
fi
}
_spack_bootstrap_list() {
SPACK_COMPREPLY="-h --help --scope"
}
_spack_bootstrap_add() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope --trust"
else
SPACK_COMPREPLY=""
fi
}
_spack_bootstrap_remove() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_bootstrap_mirror() {
if $list_options
then
SPACK_COMPREPLY="-h --help --binary-packages --dev"
else
SPACK_COMPREPLY=""
fi
}
_spack_build_env() {
if $list_options
then
SPACK_COMPREPLY="-h --help --clean --dirty -U --fresh --reuse --reuse-deps --dump --pickle"
else
_all_packages
fi
}
_spack_buildcache() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="push create install list keys preview check download get-buildcache-name save-specfile sync update-index rebuild-index"
fi
}
_spack_buildcache_push() {
if $list_options
then
SPACK_COMPREPLY="-h --help -f --force --allow-root -a --unsigned -u --signed --key -k --update-index --rebuild-index --spec-file --only --fail-fast --base-image --tag -t -j --jobs"
else
_mirrors
fi
}
_spack_buildcache_create() {
if $list_options
then
SPACK_COMPREPLY="-h --help -f --force --allow-root -a --unsigned -u --signed --key -k --update-index --rebuild-index --spec-file --only --fail-fast --base-image --tag -t -j --jobs"
else
_mirrors
fi
}
_spack_buildcache_install() {
if $list_options
then
SPACK_COMPREPLY="-h --help -f --force -m --multiple -u --unsigned -o --otherarch"
else
_all_packages
fi
}
_spack_buildcache_list() {
if $list_options
then
SPACK_COMPREPLY="-h --help -l --long -L --very-long -N --namespaces -v --variants -a --allarch"
else
_all_packages
fi
}
_spack_buildcache_keys() {
SPACK_COMPREPLY="-h --help -i --install -t --trust -f --force"
}
_spack_buildcache_preview() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_installed_packages
fi
}
_spack_buildcache_check() {
if $list_options
then
SPACK_COMPREPLY="-h --help -m --mirror-url -o --output-file --scope -s --spec --spec-file"
else
_all_packages
fi
}
_spack_buildcache_download() {
SPACK_COMPREPLY="-h --help -s --spec --spec-file -p --path"
}
_spack_buildcache_get_buildcache_name() {
SPACK_COMPREPLY="-h --help -s --spec --spec-file"
}
_spack_buildcache_save_specfile() {
SPACK_COMPREPLY="-h --help --root-spec --root-specfile -s --specs --specfile-dir"
}
_spack_buildcache_sync() {
if $list_options
then
SPACK_COMPREPLY="-h --help --manifest-glob"
else
SPACK_COMPREPLY=""
fi
}
_spack_buildcache_update_index() {
if $list_options
then
SPACK_COMPREPLY="-h --help -k --keys"
else
_mirrors
fi
}
_spack_buildcache_rebuild_index() {
if $list_options
then
SPACK_COMPREPLY="-h --help -k --keys"
else
_mirrors
fi
}
_spack_cd() {
if $list_options
then
SPACK_COMPREPLY="-h --help -m --module-dir -r --spack-root -i --install-dir -p --package-dir -P --packages -s --stage-dir -S --stages --source-dir -b --build-dir -e --env --first"
else
_all_packages
fi
}
_spack_change() {
if $list_options
then
SPACK_COMPREPLY="-h --help -l --list-name --match-spec -a --all"
else
_all_packages
fi
}
_spack_checksum() {
if $list_options
then
SPACK_COMPREPLY="-h --help --keep-stage --batch -b --latest -l --preferred -p --add-to-package -a --verify -j --jobs"
else
_all_packages
fi
}
_spack_ci() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="generate rebuild-index rebuild reproduce-build"
fi
}
_spack_ci_generate() {
SPACK_COMPREPLY="-h --help --output-file --copy-to --optimize --dependencies --buildcache-destination --prune-dag --no-prune-dag --check-index-only --artifacts-root"
}
_spack_ci_rebuild_index() {
SPACK_COMPREPLY="-h --help"
}
_spack_ci_rebuild() {
SPACK_COMPREPLY="-h --help -t --tests --fail-fast"
}
_spack_ci_reproduce_build() {
if $list_options
then
SPACK_COMPREPLY="-h --help --runtime --working-dir -s --autostart --gpg-file --gpg-url"
else
SPACK_COMPREPLY=""
fi
}
_spack_clean() {
if $list_options
then
SPACK_COMPREPLY="-h --help -s --stage -d --downloads -f --failures -m --misc-cache -p --python-cache -b --bootstrap -a --all"
else
_all_packages
fi
}
_spack_clone() {
if $list_options
then
SPACK_COMPREPLY="-h --help -r --remote"
else
SPACK_COMPREPLY=""
fi
}
_spack_commands() {
if $list_options
then
SPACK_COMPREPLY="-h --help --update-completion -a --aliases --format --header --update"
else
SPACK_COMPREPLY=""
fi
}
_spack_compiler() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="find add remove rm list info"
fi
}
_spack_compiler_find() {
if $list_options
then
SPACK_COMPREPLY="-h --help --mixed-toolchain --no-mixed-toolchain --scope"
else
SPACK_COMPREPLY=""
fi
}
_spack_compiler_add() {
if $list_options
then
SPACK_COMPREPLY="-h --help --mixed-toolchain --no-mixed-toolchain --scope"
else
SPACK_COMPREPLY=""
fi
}
_spack_compiler_remove() {
if $list_options
then
SPACK_COMPREPLY="-h --help -a --all --scope"
else
_installed_compilers
fi
}
_spack_compiler_rm() {
if $list_options
then
SPACK_COMPREPLY="-h --help -a --all --scope"
else
_installed_compilers
fi
}
_spack_compiler_list() {
SPACK_COMPREPLY="-h --help --scope"
}
_spack_compiler_info() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope"
else
_installed_compilers
fi
}
_spack_compilers() {
SPACK_COMPREPLY="-h --help --scope"
}
_spack_concretize() {
SPACK_COMPREPLY="-h --help -f --force --test -q --quiet -U --fresh --reuse --reuse-deps -j --jobs"
}
_spack_concretise() {
SPACK_COMPREPLY="-h --help -f --force --test -q --quiet -U --fresh --reuse --reuse-deps -j --jobs"
}
_spack_config() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope"
else
SPACK_COMPREPLY="get blame edit list add prefer-upstream remove rm update revert"
fi
}
_spack_config_get() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_config_sections
fi
}
_spack_config_blame() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_config_sections
fi
}
_spack_config_edit() {
if $list_options
then
SPACK_COMPREPLY="-h --help --print-file"
else
_config_sections
fi
}
_spack_config_list() {
SPACK_COMPREPLY="-h --help"
}
_spack_config_add() {
if $list_options
then
SPACK_COMPREPLY="-h --help -f --file"
else
SPACK_COMPREPLY=""
fi
}
_spack_config_prefer_upstream() {
SPACK_COMPREPLY="-h --help --local"
}
_spack_config_remove() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_config_rm() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_config_update() {
if $list_options
then
SPACK_COMPREPLY="-h --help -y --yes-to-all"
else
_config_sections
fi
}
_spack_config_revert() {
if $list_options
then
SPACK_COMPREPLY="-h --help -y --yes-to-all"
else
_config_sections
fi
}
_spack_containerize() {
SPACK_COMPREPLY="-h --help --list-os --last-stage"
}
_spack_containerise() {
SPACK_COMPREPLY="-h --help --list-os --last-stage"
}
_spack_create() {
if $list_options
then
SPACK_COMPREPLY="-h --help --keep-stage -n --name -t --template -r --repo -N --namespace -f --force --skip-editor -b --batch"
else
SPACK_COMPREPLY=""
fi
}
_spack_debug() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="create-db-tarball report"
fi
}
_spack_debug_create_db_tarball() {
SPACK_COMPREPLY="-h --help"
}
_spack_debug_report() {
SPACK_COMPREPLY="-h --help"
}
_spack_deconcretize() {
if $list_options
then
SPACK_COMPREPLY="-h --help --root -y --yes-to-all -a --all"
else
_all_packages
fi
}
_spack_dependencies() {
if $list_options
then
SPACK_COMPREPLY="-h --help -i --installed -t --transitive --deptype -V --no-expand-virtuals"
else
_all_packages
fi
}
_spack_dependents() {
if $list_options
then
SPACK_COMPREPLY="-h --help -i --installed -t --transitive"
else
_all_packages
fi
}
_spack_deprecate() {
if $list_options
then
SPACK_COMPREPLY="-h --help -y --yes-to-all -d --dependencies -D --no-dependencies -i --install-deprecator -I --no-install-deprecator -l --link-type"
else
_all_packages
fi
}
_spack_dev_build() {
if $list_options
then
SPACK_COMPREPLY="-h --help -j --jobs -d --source-path -i --ignore-dependencies -n --no-checksum --deprecated --keep-prefix --skip-patch -q --quiet --drop-in --test -b --before -u --until --clean --dirty -U --fresh --reuse --reuse-deps"
else
_all_packages
fi
}
_spack_develop() {
if $list_options
then
SPACK_COMPREPLY="-h --help -p --path --no-clone --clone -f --force"
else
_all_packages
fi
}
_spack_diff() {
if $list_options
then
SPACK_COMPREPLY="-h --help --json --first -a --attribute --ignore"
else
_all_packages
fi
}
_spack_docs() {
SPACK_COMPREPLY="-h --help"
}
_spack_edit() {
if $list_options
then
SPACK_COMPREPLY="-h --help -b --build-system -c --command -d --docs -t --test -m --module -r --repo -N --namespace"
else
_all_packages
fi
}
_spack_env() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="activate deactivate create remove rm list ls status st loads view update revert depfile"
fi
}
_spack_env_activate() {
if $list_options
then
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh --with-view -v --without-view -V -p --prompt --temp -d --dir"
else
_environments
fi
}
_spack_env_deactivate() {
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh"
}
_spack_env_create() {
if $list_options
then
SPACK_COMPREPLY="-h --help -d --dir --keep-relative --without-view --with-view"
else
_environments
fi
}
_spack_env_remove() {
if $list_options
then
SPACK_COMPREPLY="-h --help -y --yes-to-all"
else
_environments
fi
}
_spack_env_rm() {
if $list_options
then
SPACK_COMPREPLY="-h --help -y --yes-to-all"
else
_environments
fi
}
_spack_env_list() {
SPACK_COMPREPLY="-h --help"
}
_spack_env_ls() {
SPACK_COMPREPLY="-h --help"
}
_spack_env_status() {
SPACK_COMPREPLY="-h --help"
}
_spack_env_st() {
SPACK_COMPREPLY="-h --help"
}
_spack_env_loads() {
SPACK_COMPREPLY="-h --help -n --module-set-name -m --module-type --input-only -p --prefix -x --exclude -r --dependencies"
}
_spack_env_view() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_env_update() {
if $list_options
then
SPACK_COMPREPLY="-h --help -y --yes-to-all"
else
_environments
fi
}
_spack_env_revert() {
if $list_options
then
SPACK_COMPREPLY="-h --help -y --yes-to-all"
else
_environments
fi
}
_spack_env_depfile() {
if $list_options
then
SPACK_COMPREPLY="-h --help --make-prefix --make-target-prefix --make-disable-jobserver --use-buildcache -o --output -G --generator"
else
_all_packages
fi
}
_spack_extensions() {
if $list_options
then
SPACK_COMPREPLY="-h --help -l --long -L --very-long -d --deps -p --paths -s --show"
else
_extensions
fi
}
_spack_external() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="find list read-cray-manifest"
fi
}
_spack_external_find() {
if $list_options
then
SPACK_COMPREPLY="-h --help --not-buildable --exclude -p --path --scope --all -t --tag -j --jobs"
else
_all_packages
fi
}
_spack_external_list() {
SPACK_COMPREPLY="-h --help"
}
_spack_external_read_cray_manifest() {
SPACK_COMPREPLY="-h --help --file --directory --ignore-default-dir --dry-run --fail-on-error"
}
_spack_fetch() {
if $list_options
then
SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated -m --missing -D --dependencies"
else
_all_packages
fi
}
_spack_find() {
if $list_options
then
SPACK_COMPREPLY="-h --help --format -H --hashes --json -d --deps -p --paths --groups --no-groups -l --long -L --very-long -t --tag -N --namespaces -c --show-concretized -f --show-flags --show-full-compiler -x --explicit -X --implicit -u --unknown -m --missing -v --variants --loaded -M --only-missing --deprecated --only-deprecated --start-date --end-date"
else
_installed_packages
fi
}
_spack_gc() {
SPACK_COMPREPLY="-h --help -y --yes-to-all"
}
_spack_gpg() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="verify trust untrust sign create list init export publish"
fi
}
_spack_gpg_verify() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_installed_packages
fi
}
_spack_gpg_trust() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_gpg_untrust() {
if $list_options
then
SPACK_COMPREPLY="-h --help --signing"
else
_keys
fi
}
_spack_gpg_sign() {
if $list_options
then
SPACK_COMPREPLY="-h --help --output --key --clearsign"
else
_installed_packages
fi
}
_spack_gpg_create() {
if $list_options
then
SPACK_COMPREPLY="-h --help --comment --expires --export --export-secret"
else
SPACK_COMPREPLY=""
fi
}
_spack_gpg_list() {
SPACK_COMPREPLY="-h --help --trusted --signing"
}
_spack_gpg_init() {
SPACK_COMPREPLY="-h --help --from"
}
_spack_gpg_export() {
if $list_options
then
SPACK_COMPREPLY="-h --help --secret"
else
_keys
fi
}
_spack_gpg_publish() {
if $list_options
then
SPACK_COMPREPLY="-h --help -d --directory -m --mirror-name --mirror-url --rebuild-index"
else
_keys
fi
}
_spack_graph() {
if $list_options
then
SPACK_COMPREPLY="-h --help -a --ascii -d --dot -s --static -c --color -i --installed --deptype"
else
_all_packages
fi
}
_spack_help() {
if $list_options
then
SPACK_COMPREPLY="-h --help -a --all --spec"
else
_subcommands
fi
}
_spack_info() {
if $list_options
then
SPACK_COMPREPLY="-h --help -a --all --detectable --maintainers --no-dependencies --no-variants --no-versions --phases --tags --tests --virtuals --variants-by-name"
else
_all_packages
fi
}
_spack_install() {
if $list_options
then
SPACK_COMPREPLY="-h --help --only -u --until -j --jobs --overwrite --fail-fast --keep-prefix --keep-stage --dont-restage --use-cache --no-cache --cache-only --use-buildcache --include-build-deps --no-check-signature --show-log-on-error --source -n --no-checksum --deprecated -v --verbose --fake --only-concrete --add --no-add -f --file --clean --dirty --test --log-format --log-file --help-cdash --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp -y --yes-to-all -U --fresh --reuse --reuse-deps"
else
_all_packages
fi
}
_spack_license() {
if $list_options
then
SPACK_COMPREPLY="-h --help --root"
else
SPACK_COMPREPLY="list-files verify update-copyright-year"
fi
}
_spack_license_list_files() {
SPACK_COMPREPLY="-h --help"
}
_spack_license_verify() {
SPACK_COMPREPLY="-h --help"
}
_spack_license_update_copyright_year() {
SPACK_COMPREPLY="-h --help"
}
_spack_list() {
if $list_options
then
SPACK_COMPREPLY="-h --help -d --search-description --format -v --virtuals -t --tag --count --update"
else
_all_packages
fi
}
_spack_load() {
if $list_options
then
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh --first --only --list"
else
_installed_packages
fi
}
_spack_location() {
if $list_options
then
SPACK_COMPREPLY="-h --help -m --module-dir -r --spack-root -i --install-dir -p --package-dir -P --packages -s --stage-dir -S --stages --source-dir -b --build-dir -e --env --first"
else
_all_packages
fi
}
_spack_log_parse() {
if $list_options
then
SPACK_COMPREPLY="-h --help --show -c --context -p --profile -w --width -j --jobs"
else
SPACK_COMPREPLY=""
fi
}
_spack_maintainers() {
if $list_options
then
SPACK_COMPREPLY="-h --help --maintained --unmaintained -a --all --by-user"
else
_all_packages
fi
}
_spack_make_installer() {
if $list_options
then
SPACK_COMPREPLY="-h --help -v --spack-version -s --spack-source -g --git-installer-verbosity"
else
SPACK_COMPREPLY=""
fi
}
_spack_mark() {
if $list_options
then
SPACK_COMPREPLY="-h --help -a --all -e --explicit -i --implicit"
else
_installed_packages
fi
}
_spack_mirror() {
if $list_options
then
SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated"
else
SPACK_COMPREPLY="create destroy add remove rm set-url set list"
fi
}
_spack_mirror_create() {
if $list_options
then
SPACK_COMPREPLY="-h --help -d --directory -a --all -f --file --exclude-file --exclude-specs --skip-unstable-versions -D --dependencies -n --versions-per-spec"
else
_all_packages
fi
}
_spack_mirror_destroy() {
SPACK_COMPREPLY="-h --help -m --mirror-name --mirror-url"
}
_spack_mirror_add() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope --type --unsigned --signed --s3-access-key-id --s3-access-key-secret --s3-access-token --s3-profile --s3-endpoint-url --oci-username --oci-password"
else
_mirrors
fi
}
_spack_mirror_remove() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope"
else
_mirrors
fi
}
_spack_mirror_rm() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope"
else
_mirrors
fi
}
_spack_mirror_set_url() {
if $list_options
then
SPACK_COMPREPLY="-h --help --push --fetch --scope --s3-access-key-id --s3-access-key-secret --s3-access-token --s3-profile --s3-endpoint-url --oci-username --oci-password"
else
_mirrors
fi
}
_spack_mirror_set() {
if $list_options
then
SPACK_COMPREPLY="-h --help --push --fetch --type --url --unsigned --signed --scope --s3-access-key-id --s3-access-key-secret --s3-access-token --s3-profile --s3-endpoint-url --oci-username --oci-password"
else
_mirrors
fi
}
_spack_mirror_list() {
SPACK_COMPREPLY="-h --help --scope"
}
_spack_module() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="lmod tcl"
fi
}
_spack_module_lmod() {
if $list_options
then
SPACK_COMPREPLY="-h --help -n --name"
else
SPACK_COMPREPLY="refresh find rm loads setdefault"
fi
}
_spack_module_lmod_refresh() {
if $list_options
then
SPACK_COMPREPLY="-h --help --delete-tree --upstream-modules -y --yes-to-all"
else
_installed_packages
fi
}
_spack_module_lmod_find() {
if $list_options
then
SPACK_COMPREPLY="-h --help --full-path -r --dependencies"
else
_installed_packages
fi
}
_spack_module_lmod_rm() {
if $list_options
then
SPACK_COMPREPLY="-h --help -y --yes-to-all"
else
_installed_packages
fi
}
_spack_module_lmod_loads() {
if $list_options
then
SPACK_COMPREPLY="-h --help --input-only -p --prefix -x --exclude -r --dependencies"
else
_installed_packages
fi
}
_spack_module_lmod_setdefault() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_installed_packages
fi
}
_spack_module_tcl() {
if $list_options
then
SPACK_COMPREPLY="-h --help -n --name"
else
SPACK_COMPREPLY="refresh find rm loads setdefault"
fi
}
_spack_module_tcl_refresh() {
if $list_options
then
SPACK_COMPREPLY="-h --help --delete-tree --upstream-modules -y --yes-to-all"
else
_installed_packages
fi
}
_spack_module_tcl_find() {
if $list_options
then
SPACK_COMPREPLY="-h --help --full-path -r --dependencies"
else
_installed_packages
fi
}
_spack_module_tcl_rm() {
if $list_options
then
SPACK_COMPREPLY="-h --help -y --yes-to-all"
else
_installed_packages
fi
}
_spack_module_tcl_loads() {
if $list_options
then
SPACK_COMPREPLY="-h --help --input-only -p --prefix -x --exclude -r --dependencies"
else
_installed_packages
fi
}
_spack_module_tcl_setdefault() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_installed_packages
fi
}
_spack_patch() {
if $list_options
then
SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated -U --fresh --reuse --reuse-deps"
else
_all_packages
fi
}
_spack_pkg() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="add list diff added changed removed grep source hash"
fi
}
_spack_pkg_add() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_all_packages
fi
}
_spack_pkg_list() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_pkg_diff() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_pkg_added() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_pkg_changed() {
if $list_options
then
SPACK_COMPREPLY="-h --help -t --type"
else
SPACK_COMPREPLY=""
fi
}
_spack_pkg_removed() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_pkg_grep() {
if $list_options
then
SPACK_COMPREPLY="--help"
else
SPACK_COMPREPLY=""
fi
}
_spack_pkg_source() {
if $list_options
then
SPACK_COMPREPLY="-h --help -c --canonical"
else
_all_packages
fi
}
_spack_pkg_hash() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_all_packages
fi
}
_spack_providers() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_providers
fi
}
_spack_pydoc() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_python() {
if $list_options
then
SPACK_COMPREPLY="-h --help -V --version -c -u -i -m --path"
else
SPACK_COMPREPLY=""
fi
}
_spack_reindex() {
SPACK_COMPREPLY="-h --help"
}
_spack_remove() {
if $list_options
then
SPACK_COMPREPLY="-h --help -a --all -l --list-name -f --force"
else
_all_packages
fi
}
_spack_rm() {
if $list_options
then
SPACK_COMPREPLY="-h --help -a --all -l --list-name -f --force"
else
_all_packages
fi
}
_spack_repo() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="create list add remove rm"
fi
}
_spack_repo_create() {
if $list_options
then
SPACK_COMPREPLY="-h --help -d --subdirectory"
else
_repos
fi
}
_spack_repo_list() {
SPACK_COMPREPLY="-h --help --scope"
}
_spack_repo_add() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope"
else
SPACK_COMPREPLY=""
fi
}
_spack_repo_remove() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope"
else
_repos
fi
}
_spack_repo_rm() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope"
else
_repos
fi
}
_spack_resource() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="list show"
fi
}
_spack_resource_list() {
SPACK_COMPREPLY="-h --help --only-hashes"
}
_spack_resource_show() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_all_resource_hashes
fi
}
_spack_restage() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_all_packages
fi
}
_spack_solve() {
if $list_options
then
SPACK_COMPREPLY="-h --help --show -l --long -L --very-long -N --namespaces -I --install-status --no-install-status -y --yaml -j --json -c --cover -t --types --timers --stats -U --fresh --reuse --reuse-deps"
else
_all_packages
fi
}
_spack_spec() {
if $list_options
then
SPACK_COMPREPLY="-h --help -l --long -L --very-long -N --namespaces -I --install-status --no-install-status -y --yaml -j --json --format -c --cover -t --types -U --fresh --reuse --reuse-deps"
else
_all_packages
fi
}
_spack_stage() {
if $list_options
then
SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated -p --path -U --fresh --reuse --reuse-deps"
else
_all_packages
fi
}
_spack_style() {
if $list_options
then
SPACK_COMPREPLY="-h --help -b --base -a --all -r --root-relative -U --no-untracked -f --fix --root -t --tool -s --skip"
else
SPACK_COMPREPLY=""
fi
}
_spack_tags() {
if $list_options
then
SPACK_COMPREPLY="-h --help -i --installed -a --all"
else
SPACK_COMPREPLY=""
fi
}
_spack_test() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="run list find status results remove"
fi
}
_spack_test_run() {
if $list_options
then
SPACK_COMPREPLY="-h --help --alias --fail-fast --fail-first --externals -x --explicit --keep-stage --log-format --log-file --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp --help-cdash --clean --dirty"
else
_installed_packages
fi
}
_spack_test_list() {
if $list_options
then
SPACK_COMPREPLY="-h --help -a --all"
else
SPACK_COMPREPLY=""
fi
}
_spack_test_find() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_all_packages
fi
}
_spack_test_status() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY=""
fi
}
_spack_test_results() {
if $list_options
then
SPACK_COMPREPLY="-h --help -l --logs -f --failed"
else
SPACK_COMPREPLY=""
fi
}
_spack_test_remove() {
if $list_options
then
SPACK_COMPREPLY="-h --help -y --yes-to-all"
else
SPACK_COMPREPLY=""
fi
}
_spack_test_env() {
if $list_options
then
SPACK_COMPREPLY="-h --help --clean --dirty -U --fresh --reuse --reuse-deps --dump --pickle"
else
_all_packages
fi
}
_spack_tutorial() {
SPACK_COMPREPLY="-h --help -y --yes-to-all"
}
_spack_undevelop() {
if $list_options
then
SPACK_COMPREPLY="-h --help -a --all"
else
_all_packages
fi
}
_spack_uninstall() {
if $list_options
then
SPACK_COMPREPLY="-h --help -f --force --remove -R --dependents -y --yes-to-all -a --all --origin"
else
_installed_packages
fi
}
_spack_unit_test() {
if $list_options
then
SPACK_COMPREPLY="-h --help -H --pytest-help -l --list -L --list-long -N --list-names --extension -s -k --showlocals"
else
_unit_tests
fi
}
_spack_unload() {
if $list_options
then
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh -a --all"
else
_installed_packages
fi
}
_spack_url() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="parse list summary stats"
fi
}
_spack_url_parse() {
if $list_options
then
SPACK_COMPREPLY="-h --help -s --spider"
else
SPACK_COMPREPLY=""
fi
}
_spack_url_list() {
SPACK_COMPREPLY="-h --help -c --color -e --extrapolation -n --incorrect-name -N --correct-name -v --incorrect-version -V --correct-version"
}
_spack_url_summary() {
SPACK_COMPREPLY="-h --help"
}
_spack_url_stats() {
SPACK_COMPREPLY="-h --help --show-issues"
}
_spack_verify() {
if $list_options
then
SPACK_COMPREPLY="-h --help -l --local -j --json -a --all -s --specs -f --files"
else
_all_packages
fi
}
_spack_versions() {
if $list_options
then
SPACK_COMPREPLY="-h --help -s --safe --safe-only -r --remote -n --new -j --jobs"
else
_all_packages
fi
}
_spack_view() {
if $list_options
then
SPACK_COMPREPLY="-h --help -v --verbose -e --exclude -d --dependencies"
else
SPACK_COMPREPLY="symlink add soft hardlink hard copy relocate remove rm statlink status check"
fi
}
_spack_view_symlink() {
if $list_options
then
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
else
_all_packages
fi
}
_spack_view_add() {
if $list_options
then
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
else
_all_packages
fi
}
_spack_view_soft() {
if $list_options
then
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
else
_all_packages
fi
}
_spack_view_hardlink() {
if $list_options
then
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
else
_all_packages
fi
}
_spack_view_hard() {
if $list_options
then
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
else
_all_packages
fi
}
_spack_view_copy() {
if $list_options
then
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
else
_all_packages
fi
}
_spack_view_relocate() {
if $list_options
then
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
else
_all_packages
fi
}
_spack_view_remove() {
if $list_options
then
SPACK_COMPREPLY="-h --help --no-remove-dependents -a --all"
else
_all_packages
fi
}
_spack_view_rm() {
if $list_options
then
SPACK_COMPREPLY="-h --help --no-remove-dependents -a --all"
else
_all_packages
fi
}
_spack_view_statlink() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_all_packages
fi
}
_spack_view_status() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_all_packages
fi
}
_spack_view_check() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
_all_packages
fi
}
|