mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-10 18:31:14 -03:00
Compare commits
1165 Commits
pre_ast_pa
...
2.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e752ac3035 | ||
|
|
8ca21767fe | ||
|
|
e60db8075c | ||
|
|
322a611872 | ||
|
|
ecb2da3142 | ||
|
|
d79a72d722 | ||
|
|
781bbe217a | ||
|
|
064ad7b981 | ||
|
|
6fbb3c9976 | ||
|
|
7b34aaa432 | ||
|
|
5c6143d8e9 | ||
|
|
ea407476d0 | ||
|
|
b6b6de3304 | ||
|
|
79a6961793 | ||
|
|
6c53862ff1 | ||
|
|
c0cf25cf0b | ||
|
|
edf6a951ee | ||
|
|
1c99ef5b6e | ||
|
|
a83323705d | ||
|
|
49b49d7ed4 | ||
|
|
14bf2ee5cb | ||
|
|
cec1dc2095 | ||
|
|
9b5026f7e5 | ||
|
|
96dfd27725 | ||
|
|
905d8b2aa5 | ||
|
|
3ca518255e | ||
|
|
c59119e0b7 | ||
|
|
0748a4d8b6 | ||
|
|
3722f91e38 | ||
|
|
ba721d6cbf | ||
|
|
5532e5aa8a | ||
|
|
9cae8bf8a6 | ||
|
|
cb92a1d12f | ||
|
|
1242e63b6a | ||
|
|
f30872a7b5 | ||
|
|
9c3a9a1e73 | ||
|
|
c91f70523c | ||
|
|
3d9c24196d | ||
|
|
6f438f65de | ||
|
|
879d03d0fe | ||
|
|
7a1fc028e3 | ||
|
|
c3ef23b10f | ||
|
|
722fedc8fd | ||
|
|
32936b0eb9 | ||
|
|
3559f20c8f | ||
|
|
9dc53f7c1b | ||
|
|
9c007d1c94 | ||
|
|
6faac2d2c8 | ||
|
|
665314b240 | ||
|
|
cb1e3c501d | ||
|
|
9e8e5af064 | ||
|
|
fd731fb74f | ||
|
|
d1a56139e1 | ||
|
|
3408b2759e | ||
|
|
fbe28fd5d8 | ||
|
|
97aa1c033b | ||
|
|
34296dd440 | ||
|
|
87428672d8 | ||
|
|
84899fb2f8 | ||
|
|
73f344f41b | ||
|
|
9f8cec7f9e | ||
|
|
318daaffb2 | ||
|
|
cad1dc5293 | ||
|
|
900a8a1408 | ||
|
|
384cb2d735 | ||
|
|
ad61c3f0d6 | ||
|
|
c10aab77da | ||
|
|
e17f6fb2dc | ||
|
|
e896acffd7 | ||
|
|
20a6b65b25 | ||
|
|
01026c137f | ||
|
|
7aac3db55c | ||
|
|
0ecf294d34 | ||
|
|
89da09636e | ||
|
|
f8299a1274 | ||
|
|
94e9d6a5ef | ||
|
|
733108e33b | ||
|
|
48d353610f | ||
|
|
bff68f3bfc | ||
|
|
b9bd0166b6 | ||
|
|
1116929d2f | ||
|
|
22103e4849 | ||
|
|
e421c12cc4 | ||
|
|
5a9b1b1b57 | ||
|
|
d99ed89aa3 | ||
|
|
b9dd057a04 | ||
|
|
369a09e57e | ||
|
|
468648ff51 | ||
|
|
8c41a053fe | ||
|
|
a1b3358cb8 | ||
|
|
16e65c849c | ||
|
|
33c0d93b20 | ||
|
|
3d163eb910 | ||
|
|
3e32715693 | ||
|
|
388a8d09d8 | ||
|
|
b4aa2b7c2c | ||
|
|
dd595dd110 | ||
|
|
95687a03fb | ||
|
|
b3aa187867 | ||
|
|
b5d9e366ad | ||
|
|
d7ba6e4a1d | ||
|
|
981a71555f | ||
|
|
597dda5a4b | ||
|
|
66acd17bc0 | ||
|
|
793784c087 | ||
|
|
df6f1e8f62 | ||
|
|
facfe33218 | ||
|
|
78dfc57b1e | ||
|
|
d17ba69f9e | ||
|
|
5c16b5598b | ||
|
|
028d9e8e3b | ||
|
|
53a4814d8b | ||
|
|
1ff9aba6b1 | ||
|
|
39748870b6 | ||
|
|
b0cbad84f4 | ||
|
|
f920be5ea3 | ||
|
|
f9384fe323 | ||
|
|
789a54222d | ||
|
|
68efa5233c | ||
|
|
dce487380c | ||
|
|
75a76c596c | ||
|
|
7164769d33 | ||
|
|
9e3f912747 | ||
|
|
e529b78365 | ||
|
|
9374494d2b | ||
|
|
2018b9b217 | ||
|
|
3c0902b7e4 | ||
|
|
b31305b9bd | ||
|
|
d4eded2376 | ||
|
|
20974edc14 | ||
|
|
6e2132e01f | ||
|
|
34db67680d | ||
|
|
7864d0d416 | ||
|
|
d1feb9bcbf | ||
|
|
906d235601 | ||
|
|
e045eabad6 | ||
|
|
218bd7a687 | ||
|
|
70a99e494d | ||
|
|
e340baf6cc | ||
|
|
182faca2e5 | ||
|
|
14834ff076 | ||
|
|
a0127a0c7a | ||
|
|
390fe05a87 | ||
|
|
b9ff17f33c | ||
|
|
5f2ea007a5 | ||
|
|
e5a2343879 | ||
|
|
8d50b2509d | ||
|
|
a76afd6dae | ||
|
|
77a7dd82a9 | ||
|
|
04651105a8 | ||
|
|
d300bd4b62 | ||
|
|
a21db45cee | ||
|
|
2e948d9d6d | ||
|
|
6fa9a18a2b | ||
|
|
da2e2c2e99 | ||
|
|
8ba0ab2172 | ||
|
|
96589920d5 | ||
|
|
8c17d48c83 | ||
|
|
d458a8a03d | ||
|
|
39fe9fcfcd | ||
|
|
bf80b0db19 | ||
|
|
ebfaa8cc95 | ||
|
|
46cd89c2db | ||
|
|
8124b5073f | ||
|
|
a4e81d3978 | ||
|
|
147078f43d | ||
|
|
90629caa61 | ||
|
|
9cec0ad02c | ||
|
|
11bece80a8 | ||
|
|
a10f729ef9 | ||
|
|
b9db555343 | ||
|
|
9b43e6fa8b | ||
|
|
1edb7d3aa5 | ||
|
|
14fde56d32 | ||
|
|
a8059c5962 | ||
|
|
381404c4f4 | ||
|
|
68029095b5 | ||
|
|
9a34df604d | ||
|
|
2f96d2b19a | ||
|
|
bfd1951023 | ||
|
|
019c0fed23 | ||
|
|
bb01e5f81a | ||
|
|
8526a82947 | ||
|
|
94a3203c74 | ||
|
|
184110c2e7 | ||
|
|
3b3fde1c5e | ||
|
|
60a2e0a2ad | ||
|
|
c78e56c509 | ||
|
|
190cac07a3 | ||
|
|
efc3846fcf | ||
|
|
83df5ea660 | ||
|
|
e13d423b68 | ||
|
|
eafd577629 | ||
|
|
196a7c9d18 | ||
|
|
daa856ed47 | ||
|
|
04dc0aca50 | ||
|
|
918d5595bd | ||
|
|
0abdf9eeff | ||
|
|
8e8549ef7a | ||
|
|
cfc2d7fb3f | ||
|
|
c77f8e73c8 | ||
|
|
dda6be2592 | ||
|
|
93eea8de66 | ||
|
|
2ddd839f52 | ||
|
|
7555772432 | ||
|
|
33f9e071a4 | ||
|
|
9aaf93f364 | ||
|
|
14fa48864a | ||
|
|
206ea15b68 | ||
|
|
a7bab7b18b | ||
|
|
a6a41d159c | ||
|
|
59da180b8f | ||
|
|
51e446bc5f | ||
|
|
f68f91b399 | ||
|
|
0ea80a319e | ||
|
|
38caa0d988 | ||
|
|
7c2a420e88 | ||
|
|
d944add782 | ||
|
|
338a1311f5 | ||
|
|
00e0ed64bc | ||
|
|
f2447c537e | ||
|
|
220a15b8f6 | ||
|
|
330e996c30 | ||
|
|
32c0afe5a9 | ||
|
|
e83441395e | ||
|
|
43d23ee56e | ||
|
|
58a0f7f091 | ||
|
|
09bac97bb4 | ||
|
|
701a37fd00 | ||
|
|
9d7fbd2cc0 | ||
|
|
32010d1d93 | ||
|
|
75860db511 | ||
|
|
4d588a24e9 | ||
|
|
9382dc32df | ||
|
|
6db82c162c | ||
|
|
c31ad3ed07 | ||
|
|
c33a3862cc | ||
|
|
6cc64fc9e3 | ||
|
|
aafff91ac8 | ||
|
|
4b6639f697 | ||
|
|
fa588db148 | ||
|
|
851f0bcfb3 | ||
|
|
d9d9fa512d | ||
|
|
84372ba79d | ||
|
|
7ac593273e | ||
|
|
a529fc9d83 | ||
|
|
173a6a71c0 | ||
|
|
a177eb8c16 | ||
|
|
16459099af | ||
|
|
fa854d7a01 | ||
|
|
b3b83449cf | ||
|
|
d62694a9ce | ||
|
|
6044ac7e5e | ||
|
|
ec5f3d0cc8 | ||
|
|
f03d90e9de | ||
|
|
a31b44f9b2 | ||
|
|
a580d04dbc | ||
|
|
c84cdcd00c | ||
|
|
5638764bad | ||
|
|
ab7af98ded | ||
|
|
b0e09303a6 | ||
|
|
a242a64833 | ||
|
|
315ff1e712 | ||
|
|
21a751d153 | ||
|
|
090f027de1 | ||
|
|
cfa41686d2 | ||
|
|
3fe1069219 | ||
|
|
98091faeaf | ||
|
|
15e095233b | ||
|
|
a64c372a28 | ||
|
|
1f91a2a6f5 | ||
|
|
4aa38db56f | ||
|
|
9e32b330aa | ||
|
|
049bd227ed | ||
|
|
ff7108877b | ||
|
|
1927ebbc5d | ||
|
|
5db9548f40 | ||
|
|
cab115c8b9 | ||
|
|
4568359e27 | ||
|
|
07e4170418 | ||
|
|
0372cdbe7e | ||
|
|
5d1ddc9c58 | ||
|
|
c0b8e81b02 | ||
|
|
c3bacc78c7 | ||
|
|
4140e678f4 | ||
|
|
cc0fcdc18d | ||
|
|
fbade198b9 | ||
|
|
d982f2a575 | ||
|
|
becdc8b4fc | ||
|
|
76c6985f82 | ||
|
|
ac8c5910eb | ||
|
|
cc7f1755aa | ||
|
|
7493c9a040 | ||
|
|
9fc8729b96 | ||
|
|
80859b8483 | ||
|
|
71c55e1a4a | ||
|
|
d2f23e1df4 | ||
|
|
c70769c656 | ||
|
|
a13e067b85 | ||
|
|
8e8e63144b | ||
|
|
14724401ff | ||
|
|
72f5ab3186 | ||
|
|
3f0210dc96 | ||
|
|
3c8b344a41 | ||
|
|
46241e383f | ||
|
|
ea79f6b03f | ||
|
|
649c3f262d | ||
|
|
f85ec782a0 | ||
|
|
9df0bcea99 | ||
|
|
7764a1a6f8 | ||
|
|
980bf6e2f4 | ||
|
|
501c3d5518 | ||
|
|
6a0931aeae | ||
|
|
d7b3821c0a | ||
|
|
1665f84d60 | ||
|
|
fabee7e246 | ||
|
|
0ffa434926 | ||
|
|
a7727765dc | ||
|
|
33a76e1f8e | ||
|
|
cfc06203e7 | ||
|
|
6d7a7b00d7 | ||
|
|
3f11d90744 | ||
|
|
ae7b6156ac | ||
|
|
4ba95ad1c3 | ||
|
|
bae2b2cc47 | ||
|
|
47c357a354 | ||
|
|
b592da41f6 | ||
|
|
646d9ab431 | ||
|
|
43e451d4d8 | ||
|
|
1be5e68e99 | ||
|
|
ab5b22982f | ||
|
|
5157ac30fa | ||
|
|
3616dd5889 | ||
|
|
489fb7ec3f | ||
|
|
51527612d3 | ||
|
|
c181de1d7f | ||
|
|
d67800bbce | ||
|
|
27dd37ebb4 | ||
|
|
a186f04f15 | ||
|
|
15ca3b426f | ||
|
|
1c9aec4899 | ||
|
|
f0d8d90ed1 | ||
|
|
6ece8523b1 | ||
|
|
84af3dcd18 | ||
|
|
26051ea198 | ||
|
|
b00cbae4b5 | ||
|
|
4f4734fc9b | ||
|
|
3ac28f2b01 | ||
|
|
2f71c15b93 | ||
|
|
7cad0069e8 | ||
|
|
a0e5cdd178 | ||
|
|
ba11a0eb9b | ||
|
|
b511550917 | ||
|
|
7935b86cb2 | ||
|
|
fb8eb22e56 | ||
|
|
6925cd5d88 | ||
|
|
35595dbffd | ||
|
|
cd4fa518b8 | ||
|
|
316d7004a3 | ||
|
|
1096b1acd5 | ||
|
|
5766c7c53a | ||
|
|
bbce0909fe | ||
|
|
73158d6255 | ||
|
|
0986b6d991 | ||
|
|
c4a453fb22 | ||
|
|
1563501868 | ||
|
|
5f82f721d2 | ||
|
|
8d03baa4e0 | ||
|
|
a9b7e4582f | ||
|
|
2726712e01 | ||
|
|
8d3d51a020 | ||
|
|
5afd42c097 | ||
|
|
5b33e60752 | ||
|
|
80078491bd | ||
|
|
0a3f220572 | ||
|
|
5eee7d17f6 | ||
|
|
4718636ae2 | ||
|
|
2cd7f1443c | ||
|
|
7a9e2d733a | ||
|
|
4ed4b265a5 | ||
|
|
e689a38663 | ||
|
|
e5aa06991e | ||
|
|
cb40507b7b | ||
|
|
7d7a636f24 | ||
|
|
2450d00693 | ||
|
|
a4059d3e60 | ||
|
|
fe9cf673a2 | ||
|
|
b480c8ce79 | ||
|
|
94e535507c | ||
|
|
a027566295 | ||
|
|
e1f623f548 | ||
|
|
4573a4d69c | ||
|
|
a012aedb31 | ||
|
|
a9c8b75599 | ||
|
|
c64f38f0bf | ||
|
|
8f8c4cdd17 | ||
|
|
f889ad0fda | ||
|
|
166a2f91bd | ||
|
|
a069aec11d | ||
|
|
8a3cf144f2 | ||
|
|
a381ac2691 | ||
|
|
e2be71cbe4 | ||
|
|
b8181f9eb8 | ||
|
|
555ff00a30 | ||
|
|
6083c6fc72 | ||
|
|
940f264ee6 | ||
|
|
761be8ab7f | ||
|
|
51c2005ea2 | ||
|
|
510ff6a689 | ||
|
|
7229d7a326 | ||
|
|
1a7b33e8fb | ||
|
|
2d3f7babe3 | ||
|
|
0a32d96b27 | ||
|
|
174f5ba99a | ||
|
|
708e21f929 | ||
|
|
eb40baacfc | ||
|
|
133ba6e01b | ||
|
|
7f4908b0db | ||
|
|
9bfb4f1e11 | ||
|
|
ea435d35ad | ||
|
|
5b709eb5df | ||
|
|
5c25be51ea | ||
|
|
f6da9d4d5d | ||
|
|
f22864b813 | ||
|
|
22fd8e65ad | ||
|
|
190712d4b0 | ||
|
|
efb1467e4e | ||
|
|
6b75a4593b | ||
|
|
a04d5fd065 | ||
|
|
8643a5e266 | ||
|
|
47f97bbdd5 | ||
|
|
2e034e767f | ||
|
|
aed92b9a2c | ||
|
|
482e615fe0 | ||
|
|
cb46ed3701 | ||
|
|
9c78295a9a | ||
|
|
15cf06438e | ||
|
|
93b296d899 | ||
|
|
6e133c90e8 | ||
|
|
f1bd2b823d | ||
|
|
ac92f54ca6 | ||
|
|
1b4c85eb69 | ||
|
|
fb792c60cd | ||
|
|
38e153f568 | ||
|
|
6821f5ef4a | ||
|
|
ab433cfe65 | ||
|
|
6a57a50968 | ||
|
|
cb9ef98bed | ||
|
|
89f0b9abc3 | ||
|
|
0e5ddfd9f5 | ||
|
|
0a249c84ce | ||
|
|
fd70ae0b61 | ||
|
|
76aeae5db6 | ||
|
|
1facdd30fb | ||
|
|
4b7dc525b8 | ||
|
|
4acea72700 | ||
|
|
cf688f6ba2 | ||
|
|
5f3b0d9f1e | ||
|
|
05848038db | ||
|
|
664e2e5686 | ||
|
|
adbcecb456 | ||
|
|
3df9e20ca7 | ||
|
|
3f005c928a | ||
|
|
b3e28ac41a | ||
|
|
c39fe3433b | ||
|
|
668fa66d78 | ||
|
|
98ebb21489 | ||
|
|
137abd0cfa | ||
|
|
d7308fecbe | ||
|
|
73fb9915fd | ||
|
|
855a119654 | ||
|
|
cf7a6a6a65 | ||
|
|
509d152e54 | ||
|
|
35e6fb3788 | ||
|
|
9b79931265 | ||
|
|
14a7118499 | ||
|
|
afdabd97ff | ||
|
|
07f8fc7697 | ||
|
|
def7666609 | ||
|
|
c900f23662 | ||
|
|
7b093ee4b3 | ||
|
|
9f75cef5e5 | ||
|
|
a410c31bf8 | ||
|
|
1cd50ba572 | ||
|
|
1052eeee8c | ||
|
|
e22f0dda32 | ||
|
|
766a6b8309 | ||
|
|
d282bc4625 | ||
|
|
677cee44ad | ||
|
|
60e7726832 | ||
|
|
385b00a468 | ||
|
|
1c4223889b | ||
|
|
90a4fd34d2 | ||
|
|
2820c7a9cd | ||
|
|
edd4f3d5ad | ||
|
|
aa7fe3b132 | ||
|
|
1d9886d0f7 | ||
|
|
6068e85ef2 | ||
|
|
ced471d4ce | ||
|
|
2445ac4a53 | ||
|
|
1d0279eac5 | ||
|
|
f8b21fe199 | ||
|
|
0f330d7226 | ||
|
|
cb29350954 | ||
|
|
7fce9e2411 | ||
|
|
cc52a59e1a | ||
|
|
24ac7d2698 | ||
|
|
130619d6b0 | ||
|
|
71ab40e536 | ||
|
|
7638a7d531 | ||
|
|
b92a09d5e7 | ||
|
|
3d29cc8636 | ||
|
|
d6c5a1e0c4 | ||
|
|
9bcd4a6811 | ||
|
|
e90b1651e4 | ||
|
|
66ccae4bfe | ||
|
|
02a07164f3 | ||
|
|
9419191aa6 | ||
|
|
f71b10df8c | ||
|
|
0b7735d279 | ||
|
|
1f3a93a3af | ||
|
|
f9f773cc28 | ||
|
|
d9bf53c6e5 | ||
|
|
f549ada16c | ||
|
|
d8b955294a | ||
|
|
8aad53556d | ||
|
|
61ce9db4ba | ||
|
|
2da435712a | ||
|
|
9079ec459c | ||
|
|
aaddccfdb1 | ||
|
|
033373f078 | ||
|
|
d63db59ade | ||
|
|
20899f2df9 | ||
|
|
b9948ca297 | ||
|
|
f33e6a053e | ||
|
|
9f725bee1f | ||
|
|
3e2d68a059 | ||
|
|
2974025010 | ||
|
|
9a90e041f3 | ||
|
|
b0be15d4f7 | ||
|
|
a24998abac | ||
|
|
cc49042294 | ||
|
|
3981b644d6 | ||
|
|
4651919bd8 | ||
|
|
fed4bb5c07 | ||
|
|
ec903ce625 | ||
|
|
3ea956a0b4 | ||
|
|
d0c85471b4 | ||
|
|
3cc62c1fd2 | ||
|
|
079e369e91 | ||
|
|
06400b83b1 | ||
|
|
fe68d30be9 | ||
|
|
a3a11c2e0c | ||
|
|
3f526698ab | ||
|
|
78e2b7cc08 | ||
|
|
6ce74febc7 | ||
|
|
ede3d422a0 | ||
|
|
629a39b45b | ||
|
|
397249a8d5 | ||
|
|
b44b624ca5 | ||
|
|
6513c7eab8 | ||
|
|
276d90a45d | ||
|
|
c94b15a951 | ||
|
|
e4d6eaf17a | ||
|
|
60b9f8db18 | ||
|
|
cff928e2dc | ||
|
|
6aa701b3ee | ||
|
|
cb480dddf6 | ||
|
|
33c714ca03 | ||
|
|
bcda3f1baa | ||
|
|
4ae2753025 | ||
|
|
b5cd21c337 | ||
|
|
8844f0c142 | ||
|
|
4cb4fc3ef8 | ||
|
|
6cabd42ed2 | ||
|
|
0daee33ad6 | ||
|
|
b97a94ccc8 | ||
|
|
5cc3dcdbd8 | ||
|
|
7e3382340e | ||
|
|
87abcecca6 | ||
|
|
8ca88f14f7 | ||
|
|
b4a4a7c611 | ||
|
|
556680cf5e | ||
|
|
f4077bd41f | ||
|
|
cb5c560688 | ||
|
|
8ac0fdfea7 | ||
|
|
6dfd71670a | ||
|
|
4d4cc34aff | ||
|
|
c070a2aa3e | ||
|
|
af14cf8f8b | ||
|
|
35ba97cbdf | ||
|
|
9f59cf1468 | ||
|
|
6c80a3461c | ||
|
|
5591afff6e | ||
|
|
8144725739 | ||
|
|
52ae5f885e | ||
|
|
b6658c5497 | ||
|
|
aad5163b49 | ||
|
|
6d18bf5cd4 | ||
|
|
adabc2d7a0 | ||
|
|
d07ea3b66a | ||
|
|
2bb08a4ca0 | ||
|
|
30ae473d85 | ||
|
|
e9f870e25a | ||
|
|
317660c2fe | ||
|
|
5e60efefbf | ||
|
|
f6a89d13c2 | ||
|
|
3e01dd955f | ||
|
|
27fa0ea9d7 | ||
|
|
2de914d8c3 | ||
|
|
616fa85458 | ||
|
|
20ad496c00 | ||
|
|
fa88c42cf1 | ||
|
|
e84a762171 | ||
|
|
16e50c258a | ||
|
|
cce4265cef | ||
|
|
973dd6ffbd | ||
|
|
72e8489d50 | ||
|
|
cfa13ed84c | ||
|
|
29b3b6b31e | ||
|
|
533496e43a | ||
|
|
6f7a7459c1 | ||
|
|
6b062b07b4 | ||
|
|
bfd3a47380 | ||
|
|
0933e5cab4 | ||
|
|
cc565fc16c | ||
|
|
62d86b3d18 | ||
|
|
4bbbd2dde6 | ||
|
|
b884117a9e | ||
|
|
7def139020 | ||
|
|
b667eee351 | ||
|
|
891f55b2b3 | ||
|
|
7b12fd26f3 | ||
|
|
387ec5c06a | ||
|
|
dcc043df3b | ||
|
|
2457997cd9 | ||
|
|
d9bed68fe9 | ||
|
|
2eb65b3625 | ||
|
|
76fdfe6890 | ||
|
|
495adee269 | ||
|
|
383aaa236e | ||
|
|
8c89e6bce5 | ||
|
|
98297e5234 | ||
|
|
3915faf382 | ||
|
|
d5fa4b2ccb | ||
|
|
3ff104ba30 | ||
|
|
706286c289 | ||
|
|
18c1b12741 | ||
|
|
5cda1e55e0 | ||
|
|
195cd130f8 | ||
|
|
b19f45e15d | ||
|
|
3acd0dfe48 | ||
|
|
74cedbf1c5 | ||
|
|
7d47ec4c46 | ||
|
|
14cdd24f78 | ||
|
|
1cfd055f82 | ||
|
|
ed5e585684 | ||
|
|
32948b8dc6 | ||
|
|
ad5ad3d1ad | ||
|
|
3bc2dda00d | ||
|
|
ee8e9c0291 | ||
|
|
f4bc1ef4a2 | ||
|
|
3513ce3ac0 | ||
|
|
6277a2e4a4 | ||
|
|
84faa60c4e | ||
|
|
735195e8ea | ||
|
|
0f15ab8d05 | ||
|
|
17c2d76c5e | ||
|
|
11c1562512 | ||
|
|
ef646f0f78 | ||
|
|
7b3132d39d | ||
|
|
8345fc2b9e | ||
|
|
58f4182880 | ||
|
|
ecf56606dc | ||
|
|
be3e64e5ea | ||
|
|
741342ba1d | ||
|
|
d97e31b4ab | ||
|
|
ce4081af93 | ||
|
|
32f5edc9c5 | ||
|
|
b481128a93 | ||
|
|
ab62001b74 | ||
|
|
2dfd57bb8c | ||
|
|
20d7a142c5 | ||
|
|
9ae06c541f | ||
|
|
655293ece9 | ||
|
|
a983318501 | ||
|
|
8769c06350 | ||
|
|
5066710e60 | ||
|
|
451c97f35a | ||
|
|
8a577a9d4d | ||
|
|
950150469a | ||
|
|
3cbace98a7 | ||
|
|
e214df8980 | ||
|
|
e3cccdf571 | ||
|
|
a0bf841be2 | ||
|
|
73cbb0c65f | ||
|
|
2f89ddbead | ||
|
|
a526693915 | ||
|
|
31f2a3a7d7 | ||
|
|
147403f958 | ||
|
|
38c52cf9b5 | ||
|
|
64c1c75c42 | ||
|
|
2b11d1060c | ||
|
|
a73b903df9 | ||
|
|
30cfb3e795 | ||
|
|
a0e6d4375a | ||
|
|
c7aca5cc35 | ||
|
|
3225d7e169 | ||
|
|
6596d91c82 | ||
|
|
d554b7da08 | ||
|
|
cd7f1a15f8 | ||
|
|
fa68c2619f | ||
|
|
e97bec10ea | ||
|
|
7763718b60 | ||
|
|
7f2c4cbf8a | ||
|
|
91ebe12fc2 | ||
|
|
13e1e7e1e9 | ||
|
|
8a263952ad | ||
|
|
f27232bd0a | ||
|
|
16534ec644 | ||
|
|
7e44bcfd8a | ||
|
|
8cbd66b0f9 | ||
|
|
47a81c2b39 | ||
|
|
56bf209f84 | ||
|
|
333fb1bf97 | ||
|
|
cbef88a593 | ||
|
|
b13179d4f4 | ||
|
|
cf89d9bfb0 | ||
|
|
f49848c8a4 | ||
|
|
0101b39f6c | ||
|
|
4285baa6e1 | ||
|
|
e530af1ff7 | ||
|
|
60e94a4ec8 | ||
|
|
c66a574fa0 | ||
|
|
ef3259035d | ||
|
|
4226f4412b | ||
|
|
368983d8da | ||
|
|
16b982958b | ||
|
|
0c4819131c | ||
|
|
186b0f62eb | ||
|
|
77bc4c5725 | ||
|
|
dd47da92f5 | ||
|
|
f8e35de18d | ||
|
|
a7facfb760 | ||
|
|
f5e62f28bc | ||
|
|
60c8012e9e | ||
|
|
08d6e515c7 | ||
|
|
fac2f27dd3 | ||
|
|
ed37427f9e | ||
|
|
7a5a277c29 | ||
|
|
38da76804e | ||
|
|
a949f0b0c3 | ||
|
|
ffc23046a2 | ||
|
|
07944cfd20 | ||
|
|
91aadab3dd | ||
|
|
c3425bc55f | ||
|
|
55bc4168bf | ||
|
|
ba1b5e34a7 | ||
|
|
753c42a3d5 | ||
|
|
97c2ec8dcf | ||
|
|
4948508277 | ||
|
|
fb89c762fc | ||
|
|
58ebdd4a7e | ||
|
|
d7f22a0c27 | ||
|
|
3b4794ae94 | ||
|
|
c0989dce2d | ||
|
|
8412c867a5 | ||
|
|
10642a34f1 | ||
|
|
6a94b51cba | ||
|
|
36ef521c0e | ||
|
|
bf14668b2a | ||
|
|
a475dd15e6 | ||
|
|
bb0b82a110 | ||
|
|
2bbb59964f | ||
|
|
4fd32eb48e | ||
|
|
2872a98b2b | ||
|
|
023af5585f | ||
|
|
3d85000f13 | ||
|
|
3d1a204c83 | ||
|
|
1ce30deec3 | ||
|
|
8ed08872b9 | ||
|
|
7a75e7341b | ||
|
|
ec6dee8bd1 | ||
|
|
f2a507c4a7 | ||
|
|
17ab7bde44 | ||
|
|
fcc363333c | ||
|
|
7ef9e4d8e7 | ||
|
|
3180910fd1 | ||
|
|
b01d09d704 | ||
|
|
2f6551b3b1 | ||
|
|
50ae14cf7b | ||
|
|
79b7cd69bb | ||
|
|
cf237a0e4f | ||
|
|
c0d147c5c4 | ||
|
|
bd707b4a96 | ||
|
|
daaed863da | ||
|
|
2bdfac2036 | ||
|
|
d74a23e583 | ||
|
|
44b35f7735 | ||
|
|
0d3169ef70 | ||
|
|
fe3b439e31 | ||
|
|
6c987d6708 | ||
|
|
28fd1a4c5d | ||
|
|
bd895aa76c | ||
|
|
1177daecde | ||
|
|
42813eeb84 | ||
|
|
d4fafeb6d6 | ||
|
|
1270384ede | ||
|
|
aa1b065dd1 | ||
|
|
7248b2213d | ||
|
|
74b28f0a86 | ||
|
|
005edf71a8 | ||
|
|
c1f64ba017 | ||
|
|
42166be22e | ||
|
|
62b3ed17ba | ||
|
|
31bf50b2d4 | ||
|
|
0325c1ba65 | ||
|
|
f2a437bd3b | ||
|
|
7a7fb423b3 | ||
|
|
d533c1b1c8 | ||
|
|
2db013a5fa | ||
|
|
9fece3fdf1 | ||
|
|
b520a03c57 | ||
|
|
a4cafaad2e | ||
|
|
0d64bbed46 | ||
|
|
9718e70260 | ||
|
|
a67dd9fbdd | ||
|
|
aabed8279e | ||
|
|
06eb271bda | ||
|
|
12025e3050 | ||
|
|
ad6367018b | ||
|
|
c71b168402 | ||
|
|
4deb46290d | ||
|
|
e5ef45e4c0 | ||
|
|
e780637cf4 | ||
|
|
d659e55646 | ||
|
|
1c58b6d83e | ||
|
|
1305c02579 | ||
|
|
2c19ca0dbf | ||
|
|
3cfdc6d126 | ||
|
|
8ec73b2dd4 | ||
|
|
5f11854286 | ||
|
|
14f4e0e271 | ||
|
|
5c54ef7b0d | ||
|
|
73c2846d64 | ||
|
|
acd2038407 | ||
|
|
2442ae60db | ||
|
|
6c096191ba | ||
|
|
20f9dd9a6b | ||
|
|
44e94b8cfa | ||
|
|
8c21cf7761 | ||
|
|
d2851cf5c5 | ||
|
|
b0716253a2 | ||
|
|
eaf023b4d8 | ||
|
|
e47ad09130 | ||
|
|
689d0082d8 | ||
|
|
390a49072d | ||
|
|
7dc0b6f40b | ||
|
|
79d14521db | ||
|
|
8d6b0c8d76 | ||
|
|
1486774249 | ||
|
|
1fa9167f25 | ||
|
|
cc12225142 | ||
|
|
6b3a37c597 | ||
|
|
b187125b63 | ||
|
|
d232a0f951 | ||
|
|
84ea96f383 | ||
|
|
be33d3f2a4 | ||
|
|
0e991c596f | ||
|
|
858b6aa257 | ||
|
|
74135c0600 | ||
|
|
18dd6f58e3 | ||
|
|
ddcd2b0810 | ||
|
|
6d749789ce | ||
|
|
3224062b32 | ||
|
|
688ea28bed | ||
|
|
5e7c01c251 | ||
|
|
de2eea05b4 | ||
|
|
1de819e3de | ||
|
|
bc43409624 | ||
|
|
a57077aba3 | ||
|
|
8eaabacf44 | ||
|
|
adf5b036d6 | ||
|
|
3ab954644f | ||
|
|
64953e26fc | ||
|
|
2e1024d275 | ||
|
|
2253c57628 | ||
|
|
9c7d1dbb6f | ||
|
|
ef9f2ab31f | ||
|
|
64ca6c066c | ||
|
|
d1cf5ab286 | ||
|
|
b1545c5ce2 | ||
|
|
de8bae3f0f | ||
|
|
1fbf633817 | ||
|
|
f733dc5eae | ||
|
|
503bbd85b5 | ||
|
|
29ddb68da4 | ||
|
|
dd49399e45 | ||
|
|
3678f134d9 | ||
|
|
bbd784a2e8 | ||
|
|
77dbaf3aef | ||
|
|
9b9ee338c1 | ||
|
|
5ea7f52df2 | ||
|
|
414530c9c2 | ||
|
|
e632d39b1f | ||
|
|
09054a09fa | ||
|
|
01ec55366d | ||
|
|
e2388344b2 | ||
|
|
fd10844c2b | ||
|
|
35f2302352 | ||
|
|
e908b731ab | ||
|
|
b475325b5e | ||
|
|
7e769252e7 | ||
|
|
699d78bcfe | ||
|
|
7d345018af | ||
|
|
bac3b39227 | ||
|
|
c168e6f870 | ||
|
|
27b6fe682d | ||
|
|
a1b43b7a09 | ||
|
|
bfc78186f5 | ||
|
|
20130d89dc | ||
|
|
8490aac025 | ||
|
|
8fbffe250a | ||
|
|
60808a4820 | ||
|
|
d5cb16aa1f | ||
|
|
afd6ca314c | ||
|
|
441522f97b | ||
|
|
369229ea71 | ||
|
|
15a63805d9 | ||
|
|
7d8766980b | ||
|
|
5be3606236 | ||
|
|
ce4c145f1c | ||
|
|
b9372944f5 | ||
|
|
f58dff62c7 | ||
|
|
6d13b8bbc0 | ||
|
|
2139334c36 | ||
|
|
67bb12e569 | ||
|
|
2d43517914 | ||
|
|
df60c00d16 | ||
|
|
0fbddb0df1 | ||
|
|
4c5c1fc9ef | ||
|
|
4ffd2380c3 | ||
|
|
5849cd3a2e | ||
|
|
0a1960865e | ||
|
|
830ab99e6e | ||
|
|
2e4b7b3d19 | ||
|
|
8cb051d44d | ||
|
|
535445a555 | ||
|
|
f6afddd94b | ||
|
|
844b01cb6b | ||
|
|
0f2ee308de | ||
|
|
7d3f808e4c | ||
|
|
45465e0c45 | ||
|
|
4a9be7bf11 | ||
|
|
c8e0d18d18 | ||
|
|
ee9a4082b6 | ||
|
|
e6c70bf392 | ||
|
|
9edf9ad2ac | ||
|
|
f714d80c93 | ||
|
|
605c306bef | ||
|
|
5e2cda183a | ||
|
|
f284f00935 | ||
|
|
777e4fe49e | ||
|
|
8daf0223dc | ||
|
|
f77fb0b948 | ||
|
|
71992158bf | ||
|
|
fd8ab78372 | ||
|
|
1514ab8ec5 | ||
|
|
3591900070 | ||
|
|
44c6fa68cf | ||
|
|
7df4a966ea | ||
|
|
998ce1fe89 | ||
|
|
1279888567 | ||
|
|
d9d65577f4 | ||
|
|
f2f6055109 | ||
|
|
db0506c1df | ||
|
|
114f803a88 | ||
|
|
69778efb6b | ||
|
|
e7df20f69b | ||
|
|
1157d330a6 | ||
|
|
cd64a777c3 | ||
|
|
808bc42f2a | ||
|
|
3728fc7dba | ||
|
|
9920047b34 | ||
|
|
b758c0c335 | ||
|
|
32054b6f32 | ||
|
|
c6e5201e15 | ||
|
|
88eae68987 | ||
|
|
8b89bd7a1f | ||
|
|
fc68b9d7cd | ||
|
|
64b1b5ca38 | ||
|
|
8e77aca854 | ||
|
|
0627ae82fb | ||
|
|
0cd125b55c | ||
|
|
444cb894be | ||
|
|
8138b2080b | ||
|
|
d0c3cc6016 | ||
|
|
737b204b2c | ||
|
|
bd313b0b3d | ||
|
|
568de7e818 | ||
|
|
3106cffb65 | ||
|
|
21e9615243 | ||
|
|
9e27ba5109 | ||
|
|
7874cdf52a | ||
|
|
213e907044 | ||
|
|
c8d5131a42 | ||
|
|
fc21bb6eda | ||
|
|
3a9173858b | ||
|
|
dede320630 | ||
|
|
c25e2e611d | ||
|
|
54689f6087 | ||
|
|
370b47d23f | ||
|
|
53814983ff | ||
|
|
5953170f14 | ||
|
|
40897cd7da | ||
|
|
e2fe873049 | ||
|
|
9f3a16a4ae | ||
|
|
9da3d890e4 | ||
|
|
9684cbf850 | ||
|
|
295c8f48a6 | ||
|
|
7be8147b80 | ||
|
|
c22d94bba6 | ||
|
|
b0e94c15e6 | ||
|
|
874d3aca45 | ||
|
|
4a20febe96 | ||
|
|
28c7094f5b | ||
|
|
ff5e2746da | ||
|
|
dc8014562b | ||
|
|
b9394b9599 | ||
|
|
899dafb33f | ||
|
|
104cf87b89 | ||
|
|
290aae80e1 | ||
|
|
212eeaa77c | ||
|
|
eb28c710ba | ||
|
|
6fc1d7dc77 | ||
|
|
d9056081e7 | ||
|
|
95f87cdd56 | ||
|
|
746cc4c10b | ||
|
|
51c18e3f9a | ||
|
|
25b25e3e49 | ||
|
|
096f850433 | ||
|
|
ec469782c8 | ||
|
|
40e223c12d | ||
|
|
b2c78dbd57 | ||
|
|
89069fdaa4 | ||
|
|
1130e4782d | ||
|
|
0e9d159bc2 | ||
|
|
d69f408b14 | ||
|
|
e8d6c96c1e | ||
|
|
b34721b3f4 | ||
|
|
cb6be2a50d | ||
|
|
45852f0497 | ||
|
|
426f58aa61 | ||
|
|
bf75731bbe | ||
|
|
c8eec109b2 | ||
|
|
b8079953d8 | ||
|
|
993148552e | ||
|
|
1863be7be4 | ||
|
|
358145c4bd | ||
|
|
fb882f0b69 | ||
|
|
27cba56761 | ||
|
|
e2da73bf4f | ||
|
|
4402f73bf7 | ||
|
|
dc90cd6bc4 | ||
|
|
7356a0f6c8 | ||
|
|
f408bc4808 | ||
|
|
a302f37447 | ||
|
|
f501e30353 | ||
|
|
2587649ca2 | ||
|
|
d1faac58dd | ||
|
|
a9787b769f | ||
|
|
a42711e31c | ||
|
|
c632307eaa | ||
|
|
0f9de11a67 | ||
|
|
715823a666 | ||
|
|
6ce4b344e4 | ||
|
|
a6ca809a4e | ||
|
|
c1a13ae8bc | ||
|
|
6536ffe178 | ||
|
|
562946d055 | ||
|
|
924b8cbe24 | ||
|
|
5b1a532652 | ||
|
|
b6af3e51ab | ||
|
|
ebc8bd6ff5 | ||
|
|
ed70195c7e | ||
|
|
739e529416 | ||
|
|
384987cd5b | ||
|
|
af21dfd294 | ||
|
|
3e9153d955 | ||
|
|
0e421ea31d | ||
|
|
471f7f06f7 | ||
|
|
ddb37a47da | ||
|
|
5b24aac266 | ||
|
|
5cf59de676 | ||
|
|
e25d49b80b | ||
|
|
d5d9b9284a | ||
|
|
383b6aabf5 | ||
|
|
7a3f5afee7 | ||
|
|
5769fa6aed | ||
|
|
925fe65dd8 | ||
|
|
67b1f14a6f | ||
|
|
dd0cc5ed9f | ||
|
|
a23441109d | ||
|
|
ef4465efdb | ||
|
|
76ecf897ce | ||
|
|
f2211ff3ad | ||
|
|
2a1fd421bd | ||
|
|
920adb8296 | ||
|
|
34540babdb | ||
|
|
5d84e86d89 | ||
|
|
964c7e6f3b | ||
|
|
630b0515ad | ||
|
|
b06e798373 | ||
|
|
22d22f6aa8 | ||
|
|
e8ba3c2f4d | ||
|
|
ce857b0770 | ||
|
|
ce7c681462 | ||
|
|
41e562ebc2 | ||
|
|
ddf98661e4 | ||
|
|
cbd8a27a6d | ||
|
|
b60db79866 | ||
|
|
ddec870d25 | ||
|
|
77e358a001 | ||
|
|
5490f54d00 | ||
|
|
58447c147f | ||
|
|
e763345f25 | ||
|
|
7b86b2e05a | ||
|
|
a51bd03a5c | ||
|
|
54d7c29221 | ||
|
|
997e3e16dd | ||
|
|
c6eef16664 | ||
|
|
4f718e83b3 | ||
|
|
20ccda69f4 | ||
|
|
14741518a7 | ||
|
|
dd91779442 | ||
|
|
e58b73179f | ||
|
|
8e07e55c1f | ||
|
|
6a6593335d | ||
|
|
876b9d49b4 | ||
|
|
680ac41bb1 | ||
|
|
b133137a1f | ||
|
|
9dc91925e7 | ||
|
|
4f8d4f378c | ||
|
|
3e3eefc2dc | ||
|
|
77b6b0a9b2 | ||
|
|
551d2dfebd | ||
|
|
93f27666db | ||
|
|
66d5436789 | ||
|
|
70b83a3bbb | ||
|
|
eba5b0e4c5 | ||
|
|
66af0c1a53 | ||
|
|
70c6ca76cb | ||
|
|
d840643cb3 | ||
|
|
b771e97ac6 | ||
|
|
bdd8ef5a52 | ||
|
|
2ffc2a288c | ||
|
|
4ca46b7883 | ||
|
|
827a9d640c | ||
|
|
e2a506e54a | ||
|
|
048f08080d | ||
|
|
0a02e0db4b | ||
|
|
f3e5262dc0 | ||
|
|
99494afd08 | ||
|
|
d54346b205 | ||
|
|
54f683fc6b |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1,5 +1,6 @@
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.travis.yml export-ignore
|
||||
/build_tools/make_svn_completions.fish export-ignore
|
||||
/build_tools/description-pak export-ignore
|
||||
/build_tools/make_hg_completions.fish export-ignore
|
||||
|
||||
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,7 +1,9 @@
|
||||
*.o
|
||||
*~
|
||||
*.exe
|
||||
*.xccheckout
|
||||
|
||||
.DS_Store
|
||||
Makefile
|
||||
autom4te.cache/
|
||||
build/
|
||||
@@ -20,9 +22,8 @@ doc_src/index.hdr
|
||||
po/*.gmo
|
||||
fish
|
||||
fish_indent
|
||||
fish_pager
|
||||
fish_tests
|
||||
fishd
|
||||
fish.pc
|
||||
mimedb
|
||||
seq
|
||||
set_color
|
||||
@@ -35,3 +36,8 @@ tests/*tmp.*
|
||||
tests/foo.txt
|
||||
FISH-BUILD-VERSION-FILE
|
||||
version
|
||||
messages.pot
|
||||
lexicon.txt
|
||||
lexicon_filter
|
||||
lexicon.log
|
||||
|
||||
|
||||
27
.travis.yml
Normal file
27
.travis.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
language: cpp
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
before_install:
|
||||
- sudo apt-get update
|
||||
install:
|
||||
- sudo apt-get install --no-install-recommends bc doxygen expect gettext libncurses5-dev
|
||||
script:
|
||||
- autoreconf
|
||||
- ./configure
|
||||
- make -j2
|
||||
- sudo make install
|
||||
- make test SHOW_INTERACTIVE_LOG=1
|
||||
notifications:
|
||||
irc:
|
||||
channels:
|
||||
- "irc.oftc.net#fish"
|
||||
template:
|
||||
- "%{repository}#%{build_number} (%{commit} on %{branch} by %{author}): %{message} Details at %{build_url}"
|
||||
use_notice: true
|
||||
skip_join: true
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/61821cec3015bf0f8bb1
|
||||
matrix:
|
||||
fast_finish: true
|
||||
@@ -1,3 +0,0 @@
|
||||
24-01-2012 Jan Kanis
|
||||
* Added a changelog file
|
||||
* removed unescaping if the 'commandline' builtin is called without the -o (tokenise) flag
|
||||
19
COPYING
Normal file
19
COPYING
Normal file
@@ -0,0 +1,19 @@
|
||||
Fish is a smart and user-friendly command line shell.
|
||||
|
||||
Copyright (C) 2005-2009 Axel Liljencrantz
|
||||
|
||||
fish is free software.
|
||||
|
||||
Most of fish is licensed under the GNU General Public License version 2, and
|
||||
you can redistribute it and/or modify it under the terms of the GNU GPL as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
fish also includes software licensed under the GNU Lesser General Public
|
||||
License version 2, the OpenBSD license and the ISC license.
|
||||
|
||||
Full licensing information is contained in doc_src/license.hdr.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details.
|
||||
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM centos:latest
|
||||
|
||||
# Build dependency
|
||||
RUN yum update -y &&\
|
||||
yum install -y autoconf automake bc clang gcc-c++ make ncurses-devel &&\
|
||||
yum clean all
|
||||
|
||||
# Test dependency
|
||||
RUN yum install -y expect vim-common
|
||||
|
||||
ADD . /src
|
||||
WORKDIR /src
|
||||
|
||||
# Build fish
|
||||
RUN autoreconf &&\
|
||||
./configure &&\
|
||||
make &&\
|
||||
make install
|
||||
|
||||
2414
Doxyfile.help
2414
Doxyfile.help
File diff suppressed because it is too large
Load Diff
2356
Doxyfile.user
2356
Doxyfile.user
File diff suppressed because it is too large
Load Diff
462
Makefile.in
462
Makefile.in
@@ -32,6 +32,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
|
||||
CXX := @CXX@
|
||||
INSTALL:=@INSTALL@
|
||||
SED := @SED@
|
||||
|
||||
|
||||
#
|
||||
@@ -47,7 +48,6 @@ mandir = @mandir@
|
||||
sysconfdir = @sysconfdir@
|
||||
docdir = @docdir@
|
||||
localedir = @localedir@
|
||||
optbindirs = @optbindirs@
|
||||
|
||||
#
|
||||
# Various flags
|
||||
@@ -55,12 +55,10 @@ optbindirs = @optbindirs@
|
||||
|
||||
MACROS = -DLOCALEDIR=\"$(localedir)\" -DPREFIX=L\"$(prefix)\" -DDATADIR=L\"$(datadir)\" -DSYSCONFDIR=L\"$(sysconfdir)\" -DBINDIR=L\"$(bindir)\" -DDOCDIR=L\"$(docdir)\"
|
||||
CXXFLAGS = @CXXFLAGS@ $(MACROS) $(EXTRA_CXXFLAGS)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LDFLAGS_FISH = ${LDFLAGS} @LIBS_FISH@ @LDFLAGS_FISH@
|
||||
LDFLAGS_FISH_INDENT = ${LDFLAGS} @LIBS_FISH_INDENT@
|
||||
LDFLAGS_FISH_PAGER = ${LDFLAGS} @LIBS_FISH_PAGER@
|
||||
LDFLAGS_FISHD = ${LDFLAGS} @LIBS_FISHD@
|
||||
LDFLAGS_MIMEDB = ${LDFLAGS} @LIBS_MIMEDB@
|
||||
LIBS = @LIBS@
|
||||
LDFLAGS_FISH = ${LDFLAGS} @LDFLAGS_FISH@
|
||||
|
||||
#
|
||||
# Set to 1 if we have gettext
|
||||
@@ -89,13 +87,13 @@ COMMON_FILES := util.cpp fallback.cpp
|
||||
FISH_OBJS := function.o builtin.o complete.o env.o exec.o expand.o \
|
||||
highlight.o history.o kill.o parser.o proc.o reader.o sanity.o \
|
||||
tokenizer.o wildcard.o wgetopt.o wutil.o input.o output.o intern.o \
|
||||
env_universal.o env_universal_common.o input_common.o event.o \
|
||||
env_universal_common.o input_common.o event.o \
|
||||
signal.o io.o parse_util.o common.o screen.o path.o autoload.o \
|
||||
parser_keywords.o iothread.o color.o postfork.o \
|
||||
builtin_test.o
|
||||
builtin_test.o parse_tree.o parse_productions.o parse_execution.o \
|
||||
pager.o utf8.o fish_version.o wcstringutil.o
|
||||
|
||||
FISH_INDENT_OBJS := fish_indent.o print_help.o common.o \
|
||||
parser_keywords.o wutil.o tokenizer.o
|
||||
FISH_INDENT_OBJS := fish_indent.o print_help.o $(FISH_OBJS)
|
||||
|
||||
#
|
||||
# Additional files used by builtin.o
|
||||
@@ -106,15 +104,6 @@ BUILTIN_FILES := builtin_set.cpp builtin_commandline.cpp \
|
||||
builtin_set_color.cpp builtin_printf.cpp
|
||||
|
||||
|
||||
#
|
||||
# All objects that the system needs to build fish_pager
|
||||
#
|
||||
|
||||
FISH_PAGER_OBJS := fish_pager.o output.o wutil.o \
|
||||
input_common.o env_universal.o env_universal_common.o common.o \
|
||||
print_help.o iothread.o color.o
|
||||
|
||||
|
||||
#
|
||||
# All objects that the system needs to build fish_tests
|
||||
#
|
||||
@@ -122,21 +111,13 @@ FISH_PAGER_OBJS := fish_pager.o output.o wutil.o \
|
||||
FISH_TESTS_OBJS := $(FISH_OBJS) fish_tests.o
|
||||
|
||||
|
||||
#
|
||||
# All objects that the system needs to build fishd
|
||||
#
|
||||
|
||||
FISHD_OBJS := fishd.o env_universal_common.o wutil.o print_help.o \
|
||||
common.o
|
||||
|
||||
|
||||
#
|
||||
# All objects needed to build mimedb
|
||||
#
|
||||
|
||||
MIME_OBJS := mimedb.o print_help.o xdgmimealias.o xdgmime.o \
|
||||
xdgmimeglob.o xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o \
|
||||
common.o
|
||||
common.o fish_version.o
|
||||
|
||||
|
||||
#
|
||||
@@ -167,6 +148,11 @@ HDR_FILES := $(HDR_FILES_SRC:.hdr.in=.hdr)
|
||||
|
||||
HELP_SRC := $(wildcard doc_src/*.txt)
|
||||
|
||||
#
|
||||
# HTML includes needed for HTML help
|
||||
#
|
||||
|
||||
HTML_SRC := doc_src/user_doc.header.html doc_src/user_doc.footer.html doc_src/user_doc.css
|
||||
|
||||
#
|
||||
# Files in the test directory
|
||||
@@ -192,7 +178,7 @@ FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)
|
||||
# Programs to install
|
||||
#
|
||||
|
||||
PROGRAMS := fish mimedb fish_pager fishd fish_indent
|
||||
PROGRAMS := fish mimedb fish_indent
|
||||
|
||||
#
|
||||
# Manual pages to install
|
||||
@@ -207,7 +193,11 @@ MANUALS := $(addsuffix .1, $(addprefix share/man/man1/, \
|
||||
#
|
||||
|
||||
TRANSLATIONS_SRC := $(wildcard po/*.po)
|
||||
TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo)
|
||||
ifdef HAVE_GETTEXT
|
||||
TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo)
|
||||
else
|
||||
TRANSLATIONS :=
|
||||
endif
|
||||
|
||||
#
|
||||
# If Doxygen is not available, don't attempt to build the documentation
|
||||
@@ -225,7 +215,7 @@ endif
|
||||
# Make everything needed for installing fish
|
||||
#
|
||||
|
||||
all: $(PROGRAMS) $(user_doc) $(share_man) $(TRANSLATIONS)
|
||||
all: $(PROGRAMS) $(user_doc) $(share_man) $(TRANSLATIONS) fish.pc
|
||||
@echo fish has now been built.
|
||||
@echo Use \'$(MAKE) install\' to install fish.
|
||||
.PHONY: all
|
||||
@@ -239,7 +229,7 @@ FISH-BUILD-VERSION-FILE: FORCE
|
||||
-include FISH-BUILD-VERSION-FILE
|
||||
CPPFLAGS += -DFISH_BUILD_VERSION=\"$(FISH_BUILD_VERSION)\"
|
||||
.PHONY: FORCE
|
||||
env.o fish.o fish_indent.o fish_pager.o fishd.o mimedb.o: FISH-BUILD-VERSION-FILE
|
||||
fish_version.o: FISH-BUILD-VERSION-FILE
|
||||
|
||||
|
||||
#
|
||||
@@ -271,18 +261,19 @@ prof: all
|
||||
# Depend on the sources (*.hdr.in) and manually make the
|
||||
# intermediate *.hdr and doc.h files if needed
|
||||
# The sed command deletes everything including and after the first -, for simpler version numbers
|
||||
# Cleans up the user_doc/html directory once Doxygen is done.
|
||||
|
||||
user_doc: $(HDR_FILES_SRC) Doxyfile.user user_doc.head.html $(HELP_SRC) doc.h $(HDR_FILES)
|
||||
(cat Doxyfile.user ; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | sed "s/-.*//") | doxygen - && touch user_doc
|
||||
|
||||
|
||||
user_doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h $(HDR_FILES) lexicon_filter
|
||||
(cat Doxyfile.user; echo INPUT_FILTER=./lexicon_filter; \
|
||||
echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | $(SED) "s/-.*//") | doxygen - && touch user_doc; \
|
||||
cd user_doc/html && rm -f bc_s.png bdwn.png closed.png ftv2*.png nav*.png open.png sync_*.png tab*.* doxygen.* dynsections.js jquery.js pages.html
|
||||
|
||||
#
|
||||
# Source code documentation. Also includes user documentation.
|
||||
#
|
||||
|
||||
doc: *.h *.cpp doc.h Doxyfile
|
||||
(cat Doxyfile ; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION)) | doxygen - ;
|
||||
doc: *.h *.cpp doc.h Doxyfile lexicon_filter
|
||||
(cat Doxyfile; echo INPUT_FILTER=./lexicon_filter; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION)) | doxygen - ;
|
||||
|
||||
|
||||
#
|
||||
@@ -290,10 +281,9 @@ doc: *.h *.cpp doc.h Doxyfile
|
||||
#
|
||||
|
||||
doc/refman.pdf: doc
|
||||
cd doc/latex;
|
||||
make;
|
||||
cd doc/latex && \
|
||||
make && \
|
||||
mv refman.pdf ..;
|
||||
cd ../..;
|
||||
rm -r doc/latex;
|
||||
|
||||
|
||||
@@ -301,10 +291,36 @@ doc/refman.pdf: doc
|
||||
# This target runs both the low level code tests and the high level script tests.
|
||||
#
|
||||
|
||||
test: $(PROGRAMS) fish_tests
|
||||
./fish_tests; cd tests; ../fish <test.fish;
|
||||
test: test_low_level test_high_level
|
||||
.PHONY: test
|
||||
|
||||
# We want the various tests to run serially so their output doesn't mix
|
||||
# We can do that by adding ordering dependencies based on what goals are being used.
|
||||
|
||||
test_goals := test_low_level test_fishscript test_interactive
|
||||
|
||||
# The following variables define targets that depend on the tests. If any more targets
|
||||
# are added that depend, directly or indirectly, on tests, they need to be recorded here.
|
||||
test_test_deps = test_low_level $(test_high_level_test_deps)
|
||||
test_high_level_test_deps = test_fishscript test_interactive
|
||||
|
||||
active_test_goals = $(filter $(test_goals),$(foreach a,$(or $(MAKECMDGOALS),$(.DEFAULT_GOAL)),$(a) $($(a)_test_deps)))
|
||||
filter_up_to = $(eval b:=1)$(foreach a,$(2),$(and $(b),$(if $(subst $(1),,$(a)),$(a),$(eval b:=))))
|
||||
|
||||
test_low_level: fish_tests $(call filter_up_to,test_low_level,$(active_test_goals))
|
||||
./fish_tests
|
||||
.PHONY: test_low_level
|
||||
|
||||
test_high_level: test_fishscript test_interactive
|
||||
.PHONY: test_high_level
|
||||
|
||||
test_fishscript: $(PROGRAMS) $(call filter_up_to,test_fishscript,$(active_test_goals))
|
||||
cd tests && ../fish test.fish
|
||||
.PHONY: test_fishscript
|
||||
|
||||
test_interactive: $(PROGRAMS) $(call filter_up_to,test_interactive,$(active_test_goals))
|
||||
cd tests && ../fish interactive.fish
|
||||
.PHONY: test_interactive
|
||||
|
||||
#
|
||||
# commands.hdr collects documentation on all commands, functions and
|
||||
@@ -337,7 +353,7 @@ toc.txt: $(HDR_FILES:index.hdr=index.hdr.in)
|
||||
for i in $(HDR_FILES:index.hdr=index.hdr.in); do\
|
||||
NAME=`basename $$i .hdr`; \
|
||||
NAME=`basename $$NAME .hdr.in`; \
|
||||
sed <$$i >>toc.tmp -n \
|
||||
$(SED) <$$i >>toc.tmp -n \
|
||||
-e 's,.*\\page *\([^ ]*\) *\(.*\)$$,- <a href="'$$NAME'.html" id="toc-'$$NAME'">\2</a>,p' \
|
||||
-e 's,.*\\section *\([^ ]*\) *\([^-]*\)\(.*\)$$, - <a href="'$$NAME'.html#\1">\2</a>,p'; \
|
||||
done
|
||||
@@ -346,11 +362,66 @@ toc.txt: $(HDR_FILES:index.hdr=index.hdr.in)
|
||||
doc_src/index.hdr: toc.txt doc_src/index.hdr.in
|
||||
cat $@.in | awk '{if ($$0 ~ /@toc@/){ system("cat toc.txt");} else{ print $$0;}}' >$@
|
||||
|
||||
#
|
||||
# To enable the lexicon filter, we first need to be aware of what fish
|
||||
# considers to be a command, function, or external binary. We use
|
||||
# command_list_toc.txt for the base commands. Scan the share/functions
|
||||
# directory for other functions, some of which are mentioned in the docs, and
|
||||
# use /share/completions to find a good selection of binaries. Additionally,
|
||||
# colour defaults from __fish_config_interactive to set the docs colours when
|
||||
# used in a 'cli' style context.
|
||||
#
|
||||
|
||||
lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) share/functions/__fish_config_interactive.fish
|
||||
-rm lexicon.tmp lexicon_catalog.tmp lexicon_catalog.txt $@
|
||||
# Scan sources for commands/functions/binaries/colours. If GNU sed was portable, this could be much smarter.
|
||||
$(SED) <command_list_toc.txt >>lexicon.tmp -n \
|
||||
-e "s|^.*>\([a-z][a-z_]*\)</a>|'\1'|w lexicon_catalog.tmp" \
|
||||
-e "s|'\(.*\)'|bltn \1|p"; mv lexicon_catalog.tmp lexicon_catalog.txt; \
|
||||
printf "%s\n" $(COMPLETIONS_DIR_FILES) | $(SED) -n \
|
||||
-e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | fgrep -vx -f lexicon_catalog.txt | $(SED) >>lexicon.tmp -n \
|
||||
-e 'w lexicon_catalog.tmp' \
|
||||
-e "s|'\(.*\)'|cmnd \1|p"; cat lexicon_catalog.tmp >> lexicon_catalog.txt; \
|
||||
printf "%s\n" $(FUNCTIONS_DIR_FILES) | $(SED) -n \
|
||||
-e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | fgrep -vx -f lexicon_catalog.txt | $(SED) >>lexicon.tmp -n \
|
||||
-e 'w lexicon_catalog.tmp' \
|
||||
-e "s|'\(.*\)'|func \1|p"; \
|
||||
$(SED) <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \
|
||||
-e '/set_default/s/.*\(fish_[a-z][a-z_]*\).*$$/clrv \1/p'; \
|
||||
$(SED) <lexicon_filter.in >>lexicon.tmp -n \
|
||||
-e '/^#.!#/s/^#.!# \(.... [a-z][a-z_]*\)/\1/p'; \
|
||||
mv lexicon.tmp lexicon.txt; rm -f lexicon_catalog.tmp lexicon_catalog.txt;
|
||||
|
||||
#
|
||||
# Compile Doxygen Input Filter from the lexicon. This is an executable sed
|
||||
# script as Doxygen opens it via popen()(3) Input (doc.h) is piped through and
|
||||
# matching words inside /fish../endfish blocks are marked up, contextually,
|
||||
# with custom Doxygen commands in the form of @word_type{content}. These are
|
||||
# trapped by ALIASES in the various Doxyfiles, allowing the content to be
|
||||
# transformed depending on output type (HTML, man page, developer docs). In
|
||||
# HTML, a style context can be applied through the /fish{style} block and
|
||||
# providing suitable CSS in user_doc.css.in
|
||||
#
|
||||
|
||||
lexicon_filter: lexicon.txt lexicon_filter.in
|
||||
-rm $@.tmp $@
|
||||
# Set the shebang as sed can reside in multiple places.
|
||||
$(SED) <$@.in >$@.tmp -e 's|@sed@|'$(SED)'|'
|
||||
# Scan through the lexicon, transforming each line to something useful to Doxygen.
|
||||
if echo x | $(SED) "/[[:<:]]x/d" 2>/dev/null; then \
|
||||
WORDBL='[[:<:]]'; WORDBR='[[:>:]]'; \
|
||||
else \
|
||||
WORDBL='\\<'; WORDBR='\\>'; \
|
||||
fi; \
|
||||
$(SED) <lexicon.txt >>$@.tmp -n \
|
||||
-e "s|^\([a-z][a-z][a-z][a-z]\) \([a-z_-]*\)$$|s,$$WORDBL\2$$WORDBR,@\1{\2},g|p" \
|
||||
-e '$$G;s/.*\n/b tidy/p'; \
|
||||
mv $@.tmp $@; if test -x $@; then true; else chmod a+x $@; fi
|
||||
|
||||
#
|
||||
# doc.h is a compilation of the various snipptes of text used both for
|
||||
# the user documentation and for internal help functions into a single
|
||||
# file that can be parsed dy Doxygen to generate the user
|
||||
# file that can be parsed by Doxygen to generate the user
|
||||
# documentation.
|
||||
#
|
||||
|
||||
@@ -369,15 +440,16 @@ doc.h: $(HDR_FILES)
|
||||
cat $*.txt >>$@;
|
||||
echo "*/" >>$@
|
||||
|
||||
%: %.in
|
||||
sed <$@.in >$@ \
|
||||
# Depend on Makefile because I don't see a better way of rebuilding
|
||||
# if any of the paths change.
|
||||
%: %.in Makefile FISH-BUILD-VERSION-FILE
|
||||
$(SED) <$< >$@ \
|
||||
-e "s,@sysconfdir\@,$(sysconfdir),g" \
|
||||
-e "s,@datadir\@,$(datadir),g" \
|
||||
-e "s,@docdir\@,$(docdir),g" \
|
||||
-e "s|@configure_input\@|$@, generated from $@.in by the Makefile. DO NOT MANUALLY EDIT THIS FILE!|g" \
|
||||
-e "s,@prefix\@,$(prefix),g" \
|
||||
-e "s,@optbindirs\@,$(optbindirs),g"
|
||||
#-e "s,@\@,$(),"
|
||||
-e "s,@fish_build_version\@,$(FISH_BUILD_VERSION),g" \
|
||||
|
||||
|
||||
#
|
||||
@@ -385,38 +457,26 @@ doc.h: $(HDR_FILES)
|
||||
#
|
||||
|
||||
%.gmo:
|
||||
if test "$(HAVE_GETTEXT)" = 1; then \
|
||||
msgfmt -o $*.gmo $*.po; \
|
||||
fi
|
||||
|
||||
msgfmt -o $@ $*.po
|
||||
|
||||
#
|
||||
# Update existing po file or copy messages.pot
|
||||
#
|
||||
|
||||
%.po:messages.pot
|
||||
if test "$(HAVE_GETTEXT)" = 1;then \
|
||||
if test -f $*.po; then \
|
||||
msgmerge -U --backup=existing $*.po messages.pot;\
|
||||
else \
|
||||
cp messages.pot $*.po;\
|
||||
fi; \
|
||||
if test -f $*.po; then \
|
||||
msgmerge -U --backup=existing $*.po messages.pot;\
|
||||
else \
|
||||
cp messages.pot $*.po;\
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Create a template translation object
|
||||
#
|
||||
|
||||
messages.pot: *.cpp *.h share/completions/*.fish share/functions/*.fish
|
||||
if test "$(HAVE_GETTEXT)" = 1; then \
|
||||
xgettext -k_ -kN_ *.cpp *.h -o messages.pot; \
|
||||
if xgettext -j -k_ -kN_ -k--description -LShell share/completions/*.fish share/functions/*.fish -o messages.pot; then true; else \
|
||||
echo "Your xgettext version is too old to build the messages.pot file"\
|
||||
rm messages.pot\
|
||||
false;\
|
||||
fi; \
|
||||
fi
|
||||
xgettext -k_ -kN_ *.cpp *.h -o messages.pot
|
||||
xgettext -j -k_ -kN_ -k--description -LShell --from-code=UTF-8 share/completions/*.fish share/functions/*.fish -o messages.pot
|
||||
|
||||
builtin.o: $(BUILTIN_FILES)
|
||||
|
||||
@@ -450,11 +510,12 @@ common.o: $(COMMON_FILES)
|
||||
# There ought to be something simpler.
|
||||
#
|
||||
|
||||
share/man: $(HELP_SRC)
|
||||
share/man: $(HELP_SRC) lexicon_filter
|
||||
-mkdir share/man
|
||||
touch share/man
|
||||
-rm -Rf share/man/man1
|
||||
PROJECT_NUMBER=`echo $(FISH_BUILD_VERSION)| sed "s/-.*//"` ./build_tools/build_documentation.sh Doxyfile.help ./doc_src ./share
|
||||
PROJECT_NUMBER=`echo $(FISH_BUILD_VERSION)| $(SED) "s/-.*//"` INPUT_FILTER=./lexicon_filter \
|
||||
./build_tools/build_documentation.sh Doxyfile.help ./doc_src ./share
|
||||
|
||||
#
|
||||
# The build rules for installing/uninstalling fish
|
||||
@@ -548,6 +609,7 @@ install-force: all install-translations
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/completions
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/vendor_completions.d
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/functions
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/man/man1
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools
|
||||
@@ -557,6 +619,8 @@ install-force: all install-translations
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/sample_prompts
|
||||
$(INSTALL) -m 644 etc/config.fish $(DESTDIR)$(sysconfdir)/fish/
|
||||
$(INSTALL) -m 644 share/config.fish $(DESTDIR)$(datadir)/fish/
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/pkgconfig
|
||||
$(INSTALL) -m 644 fish.pc $(DESTDIR)$(datadir)/pkgconfig
|
||||
for i in $(COMPLETIONS_DIR_FILES:%='%'); do \
|
||||
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/completions/; \
|
||||
true; \
|
||||
@@ -608,12 +672,17 @@ install-force: all install-translations
|
||||
@echo fish is now installed on your system.
|
||||
@echo To run fish, type \'fish\' in your terminal.
|
||||
@echo
|
||||
@if type chsh &> /dev/null; then \
|
||||
@if type chsh >/dev/null 2>&1; then \
|
||||
echo To use fish as your login shell:; \
|
||||
grep -q -- "$(DESTDIR)$(bindir)/fish" /etc/shells || echo \* add the line \'$(DESTDIR)$(bindir)/fish\' to the file \'/etc/shells\'.; \
|
||||
echo \* use the command \'chsh -s $(DESTDIR)$(bindir)/fish\'.; \
|
||||
echo; \
|
||||
fi;
|
||||
@if type chcon >/dev/null 2>&1; then \
|
||||
echo If you have SELinux enabled, you may need to manually update the security policy:; \
|
||||
echo \* use the command \'chcon -t shell_exec_t $(DESTDIR)$(bindir)/fish\'.; \
|
||||
echo; \
|
||||
fi;
|
||||
@echo To set your colors, run \'fish_config\'
|
||||
@echo To scan your man pages for completions, run \'fish_update_completions\'
|
||||
@echo To autocomplete command suggestions press Ctrl + F or right arrow key.
|
||||
@@ -637,6 +706,9 @@ uninstall: uninstall-translations
|
||||
-if test -d $(DESTDIR)$(docdir); then \
|
||||
rm -rf $(DESTDIR)$(docdir);\
|
||||
fi
|
||||
-if test -f $(DESTDIR)$(datadir)/pkgconfig/fish.pc; then \
|
||||
rm -f $(DESTDIR)$(datadir)/pkgconfig/fish.pc;\
|
||||
fi
|
||||
-for i in $(MANUALS); do \
|
||||
rm -rf $(DESTDIR)$(mandir)/man1/`basename $$i`*; \
|
||||
done;
|
||||
@@ -670,21 +742,17 @@ uninstall-legacy: uninstall
|
||||
.PHONY: uninstall-legacy
|
||||
|
||||
install-translations: $(TRANSLATIONS)
|
||||
if test "$(HAVE_GETTEXT)" = 1; then \
|
||||
for i in $(TRANSLATIONS); do \
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/locale/`basename $$i .gmo`/LC_MESSAGES; \
|
||||
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/locale/`basename $$i .gmo`/LC_MESSAGES/fish.mo; \
|
||||
echo $(DESTDIR)$(datadir)/locale/`basename $$i .gmo`/LC_MESSAGES/fish.mo;\
|
||||
done; \
|
||||
fi;
|
||||
ifdef HAVE_GETTEXT
|
||||
for i in $(TRANSLATIONS); do \
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES; \
|
||||
$(INSTALL) -m 644 $$i $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES/fish.mo; \
|
||||
echo $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES/fish.mo;\
|
||||
done
|
||||
endif
|
||||
.PHONY: install-translations
|
||||
|
||||
uninstall-translations:
|
||||
if test "$(HAVE_GETTEXT)" = 1; then \
|
||||
for i in $(TRANSLATIONS_SRC); do \
|
||||
rm -f $(DESTDIR)$(datadir)/locale/*/LC_MESSAGES/fish.mo; \
|
||||
done; \
|
||||
fi
|
||||
rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/fish.mo
|
||||
.PHONY: uninstall-translations
|
||||
|
||||
|
||||
@@ -697,23 +765,7 @@ uninstall-translations:
|
||||
#
|
||||
|
||||
fish: $(FISH_OBJS) fish.o
|
||||
$(CXX) $(CXXFLAGS) $(FISH_OBJS) fish.o $(LDFLAGS_FISH) -o $@
|
||||
|
||||
|
||||
#
|
||||
# Build the fish_pager program.
|
||||
#
|
||||
|
||||
fish_pager: $(FISH_PAGER_OBJS)
|
||||
$(CXX) $(CXXFLAGS) $(FISH_PAGER_OBJS) $(LDFLAGS_FISH_PAGER) -o $@
|
||||
|
||||
|
||||
#
|
||||
# Build the fishd program.
|
||||
#
|
||||
|
||||
fishd: $(FISHD_OBJS)
|
||||
$(CXX) $(CXXFLAGS) $(FISHD_OBJS) $(LDFLAGS_FISHD) -o $@
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_OBJS) fish.o $(LIBS) -o $@
|
||||
|
||||
|
||||
#
|
||||
@@ -721,7 +773,7 @@ fishd: $(FISHD_OBJS)
|
||||
#
|
||||
|
||||
fish_tests: $(FISH_TESTS_OBJS)
|
||||
$(CXX) $(CXXFLAGS) $(FISH_TESTS_OBJS) $(LDFLAGS_FISH) -o $@
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_TESTS_OBJS) $(LIBS) -o $@
|
||||
|
||||
|
||||
#
|
||||
@@ -729,7 +781,7 @@ fish_tests: $(FISH_TESTS_OBJS)
|
||||
#
|
||||
|
||||
mimedb: $(MIME_OBJS)
|
||||
$(CXX) $(CXXFLAGS) $(MIME_OBJS) $(LDFLAGS_MIMEDB) -o $@
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(MIME_OBJS) $(LIBS) -o $@
|
||||
|
||||
|
||||
#
|
||||
@@ -737,15 +789,15 @@ mimedb: $(MIME_OBJS)
|
||||
#
|
||||
|
||||
fish_indent: $(FISH_INDENT_OBJS)
|
||||
$(CXX) $(CXXFLAGS) $(FISH_INDENT_OBJS) $(LDFLAGS_FISH_INDENT) -o $@
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(FISH_INDENT_OBJS) $(LIBS) -o $@
|
||||
|
||||
|
||||
#
|
||||
# Neat little program to show output from terminal
|
||||
#
|
||||
|
||||
key_reader: key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o iothread.o
|
||||
$(CXX) $(CXXFLAGS) key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o iothread.o $(LDFLAGS_FISH) -o $@
|
||||
key_reader: $(FISH_OBJS) key_reader.o
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $^ $(LIBS) -o $@
|
||||
|
||||
|
||||
#
|
||||
@@ -784,142 +836,182 @@ clean:
|
||||
rm -f $(PROGRAMS) fish_tests key_reader
|
||||
rm -f command_list.txt command_list_toc.txt toc.txt
|
||||
rm -f doc_src/index.hdr doc_src/commands.hdr
|
||||
rm -f lexicon_filter lexicon.txt lexicon.log
|
||||
rm -f FISH-BUILD-VERSION-FILE
|
||||
if test "$(HAVE_DOXYGEN)" = 1; then \
|
||||
rm -rf doc user_doc share/man; \
|
||||
fi
|
||||
rm -f $(TRANSLATIONS)
|
||||
rm -f po/*.gmo
|
||||
.PHONY: clean
|
||||
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
autoload.o: config.h autoload.h common.h util.h lru.h wutil.h signal.h env.h
|
||||
autoload.o: exec.h proc.h io.h
|
||||
autoload.o: exec.h proc.h io.h parse_tree.h tokenizer.h parse_constants.h
|
||||
builtin.o: config.h signal.h fallback.h util.h wutil.h common.h builtin.h
|
||||
builtin.o: io.h function.h event.h complete.h proc.h parser.h reader.h env.h
|
||||
builtin.o: wgetopt.h sanity.h tokenizer.h wildcard.h expand.h input_common.h
|
||||
builtin.o: input.h intern.h exec.h highlight.h screen.h color.h parse_util.h
|
||||
builtin.o: autoload.h lru.h parser_keywords.h path.h history.h
|
||||
builtin.o: builtin_set.cpp builtin_commandline.cpp builtin_complete.cpp
|
||||
builtin.o: builtin_ulimit.cpp builtin_jobs.cpp builtin_printf.cpp
|
||||
builtin.o: io.h function.h event.h env.h complete.h proc.h parse_tree.h
|
||||
builtin.o: tokenizer.h parse_constants.h parser.h reader.h highlight.h
|
||||
builtin.o: color.h wgetopt.h sanity.h wildcard.h expand.h input_common.h
|
||||
builtin.o: input.h intern.h exec.h parse_util.h autoload.h lru.h
|
||||
builtin.o: parser_keywords.h path.h history.h wcstringutil.h builtin_set.cpp
|
||||
builtin.o: builtin_commandline.cpp builtin_complete.cpp builtin_ulimit.cpp
|
||||
builtin.o: builtin_jobs.cpp builtin_set_color.cpp output.h screen.h
|
||||
builtin.o: builtin_printf.cpp
|
||||
builtin_commandline.o: config.h signal.h fallback.h util.h wutil.h common.h
|
||||
builtin_commandline.o: builtin.h io.h wgetopt.h reader.h complete.h proc.h
|
||||
builtin_commandline.o: parser.h event.h function.h tokenizer.h input_common.h
|
||||
builtin_commandline.o: input.h parse_util.h autoload.h lru.h
|
||||
builtin_commandline.o: builtin.h io.h wgetopt.h reader.h complete.h
|
||||
builtin_commandline.o: highlight.h env.h color.h proc.h parse_tree.h
|
||||
builtin_commandline.o: tokenizer.h parse_constants.h parser.h event.h
|
||||
builtin_commandline.o: function.h input_common.h input.h parse_util.h
|
||||
builtin_commandline.o: autoload.h lru.h
|
||||
builtin_complete.o: config.h signal.h fallback.h util.h wutil.h common.h
|
||||
builtin_complete.o: builtin.h io.h complete.h wgetopt.h parser.h proc.h
|
||||
builtin_complete.o: event.h function.h reader.h
|
||||
builtin_complete.o: parse_tree.h tokenizer.h parse_constants.h event.h
|
||||
builtin_complete.o: function.h env.h reader.h highlight.h color.h
|
||||
builtin_jobs.o: config.h fallback.h signal.h util.h wutil.h common.h
|
||||
builtin_jobs.o: builtin.h io.h proc.h parser.h event.h function.h wgetopt.h
|
||||
builtin_jobs.o: builtin.h io.h proc.h parse_tree.h tokenizer.h
|
||||
builtin_jobs.o: parse_constants.h parser.h event.h function.h env.h wgetopt.h
|
||||
builtin_printf.o: common.h util.h
|
||||
builtin_set.o: config.h signal.h fallback.h util.h wutil.h common.h builtin.h
|
||||
builtin_set.o: io.h env.h expand.h wgetopt.h proc.h parser.h event.h
|
||||
builtin_set.o: function.h
|
||||
builtin_set.o: io.h env.h expand.h parse_constants.h wgetopt.h proc.h
|
||||
builtin_set.o: parse_tree.h tokenizer.h parser.h event.h function.h
|
||||
builtin_set_color.o: config.h builtin.h util.h io.h common.h color.h output.h
|
||||
builtin_set_color.o: screen.h highlight.h env.h
|
||||
builtin_test.o: config.h common.h util.h builtin.h io.h wutil.h proc.h
|
||||
builtin_test.o: signal.h
|
||||
builtin_test.o: signal.h parse_tree.h tokenizer.h parse_constants.h
|
||||
builtin_ulimit.o: config.h fallback.h signal.h util.h builtin.h io.h common.h
|
||||
builtin_ulimit.o: wgetopt.h
|
||||
builtin_printf.o: wgetopt.h
|
||||
color.o: color.h config.h common.h util.h fallback.h signal.h
|
||||
common.o: config.h fallback.h signal.h util.h wutil.h common.h expand.h
|
||||
common.o: proc.h io.h wildcard.h parser.h event.h function.h complete.h
|
||||
common.o: util.cpp fallback.cpp
|
||||
common.o: parse_constants.h proc.h io.h parse_tree.h tokenizer.h wildcard.h
|
||||
common.o: complete.h parser.h event.h function.h env.h util.cpp fallback.cpp
|
||||
complete.o: config.h signal.h fallback.h util.h tokenizer.h common.h
|
||||
complete.o: wildcard.h expand.h proc.h io.h parser.h event.h function.h
|
||||
complete.o: complete.h builtin.h env.h exec.h reader.h history.h wutil.h
|
||||
complete.o: intern.h parse_util.h autoload.h lru.h parser_keywords.h path.h
|
||||
env.o: config.h signal.h fallback.h util.h wutil.h common.h proc.h io.h env.h
|
||||
env.o: sanity.h expand.h history.h reader.h complete.h parser.h event.h
|
||||
env.o: function.h env_universal.h env_universal_common.h input.h
|
||||
env.o: input_common.h path.h
|
||||
env_universal.o: config.h signal.h fallback.h util.h common.h wutil.h
|
||||
env_universal.o: env_universal_common.h env_universal.h
|
||||
env_universal_common.o: config.h signal.h fallback.h util.h common.h wutil.h
|
||||
env_universal_common.o: env_universal_common.h
|
||||
complete.o: wildcard.h expand.h parse_constants.h complete.h proc.h io.h
|
||||
complete.o: parse_tree.h parser.h event.h function.h env.h builtin.h exec.h
|
||||
complete.o: reader.h highlight.h color.h history.h wutil.h intern.h
|
||||
complete.o: parse_util.h autoload.h lru.h parser_keywords.h path.h iothread.h
|
||||
env.o: config.h signal.h fallback.h util.h wutil.h common.h proc.h io.h
|
||||
env.o: parse_tree.h tokenizer.h parse_constants.h env.h sanity.h expand.h
|
||||
env.o: history.h reader.h complete.h highlight.h color.h parser.h event.h
|
||||
env.o: function.h env_universal_common.h input.h input_common.h path.h
|
||||
env.o: fish_version.h
|
||||
env_universal_common.o: config.h env_universal_common.h wutil.h common.h
|
||||
env_universal_common.o: util.h env.h fallback.h signal.h utf8.h path.h
|
||||
env_universal_common.o: iothread.h
|
||||
event.o: config.h signal.h fallback.h util.h wutil.h common.h function.h
|
||||
event.o: event.h proc.h io.h parser.h
|
||||
event.o: event.h env.h input_common.h proc.h io.h parse_tree.h tokenizer.h
|
||||
event.o: parse_constants.h parser.h
|
||||
exec.o: config.h signal.h fallback.h util.h iothread.h postfork.h common.h
|
||||
exec.o: proc.h io.h wutil.h exec.h parser.h event.h function.h builtin.h
|
||||
exec.o: env.h wildcard.h expand.h sanity.h parse_util.h autoload.h lru.h
|
||||
exec.o: proc.h io.h parse_tree.h tokenizer.h parse_constants.h wutil.h exec.h
|
||||
exec.o: parser.h event.h function.h env.h builtin.h wildcard.h expand.h
|
||||
exec.o: complete.h sanity.h parse_util.h autoload.h lru.h
|
||||
expand.o: config.h signal.h fallback.h util.h common.h wutil.h env.h proc.h
|
||||
expand.o: io.h parser.h event.h function.h expand.h wildcard.h exec.h
|
||||
expand.o: tokenizer.h complete.h parse_util.h autoload.h lru.h
|
||||
expand.o: io.h parse_tree.h tokenizer.h parse_constants.h parser.h event.h
|
||||
expand.o: function.h expand.h wildcard.h complete.h exec.h iothread.h
|
||||
expand.o: parse_util.h autoload.h lru.h
|
||||
fallback.o: config.h fallback.h signal.h util.h
|
||||
fish.o: config.h signal.h fallback.h util.h common.h reader.h io.h complete.h
|
||||
fish.o: builtin.h function.h event.h wutil.h env.h sanity.h proc.h parser.h
|
||||
fish.o: expand.h intern.h exec.h output.h screen.h color.h history.h path.h
|
||||
fish.o: highlight.h env.h color.h builtin.h function.h event.h wutil.h
|
||||
fish.o: sanity.h proc.h parse_tree.h tokenizer.h parse_constants.h parser.h
|
||||
fish.o: expand.h intern.h exec.h output.h screen.h history.h path.h input.h
|
||||
fish.o: input_common.h fish_version.h
|
||||
fish_indent.o: config.h fallback.h signal.h util.h common.h wutil.h
|
||||
fish_indent.o: tokenizer.h print_help.h parser_keywords.h
|
||||
fish_pager.o: config.h signal.h fallback.h util.h wutil.h common.h complete.h
|
||||
fish_pager.o: output.h screen.h color.h input_common.h env_universal.h
|
||||
fish_pager.o: env_universal_common.h print_help.h
|
||||
fish_indent.o: tokenizer.h print_help.h parser_keywords.h fish_version.h
|
||||
fish_tests.o: config.h signal.h fallback.h util.h common.h proc.h io.h
|
||||
fish_tests.o: reader.h complete.h builtin.h function.h event.h autoload.h
|
||||
fish_tests.o: lru.h wutil.h env.h expand.h parser.h tokenizer.h output.h
|
||||
fish_tests.o: screen.h color.h exec.h path.h history.h highlight.h iothread.h
|
||||
fish_tests.o: postfork.h
|
||||
fishd.o: config.h signal.h fallback.h util.h common.h wutil.h
|
||||
fishd.o: env_universal_common.h path.h env.h print_help.h
|
||||
fish_tests.o: parse_tree.h tokenizer.h parse_constants.h reader.h complete.h
|
||||
fish_tests.o: highlight.h env.h color.h builtin.h function.h event.h
|
||||
fish_tests.o: autoload.h lru.h wutil.h expand.h parser.h output.h screen.h
|
||||
fish_tests.o: exec.h path.h history.h iothread.h postfork.h parse_util.h
|
||||
fish_tests.o: pager.h input.h input_common.h utf8.h env_universal_common.h
|
||||
fish_tests.o: wcstringutil.h
|
||||
fish_version.o: fish_version.h
|
||||
function.o: config.h signal.h wutil.h common.h util.h fallback.h function.h
|
||||
function.o: event.h proc.h io.h parser.h intern.h reader.h complete.h
|
||||
function.o: parse_util.h autoload.h lru.h parser_keywords.h env.h expand.h
|
||||
function.o: event.h env.h proc.h io.h parse_tree.h tokenizer.h
|
||||
function.o: parse_constants.h parser.h intern.h reader.h complete.h
|
||||
function.o: highlight.h color.h parse_util.h autoload.h lru.h
|
||||
function.o: parser_keywords.h expand.h
|
||||
highlight.o: config.h signal.h fallback.h util.h wutil.h common.h highlight.h
|
||||
highlight.o: env.h screen.h color.h tokenizer.h proc.h io.h parser.h event.h
|
||||
highlight.o: function.h parse_util.h autoload.h lru.h parser_keywords.h
|
||||
highlight.o: builtin.h expand.h sanity.h complete.h output.h wildcard.h
|
||||
highlight.o: path.h history.h
|
||||
highlight.o: env.h color.h tokenizer.h proc.h io.h parse_tree.h
|
||||
highlight.o: parse_constants.h parser.h event.h function.h parse_util.h
|
||||
highlight.o: autoload.h lru.h parser_keywords.h builtin.h expand.h sanity.h
|
||||
highlight.o: complete.h output.h screen.h wildcard.h path.h history.h
|
||||
history.o: config.h fallback.h signal.h util.h sanity.h tokenizer.h common.h
|
||||
history.o: wutil.h history.h intern.h path.h env.h autoload.h lru.h
|
||||
history.o: iothread.h
|
||||
history.o: reader.h io.h complete.h highlight.h env.h color.h parse_tree.h
|
||||
history.o: parse_constants.h wutil.h history.h intern.h path.h autoload.h
|
||||
history.o: lru.h iothread.h
|
||||
input.o: config.h signal.h fallback.h util.h wutil.h common.h reader.h io.h
|
||||
input.o: complete.h proc.h sanity.h input_common.h input.h parser.h event.h
|
||||
input.o: function.h env.h expand.h output.h screen.h color.h intern.h
|
||||
input.o: complete.h highlight.h env.h color.h proc.h parse_tree.h tokenizer.h
|
||||
input.o: parse_constants.h sanity.h input_common.h input.h parser.h event.h
|
||||
input.o: function.h expand.h output.h screen.h intern.h
|
||||
input_common.o: config.h fallback.h signal.h util.h common.h wutil.h
|
||||
input_common.o: input_common.h env_universal.h env_universal_common.h
|
||||
input_common.o: iothread.h
|
||||
input_common.o: input_common.h env_universal_common.h env.h iothread.h
|
||||
intern.o: config.h fallback.h signal.h util.h wutil.h common.h intern.h
|
||||
io.o: config.h fallback.h signal.h util.h wutil.h common.h exec.h proc.h io.h
|
||||
io.o: parse_tree.h tokenizer.h parse_constants.h
|
||||
iothread.o: config.h iothread.h common.h util.h signal.h
|
||||
key_reader.o: config.h common.h util.h fallback.h signal.h input_common.h
|
||||
kill.o: config.h signal.h fallback.h util.h wutil.h common.h kill.h proc.h
|
||||
kill.o: io.h sanity.h env.h exec.h path.h
|
||||
kill.o: io.h parse_tree.h tokenizer.h parse_constants.h sanity.h env.h exec.h
|
||||
kill.o: path.h
|
||||
mimedb.o: config.h xdgmime.h fallback.h signal.h util.h print_help.h
|
||||
mimedb.o: fish_version.h
|
||||
output.o: config.h signal.h fallback.h util.h wutil.h common.h expand.h
|
||||
output.o: output.h screen.h color.h highlight.h env.h
|
||||
output.o: parse_constants.h output.h screen.h highlight.h env.h color.h
|
||||
pager.o: config.h pager.h complete.h util.h common.h screen.h highlight.h
|
||||
pager.o: env.h color.h reader.h io.h input_common.h wutil.h
|
||||
parse_execution.o: parse_execution.h config.h util.h parse_tree.h common.h
|
||||
parse_execution.o: tokenizer.h parse_constants.h proc.h signal.h io.h
|
||||
parse_execution.o: parse_util.h autoload.h lru.h complete.h wildcard.h
|
||||
parse_execution.o: expand.h builtin.h parser.h event.h function.h env.h
|
||||
parse_execution.o: reader.h highlight.h color.h wutil.h exec.h path.h
|
||||
parse_productions.o: parse_productions.h parse_tree.h config.h util.h
|
||||
parse_productions.o: common.h tokenizer.h parse_constants.h
|
||||
parse_tree.o: parse_productions.h parse_tree.h config.h util.h common.h
|
||||
parse_tree.o: tokenizer.h parse_constants.h fallback.h signal.h wutil.h
|
||||
parse_tree.o: proc.h io.h
|
||||
parse_util.o: config.h fallback.h signal.h util.h wutil.h common.h
|
||||
parse_util.o: tokenizer.h parse_util.h autoload.h lru.h expand.h intern.h
|
||||
parse_util.o: exec.h proc.h io.h env.h wildcard.h
|
||||
parse_util.o: tokenizer.h parse_util.h autoload.h lru.h parse_tree.h
|
||||
parse_util.o: parse_constants.h expand.h intern.h exec.h proc.h io.h env.h
|
||||
parse_util.o: wildcard.h complete.h parser.h event.h function.h builtin.h
|
||||
parser.o: config.h signal.h fallback.h util.h common.h wutil.h proc.h io.h
|
||||
parser.o: parser.h event.h function.h parser_keywords.h tokenizer.h exec.h
|
||||
parser.o: wildcard.h expand.h builtin.h env.h reader.h complete.h sanity.h
|
||||
parser.o: env_universal.h env_universal_common.h intern.h parse_util.h
|
||||
parser.o: autoload.h lru.h path.h
|
||||
parser.o: parse_tree.h tokenizer.h parse_constants.h parser.h event.h
|
||||
parser.o: function.h env.h parser_keywords.h exec.h wildcard.h expand.h
|
||||
parser.o: complete.h builtin.h reader.h highlight.h color.h sanity.h intern.h
|
||||
parser.o: parse_util.h autoload.h lru.h path.h parse_execution.h
|
||||
parser_keywords.o: config.h fallback.h signal.h common.h util.h
|
||||
parser_keywords.o: parser_keywords.h
|
||||
path.o: config.h fallback.h signal.h util.h common.h env.h wutil.h path.h
|
||||
path.o: expand.h
|
||||
postfork.o: signal.h postfork.h config.h common.h util.h proc.h io.h wutil.h
|
||||
postfork.o: iothread.h exec.h
|
||||
path.o: expand.h parse_constants.h
|
||||
postfork.o: signal.h postfork.h config.h common.h util.h proc.h io.h
|
||||
postfork.o: parse_tree.h tokenizer.h parse_constants.h wutil.h iothread.h
|
||||
postfork.o: exec.h
|
||||
print_help.o: print_help.h
|
||||
proc.o: config.h signal.h fallback.h util.h wutil.h common.h proc.h io.h
|
||||
proc.o: reader.h complete.h sanity.h env.h parser.h event.h function.h
|
||||
proc.o: output.h screen.h color.h
|
||||
proc.o: parse_tree.h tokenizer.h parse_constants.h reader.h complete.h
|
||||
proc.o: highlight.h env.h color.h sanity.h parser.h event.h function.h
|
||||
proc.o: output.h screen.h
|
||||
reader.o: config.h signal.h fallback.h util.h wutil.h common.h highlight.h
|
||||
reader.o: env.h screen.h color.h reader.h io.h complete.h proc.h parser.h
|
||||
reader.o: event.h function.h history.h sanity.h exec.h expand.h tokenizer.h
|
||||
reader.o: kill.h input_common.h input.h output.h iothread.h intern.h path.h
|
||||
reader.o: parse_util.h autoload.h lru.h
|
||||
reader.o: env.h color.h reader.h io.h complete.h proc.h parse_tree.h
|
||||
reader.o: tokenizer.h parse_constants.h parser.h event.h function.h history.h
|
||||
reader.o: sanity.h exec.h expand.h kill.h input_common.h input.h output.h
|
||||
reader.o: screen.h iothread.h intern.h path.h parse_util.h autoload.h lru.h
|
||||
reader.o: parser_keywords.h pager.h
|
||||
sanity.o: config.h signal.h fallback.h util.h common.h sanity.h proc.h io.h
|
||||
sanity.o: history.h wutil.h reader.h complete.h kill.h
|
||||
sanity.o: parse_tree.h tokenizer.h parse_constants.h history.h wutil.h
|
||||
sanity.o: reader.h complete.h highlight.h env.h color.h kill.h
|
||||
screen.o: config.h fallback.h signal.h common.h util.h wutil.h output.h
|
||||
screen.o: screen.h color.h highlight.h env.h
|
||||
screen.o: screen.h highlight.h env.h color.h pager.h complete.h reader.h io.h
|
||||
signal.o: config.h signal.h common.h util.h fallback.h wutil.h event.h
|
||||
signal.o: reader.h io.h complete.h proc.h
|
||||
signal.o: reader.h io.h complete.h highlight.h env.h color.h proc.h
|
||||
signal.o: parse_tree.h tokenizer.h parse_constants.h
|
||||
tokenizer.o: config.h fallback.h signal.h util.h wutil.h common.h tokenizer.h
|
||||
utf8.o: utf8.h
|
||||
util.o: config.h fallback.h signal.h util.h common.h wutil.h
|
||||
wcstringutil.o: config.h wcstringutil.h common.h util.h
|
||||
wgetopt.o: config.h wgetopt.h wutil.h common.h util.h fallback.h signal.h
|
||||
wildcard.o: config.h fallback.h signal.h util.h wutil.h common.h complete.h
|
||||
wildcard.o: wildcard.h expand.h reader.h io.h exec.h proc.h
|
||||
wildcard.o: wildcard.h expand.h parse_constants.h reader.h io.h highlight.h
|
||||
wildcard.o: env.h color.h exec.h proc.h parse_tree.h tokenizer.h
|
||||
wutil.o: config.h fallback.h signal.h util.h common.h wutil.h
|
||||
xdgmime.o: xdgmime.h xdgmimeint.h xdgmimeglob.h xdgmimemagic.h xdgmimealias.h
|
||||
xdgmime.o: xdgmimeparent.h
|
||||
|
||||
34
README.md
34
README.md
@@ -1,15 +1,15 @@
|
||||
[fish](http://fishshell.com/) - the friendly interactive shell
|
||||
[fish](http://fishshell.com/) - the friendly interactive shell [](https://travis-ci.org/fish-shell/fish-shell)
|
||||
================================================
|
||||
|
||||
fish is a smart and user-friendly command line shell for OS X, Linux, and the rest of the family. fish includes features like syntax highlighting, autosuggest-as-you-type, and fancy tab completions that just work, with no configuration required.
|
||||
|
||||
For more on fish's design philosophy, see the [design document](http://fishshell.com/docs/2.0/design.html).
|
||||
For more on fish's design philosophy, see the [design document](http://fishshell.com/docs/current/design.html).
|
||||
|
||||
## Quick Start
|
||||
|
||||
fish generally works like other shells, like bash or zsh. A few important differences can be found at <http://fishshell.com/tutorial.html> by searching for magic phrase 'unlike other shells'.
|
||||
fish generally works like other shells, like bash or zsh. A few important differences can be found at <http://fishshell.com/docs/current/tutorial.html> by searching for the magic phrase 'unlike other shells'.
|
||||
|
||||
Detailed user documentation is available by running `help` within fish, and also at <http://fishshell.com/docs/2.0/index.html>
|
||||
Detailed user documentation is available by running `help` within fish, and also at <http://fishshell.com/docs/current/index.html>
|
||||
|
||||
## Building
|
||||
|
||||
@@ -17,8 +17,12 @@ fish is written in a sane subset of C++98, with a few components from C++TR1. It
|
||||
|
||||
fish can be built using autotools or Xcode. autoconf 2.60 or later is required.
|
||||
|
||||
fish depends on a curses implementation, such as ncurses. The headers and libraries are required for building.
|
||||
|
||||
fish requires gettext for translation support.
|
||||
|
||||
Building the documentation requires Doxygen 1.8.7 or newer.
|
||||
|
||||
### Autotools Build
|
||||
|
||||
autoconf
|
||||
@@ -42,12 +46,24 @@ If fish reports that it could not find curses, try installing a curses developme
|
||||
|
||||
On Debian or Ubuntu you want:
|
||||
|
||||
sudo apt-get install libncurses5-dev
|
||||
sudo apt-get install build-essential ncurses-dev libncurses5-dev gettext
|
||||
|
||||
on RedHat, CentOS, or Amazon EC2:
|
||||
On RedHat, CentOS, or Amazon EC2:
|
||||
|
||||
sudo yum install ncurses-devel
|
||||
|
||||
## Runtime Dependencies
|
||||
|
||||
fish requires a curses implementation, such as ncurses, to run.
|
||||
|
||||
fish requires a number of utilities to operate, which should be present on any Unix, GNU/Linux or OS X system. These include (but are not limited to) hostname, grep, awk, sed, which, and getopt. fish also requires the bc program.
|
||||
|
||||
Translation support requires the gettext program.
|
||||
|
||||
Some optional features of fish, such as the manual page completion parser and the web configuration tool, require Python.
|
||||
|
||||
In order to generate completions from man pages compressed with either lzma or xz, you may need to install an extra Python package. Python versions prior to 2.6 are not supported. For Python versions 2.6 to 3.2 you need to install the module `backports.lzma`. How to install it depends on your system and how you installed Python. Most Linux distributions should include it as a package named `backports-lzma` (or similar). From version 3.3 onwards, Python already includes the required module.
|
||||
|
||||
## Packages for Linux
|
||||
|
||||
Instructions on how to find builds for several Linux distros are at <https://github.com/fish-shell/fish-shell/wiki/Nightly-builds>
|
||||
@@ -66,12 +82,6 @@ To switch your default shell back, you can run:
|
||||
|
||||
Substitute /bin/bash with /bin/tcsh or /bin/zsh as appropriate.
|
||||
|
||||
## Optional Dependencies
|
||||
|
||||
In order to generate completions from man pages compressed with either lzma or xz, you may need to install an extra Python package.
|
||||
|
||||
Python versions prior to 2.6 are not supported. For Python versions 2.6 to 3.2 you need to install the module `backports.lzma`. How to install it depends on your system and how you installed Python. Most Linux distributions should include it as a package named `backports-lzma` (or similar). From version 3.3 onwards, Python already includes the required module.
|
||||
|
||||
## Contact Us
|
||||
|
||||
Questions, comments, rants and raves can be posted to the official fish mailing list at <https://lists.sourceforge.net/lists/listinfo/fish-users> or join us on our IRC channel [#fish at irc.oftc.net](https://webchat.oftc.net/?channels=fish).
|
||||
|
||||
39
autoload.cpp
39
autoload.cpp
@@ -19,7 +19,7 @@ static const int kAutoloadStalenessInterval = 15;
|
||||
file_access_attempt_t access_file(const wcstring &path, int mode)
|
||||
{
|
||||
//printf("Touch %ls\n", path.c_str());
|
||||
file_access_attempt_t result = {0};
|
||||
file_access_attempt_t result = {};
|
||||
struct stat statbuf;
|
||||
if (wstat(path, &statbuf))
|
||||
{
|
||||
@@ -48,9 +48,7 @@ autoload_t::autoload_t(const wcstring &env_var_name_var, const builtin_script_t
|
||||
lock(),
|
||||
env_var_name(env_var_name_var),
|
||||
builtin_scripts(scripts),
|
||||
builtin_script_count(script_count),
|
||||
last_path(),
|
||||
is_loading_set()
|
||||
builtin_script_count(script_count)
|
||||
{
|
||||
pthread_mutex_init(&lock, NULL);
|
||||
}
|
||||
@@ -66,7 +64,7 @@ void autoload_t::node_was_evicted(autoload_function_t *node)
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
|
||||
// Tell ourselves that the command was removed if it was loaded
|
||||
if (! node->is_loaded)
|
||||
if (node->is_loaded)
|
||||
this->command_removed(node->key);
|
||||
delete node;
|
||||
}
|
||||
@@ -94,33 +92,34 @@ int autoload_t::load(const wcstring &cmd, bool reload)
|
||||
if (path_var != this->last_path)
|
||||
{
|
||||
this->last_path = path_var;
|
||||
this->last_path_tokenized.clear();
|
||||
tokenize_variable_array(this->last_path, this->last_path_tokenized);
|
||||
|
||||
scoped_lock locker(lock);
|
||||
this->evict_all_nodes();
|
||||
}
|
||||
|
||||
/* Mark that we're loading this. Hang onto the iterator for fast erasing later. Note that std::set has guarantees about not invalidating iterators, so this is safe to do across the callouts below. */
|
||||
typedef std::set<wcstring>::iterator set_iterator_t;
|
||||
std::pair<set_iterator_t, bool> insert_result = is_loading_set.insert(cmd);
|
||||
set_iterator_t where = insert_result.first;
|
||||
bool inserted = insert_result.second;
|
||||
|
||||
/** Warn and fail on infinite recursion. It's OK to do this because this function is only called on the main thread. */
|
||||
if (this->is_loading(cmd))
|
||||
if (! inserted)
|
||||
{
|
||||
/* We failed to insert */
|
||||
debug(0,
|
||||
_(L"Could not autoload item '%ls', it is already being autoloaded. "
|
||||
L"This is a circular dependency in the autoloading scripts, please remove it."),
|
||||
cmd.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Mark that we're loading this */
|
||||
is_loading_set.insert(cmd);
|
||||
|
||||
/* Get the list of paths from which we will try to load */
|
||||
std::vector<wcstring> path_list;
|
||||
tokenize_variable_array(path_var, path_list);
|
||||
|
||||
/* Try loading it */
|
||||
res = this->locate_file_and_maybe_load_it(cmd, true, reload, path_list);
|
||||
res = this->locate_file_and_maybe_load_it(cmd, true, reload, this->last_path_tokenized);
|
||||
|
||||
/* Clean up */
|
||||
bool erased = !! is_loading_set.erase(cmd);
|
||||
assert(erased);
|
||||
is_loading_set.erase(where);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -195,7 +194,6 @@ autoload_function_t *autoload_t::get_autoloaded_function_with_creation(const wcs
|
||||
bool autoload_t::locate_file_and_maybe_load_it(const wcstring &cmd, bool really_load, bool reload, const wcstring_list_t &path_list)
|
||||
{
|
||||
/* Note that we are NOT locked in this function! */
|
||||
size_t i;
|
||||
bool reloaded = 0;
|
||||
|
||||
/* Try using a cached function. If we really want the function to be loaded, require that it be really loaded. If we're not reloading, allow stale functions. */
|
||||
@@ -234,6 +232,7 @@ bool autoload_t::locate_file_and_maybe_load_it(const wcstring &cmd, bool really_
|
||||
/* If we can use this function, return whether we were able to access it */
|
||||
if (use_cached)
|
||||
{
|
||||
assert(func != NULL);
|
||||
return func->is_internalized || func->access.accessible;
|
||||
}
|
||||
}
|
||||
@@ -276,7 +275,7 @@ bool autoload_t::locate_file_and_maybe_load_it(const wcstring &cmd, bool really_
|
||||
if (! has_script_source)
|
||||
{
|
||||
/* Iterate over path searching for suitable completion files */
|
||||
for (i=0; i<path_list.size(); i++)
|
||||
for (size_t i=0; i<path_list.size(); i++)
|
||||
{
|
||||
wcstring next = path_list.at(i);
|
||||
wcstring path = next + L"/" + cmd + L".fish";
|
||||
@@ -298,7 +297,7 @@ bool autoload_t::locate_file_and_maybe_load_it(const wcstring &cmd, bool really_
|
||||
|
||||
/* Generate the script source */
|
||||
wcstring esc = escape_string(path, 1);
|
||||
script_source = L". " + esc;
|
||||
script_source = L"source " + esc;
|
||||
has_script_source = true;
|
||||
|
||||
/* Remove any loaded command because we are going to reload it. Note that this will deadlock if command_removed calls back into us. */
|
||||
|
||||
@@ -65,17 +65,15 @@ class autoload_t : private lru_cache_t<autoload_function_t>
|
||||
/** The path from which we most recently autoloaded */
|
||||
wcstring last_path;
|
||||
|
||||
/** That path, tokenized (split on separators) */
|
||||
wcstring_list_t last_path_tokenized;
|
||||
|
||||
/**
|
||||
A table containing all the files that are currently being
|
||||
loaded. This is here to help prevent recursion.
|
||||
*/
|
||||
std::set<wcstring> is_loading_set;
|
||||
|
||||
bool is_loading(const wcstring &name) const
|
||||
{
|
||||
return is_loading_set.find(name) != is_loading_set.end();
|
||||
}
|
||||
|
||||
void remove_all_functions(void)
|
||||
{
|
||||
this->evict_all_nodes();
|
||||
|
||||
@@ -37,10 +37,12 @@ resolve_path()
|
||||
# Expand relative paths
|
||||
DOXYFILE=`resolve_path "$DOXYFILE"`
|
||||
INPUTDIR=`resolve_path "$INPUTDIR"`
|
||||
INPUTFILTER=`resolve_path "$INPUT_FILTER"`
|
||||
OUTPUTDIR=`resolve_path "$OUTPUTDIR"`
|
||||
|
||||
echo " doxygen file: $DOXYFILE"
|
||||
echo " input directory: $INPUTDIR"
|
||||
echo " input filter: $INPUTFILTER"
|
||||
echo " output directory: $OUTPUTDIR"
|
||||
echo " skipping: $CONDEMNED_PAGES"
|
||||
|
||||
@@ -66,6 +68,12 @@ if test -z "$DOXYGENPATH"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check we have the lexicon filter
|
||||
if test -z "$INPUT_FILTER"; then
|
||||
echo >&2 "Lexicon filter is not available. Continuing without."
|
||||
INPUTFILTER=''
|
||||
fi
|
||||
|
||||
# Determine where our output should go
|
||||
if ! mkdir -p "${OUTPUTDIR}" ; then
|
||||
echo "Could not create output directory '${OUTPUTDIR}'"
|
||||
@@ -87,6 +95,7 @@ done
|
||||
# This prevents doxygen from generating "documentation" for intermediate directories
|
||||
DOXYPARAMS=$(cat <<EOF
|
||||
PROJECT_NUMBER=$PROJECT_NUMBER
|
||||
INPUT_FILTER=$INPUTFILTER
|
||||
INPUT=.
|
||||
OUTPUT_DIRECTORY=$OUTPUTDIR
|
||||
QUIET=YES
|
||||
@@ -100,7 +109,7 @@ find "${OUTPUTDIR}" -name "*.1" -delete
|
||||
|
||||
# Run doxygen
|
||||
cd "$TMPLOC"
|
||||
(cat "${DOXYFILE}" ; echo "$DOXYPARAMS";) | "$DOXYGENPATH" -
|
||||
(cat "${DOXYFILE}" ; echo "$DOXYPARAMS";) | "$DOXYGENPATH" -
|
||||
|
||||
# Remember errors
|
||||
RESULT=$?
|
||||
@@ -110,15 +119,16 @@ if test "$RESULT" = 0 ; then
|
||||
|
||||
# Postprocess the files
|
||||
for i in "$INPUTDIR"/*.txt; do
|
||||
# It would be nice to use -i here for edit in place, but that is not portable
|
||||
# It would be nice to use -i here for edit in place, but that is not portable
|
||||
CMD_NAME=`basename "$i" .txt`;
|
||||
sed -e "s/\(.\)\\.SH/\1/" -e "s/$CMD_NAME *\\\\- *\"\(.*\)\"/\1/" "${CMD_NAME}.1" > "${CMD_NAME}.1.tmp"
|
||||
sed < ${CMD_NAME}.1 > ${CMD_NAME}.1.tmp \
|
||||
-e "/.SH \"$CMD_NAME/d" \
|
||||
-e "s/^$CMD_NAME * \\\- \([^ ]*\) /\\\fB\1\\\fP -/"
|
||||
mv "${CMD_NAME}.1.tmp" "${CMD_NAME}.1"
|
||||
done
|
||||
|
||||
|
||||
# Erase condemned pages
|
||||
rm -f $CONDEMNED_PAGES
|
||||
|
||||
fi
|
||||
|
||||
# Destroy TMPLOC
|
||||
|
||||
@@ -5,17 +5,14 @@
|
||||
# Modified for fish by David Adam <zanchey@ucc.gu.uwa.edu.au>
|
||||
|
||||
FBVF=FISH-BUILD-VERSION-FILE
|
||||
DEF_VER=2.0.GIT
|
||||
DEF_VER=unknown
|
||||
|
||||
# First see if there is a version file (included in release tarballs),
|
||||
# then try git-describe, then default.
|
||||
if test -f version
|
||||
then
|
||||
VN=$(cat version) || VN="$DEF_VER"
|
||||
elif test -d .git -o -f .git && type git >/dev/null
|
||||
then
|
||||
VN=$(git describe --tags --dirty 2>/dev/null)
|
||||
else
|
||||
elif ! VN=$(git describe --always --dirty 2>/dev/null); then
|
||||
VN="$DEF_VER"
|
||||
fi
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ wd="$PWD"
|
||||
prefix="fish"
|
||||
|
||||
# Get the version from git-describe
|
||||
VERSION=`git describe --tags --dirty 2>/dev/null`
|
||||
VERSION=`git describe --dirty 2>/dev/null`
|
||||
prefix="$prefix-$VERSION"
|
||||
|
||||
# The path where we will output the tar file
|
||||
@@ -30,7 +30,7 @@ path=~/fish_built/$prefix.tar
|
||||
rm -f "$path" "$path".gz
|
||||
|
||||
# git starts the archive
|
||||
git archive --format=tar --prefix="$prefix"/ master > "$path"
|
||||
git archive --format=tar --prefix="$prefix"/ HEAD > "$path"
|
||||
|
||||
# tarball out the documentation, generate a configure script and version file
|
||||
# Don't use autoreconf since it invokes commands that may not be installed, like aclocal
|
||||
|
||||
1321
builtin.cpp
1321
builtin.cpp
File diff suppressed because it is too large
Load Diff
28
builtin.h
28
builtin.h
@@ -164,19 +164,35 @@ void builtin_pop_io(parser_t &parser);
|
||||
wcstring builtin_get_desc(const wcstring &b);
|
||||
|
||||
|
||||
/**
|
||||
Slightly kludgy function used with 'complete -C' in order to make
|
||||
the commandline builtin operate on the string to complete instead
|
||||
of operating on whatever is to be completed.
|
||||
|
||||
/** Support for setting and removing transient command lines.
|
||||
This is used by 'complete -C' in order to make
|
||||
the commandline builtin operate on the string to complete instead
|
||||
of operating on whatever is to be completed. It's also used by
|
||||
completion wrappers, to allow a command to appear as the command
|
||||
being wrapped for the purposes of completion.
|
||||
|
||||
Instantiating an instance of builtin_commandline_scoped_transient_t
|
||||
pushes the command as the new transient commandline. The destructor removes it.
|
||||
It will assert if construction/destruction does not happen in a stack-like (LIFO) order.
|
||||
*/
|
||||
const wchar_t *builtin_complete_get_temporary_buffer();
|
||||
class builtin_commandline_scoped_transient_t
|
||||
{
|
||||
size_t token;
|
||||
public:
|
||||
builtin_commandline_scoped_transient_t(const wcstring &cmd);
|
||||
~builtin_commandline_scoped_transient_t();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Run the __fish_print_help function to obtain the help information
|
||||
for the specified command.
|
||||
*/
|
||||
|
||||
wcstring builtin_help_get(parser_t &parser, const wchar_t *cmd);
|
||||
|
||||
/** Defines a function, like builtin_function. Returns 0 on success. args should NOT contain 'function' as the first argument. */
|
||||
int define_function(parser_t &parser, const wcstring_list_t &args, const wcstring &contents, int definition_line_offset, wcstring *out_err);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -79,6 +79,51 @@ static size_t get_cursor_pos()
|
||||
return current_cursor_pos;
|
||||
}
|
||||
|
||||
static pthread_mutex_t transient_commandline_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static wcstring_list_t *get_transient_stack()
|
||||
{
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
ASSERT_IS_LOCKED(transient_commandline_lock);
|
||||
// A pointer is a little more efficient than an object as a static because we can elide the thread-safe initialization
|
||||
static wcstring_list_t *result = NULL;
|
||||
if (! result)
|
||||
{
|
||||
result = new wcstring_list_t();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool get_top_transient(wcstring *out_result)
|
||||
{
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
bool result = false;
|
||||
scoped_lock locker(transient_commandline_lock);
|
||||
const wcstring_list_t *stack = get_transient_stack();
|
||||
if (! stack->empty())
|
||||
{
|
||||
out_result->assign(stack->back());
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
builtin_commandline_scoped_transient_t::builtin_commandline_scoped_transient_t(const wcstring &cmd)
|
||||
{
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
scoped_lock locker(transient_commandline_lock);
|
||||
wcstring_list_t *stack = get_transient_stack();
|
||||
stack->push_back(cmd);
|
||||
this->token = stack->size();
|
||||
}
|
||||
|
||||
builtin_commandline_scoped_transient_t::~builtin_commandline_scoped_transient_t()
|
||||
{
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
scoped_lock locker(transient_commandline_lock);
|
||||
wcstring_list_t *stack = get_transient_stack();
|
||||
assert(this->token == stack->size());
|
||||
stack->pop_back();
|
||||
}
|
||||
|
||||
/**
|
||||
Replace/append/insert the selection with/at/after the specified string.
|
||||
@@ -143,17 +188,13 @@ static void write_part(const wchar_t *begin,
|
||||
int cut_at_cursor,
|
||||
int tokenize)
|
||||
{
|
||||
wcstring out;
|
||||
wchar_t *buff;
|
||||
size_t pos;
|
||||
|
||||
pos = get_cursor_pos()-(begin-get_buffer());
|
||||
size_t pos = get_cursor_pos()-(begin-get_buffer());
|
||||
|
||||
if (tokenize)
|
||||
{
|
||||
buff = wcsndup(begin, end-begin);
|
||||
wchar_t *buff = wcsndup(begin, end-begin);
|
||||
// fwprintf( stderr, L"Subshell: %ls, end char %lc\n", buff, *end );
|
||||
out.clear();
|
||||
wcstring out;
|
||||
tokenizer_t tok(buff, TOK_ACCEPT_UNFINISHED);
|
||||
for (; tok_has_next(&tok); tok_next(&tok))
|
||||
{
|
||||
@@ -165,7 +206,9 @@ static void write_part(const wchar_t *begin,
|
||||
{
|
||||
case TOK_STRING:
|
||||
{
|
||||
out.append(escape_string(tok_last(&tok), UNESCAPE_INCOMPLETE));
|
||||
wcstring tmp = tok_last(&tok);
|
||||
unescape_string_in_place(&tmp, UNESCAPE_INCOMPLETE);
|
||||
out.append(tmp);
|
||||
out.push_back(L'\n');
|
||||
break;
|
||||
}
|
||||
@@ -189,8 +232,9 @@ static void write_part(const wchar_t *begin,
|
||||
}
|
||||
|
||||
// debug( 0, L"woot2 %ls -> %ls", buff, esc );
|
||||
|
||||
stdout_buffer.append(begin, end - begin);
|
||||
wcstring tmp = wcstring(begin, end - begin);
|
||||
unescape_string_in_place(&tmp, UNESCAPE_INCOMPLETE);
|
||||
stdout_buffer.append(tmp);
|
||||
stdout_buffer.append(L"\n");
|
||||
|
||||
}
|
||||
@@ -211,18 +255,24 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||
int append_mode=0;
|
||||
|
||||
int function_mode = 0;
|
||||
int selection_mode = 0;
|
||||
|
||||
int tokenize = 0;
|
||||
|
||||
int cursor_mode = 0;
|
||||
int line_mode = 0;
|
||||
int search_mode = 0;
|
||||
const wchar_t *begin, *end;
|
||||
|
||||
current_buffer = (wchar_t *)builtin_complete_get_temporary_buffer();
|
||||
if (current_buffer)
|
||||
int paging_mode = 0;
|
||||
const wchar_t *begin = NULL, *end = NULL;
|
||||
|
||||
scoped_push<const wchar_t *> saved_current_buffer(¤t_buffer);
|
||||
scoped_push<size_t> saved_current_cursor_pos(¤t_cursor_pos);
|
||||
|
||||
wcstring transient_commandline;
|
||||
if (get_top_transient(&transient_commandline))
|
||||
{
|
||||
current_cursor_pos = wcslen(current_buffer);
|
||||
current_buffer = transient_commandline.c_str();
|
||||
current_cursor_pos = transient_commandline.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -255,77 +305,31 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
L"append", no_argument, 0, 'a'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"insert", no_argument, 0, 'i'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"replace", no_argument, 0, 'r'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"current-job", no_argument, 0, 'j'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"current-process", no_argument, 0, 'p'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"current-token", no_argument, 0, 't'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"current-buffer", no_argument, 0, 'b'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"cut-at-cursor", no_argument, 0, 'c'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"function", no_argument, 0, 'f'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"tokenize", no_argument, 0, 'o'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"help", no_argument, 0, 'h'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"input", required_argument, 0, 'I'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"cursor", no_argument, 0, 'C'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"line", no_argument, 0, 'L'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"search-mode", no_argument, 0, 'S'
|
||||
}
|
||||
,
|
||||
{
|
||||
0, 0, 0, 0
|
||||
}
|
||||
}
|
||||
;
|
||||
{ L"append", no_argument, 0, 'a' },
|
||||
{ L"insert", no_argument, 0, 'i' },
|
||||
{ L"replace", no_argument, 0, 'r' },
|
||||
{ L"current-job", no_argument, 0, 'j' },
|
||||
{ L"current-process", no_argument, 0, 'p' },
|
||||
{ L"current-token", no_argument, 0, 't' },
|
||||
{ L"current-buffer", no_argument, 0, 'b' },
|
||||
{ L"cut-at-cursor", no_argument, 0, 'c' },
|
||||
{ L"function", no_argument, 0, 'f' },
|
||||
{ L"tokenize", no_argument, 0, 'o' },
|
||||
{ L"help", no_argument, 0, 'h' },
|
||||
{ L"input", required_argument, 0, 'I' },
|
||||
{ L"cursor", no_argument, 0, 'C' },
|
||||
{ L"line", no_argument, 0, 'L' },
|
||||
{ L"search-mode", no_argument, 0, 'S' },
|
||||
{ L"selection", no_argument, 0, 's' },
|
||||
{ L"paging-mode", no_argument, 0, 'P' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
int opt_index = 0;
|
||||
|
||||
int opt = wgetopt_long(argc,
|
||||
argv,
|
||||
L"abijpctwforhI:CLS",
|
||||
L"abijpctwforhI:CLSsP",
|
||||
long_options,
|
||||
&opt_index);
|
||||
if (opt == -1)
|
||||
@@ -402,6 +406,14 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||
search_mode = 1;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
selection_mode = 1;
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
paging_mode = 1;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
builtin_print_help(parser, argv[0], stdout_buffer);
|
||||
return 0;
|
||||
@@ -419,7 +431,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||
/*
|
||||
Check for invalid switch combinations
|
||||
*/
|
||||
if (buffer_part || cut_at_cursor || append_mode || tokenize || cursor_mode || line_mode || search_mode)
|
||||
if (buffer_part || cut_at_cursor || append_mode || tokenize || cursor_mode || line_mode || search_mode || paging_mode)
|
||||
{
|
||||
append_format(stderr_buffer,
|
||||
BUILTIN_ERR_COMBO,
|
||||
@@ -446,10 +458,10 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||
{
|
||||
/*
|
||||
input_unreadch inserts the specified keypress or
|
||||
readline function at the top of the stack of unused
|
||||
readline function at the back of the queue of unused
|
||||
keypresses
|
||||
*/
|
||||
input_unreadch(c);
|
||||
input_queue_ch(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -465,10 +477,21 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (selection_mode)
|
||||
{
|
||||
size_t start, len;
|
||||
const wchar_t *buffer = reader_get_buffer();
|
||||
if (reader_get_selection(&start, &len))
|
||||
{
|
||||
stdout_buffer.append(buffer + start, len);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Check for invalid switch combinations
|
||||
*/
|
||||
if ((search_mode || line_mode || cursor_mode) && (argc-woptind > 1))
|
||||
if ((search_mode || line_mode || cursor_mode || paging_mode) && (argc-woptind > 1))
|
||||
{
|
||||
|
||||
append_format(stderr_buffer,
|
||||
@@ -479,7 +502,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((buffer_part || tokenize || cut_at_cursor) && (cursor_mode || line_mode || search_mode))
|
||||
if ((buffer_part || tokenize || cut_at_cursor) && (cursor_mode || line_mode || search_mode || paging_mode))
|
||||
{
|
||||
append_format(stderr_buffer,
|
||||
BUILTIN_ERR_COMBO,
|
||||
@@ -568,7 +591,12 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||
|
||||
if (search_mode)
|
||||
{
|
||||
return !reader_search_mode();
|
||||
return ! reader_search_mode();
|
||||
}
|
||||
|
||||
if (paging_mode)
|
||||
{
|
||||
return ! reader_has_pager_contents();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,12 +24,6 @@ Functions used for implementing the complete builtin.
|
||||
#include "parser.h"
|
||||
#include "reader.h"
|
||||
|
||||
|
||||
/**
|
||||
Internal storage for the builtin_complete_get_temporary_buffer() function.
|
||||
*/
|
||||
static const wchar_t *temporary_buffer;
|
||||
|
||||
/*
|
||||
builtin_complete_* are a set of rather silly looping functions that
|
||||
make sure that all the proper combinations of complete_add or
|
||||
@@ -179,14 +173,16 @@ static void builtin_complete_add(const wcstring_list_t &cmd,
|
||||
static void builtin_complete_remove3(const wchar_t *cmd,
|
||||
int cmd_type,
|
||||
wchar_t short_opt,
|
||||
const wcstring_list_t &long_opt)
|
||||
const wcstring_list_t &long_opt,
|
||||
int long_mode)
|
||||
{
|
||||
for (size_t i=0; i<long_opt.size(); i++)
|
||||
{
|
||||
complete_remove(cmd,
|
||||
cmd_type,
|
||||
short_opt,
|
||||
long_opt.at(i).c_str());
|
||||
long_opt.at(i).c_str(),
|
||||
long_mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,6 +205,7 @@ static void builtin_complete_remove2(const wchar_t *cmd,
|
||||
complete_remove(cmd,
|
||||
cmd_type,
|
||||
*s,
|
||||
0,
|
||||
0);
|
||||
|
||||
}
|
||||
@@ -217,24 +214,36 @@ static void builtin_complete_remove2(const wchar_t *cmd,
|
||||
builtin_complete_remove3(cmd,
|
||||
cmd_type,
|
||||
*s,
|
||||
gnu_opt);
|
||||
gnu_opt,
|
||||
0);
|
||||
builtin_complete_remove3(cmd,
|
||||
cmd_type,
|
||||
*s,
|
||||
old_opt);
|
||||
old_opt,
|
||||
1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gnu_opt.empty() && old_opt.empty())
|
||||
{
|
||||
complete_remove(cmd,
|
||||
cmd_type,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
builtin_complete_remove3(cmd,
|
||||
cmd_type,
|
||||
0,
|
||||
gnu_opt);
|
||||
gnu_opt,
|
||||
0);
|
||||
builtin_complete_remove3(cmd,
|
||||
cmd_type,
|
||||
0,
|
||||
old_opt);
|
||||
old_opt,
|
||||
1);
|
||||
|
||||
}
|
||||
|
||||
@@ -270,13 +279,6 @@ static void builtin_complete_remove(const wcstring_list_t &cmd,
|
||||
|
||||
}
|
||||
|
||||
|
||||
const wchar_t *builtin_complete_get_temporary_buffer()
|
||||
{
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
return temporary_buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
The complete builtin. Used for specifying programmable
|
||||
tab-completions. Calls the functions in complete.c for any heavy
|
||||
@@ -290,7 +292,6 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||
int result_mode=SHARED;
|
||||
int remove = 0;
|
||||
int authoritative = -1;
|
||||
int flags = COMPLETE_AUTO_SPACE;
|
||||
|
||||
wcstring short_opt;
|
||||
wcstring_list_t gnu_opt, old_opt;
|
||||
@@ -301,6 +302,7 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||
|
||||
wcstring_list_t cmd;
|
||||
wcstring_list_t path;
|
||||
wcstring_list_t wrap_targets;
|
||||
|
||||
static int recursion_level=0;
|
||||
|
||||
@@ -313,81 +315,31 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
L"exclusive", no_argument, 0, 'x'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"no-files", no_argument, 0, 'f'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"require-parameter", no_argument, 0, 'r'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"path", required_argument, 0, 'p'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"command", required_argument, 0, 'c'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"short-option", required_argument, 0, 's'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"long-option", required_argument, 0, 'l'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"old-option", required_argument, 0, 'o'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"description", required_argument, 0, 'd'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"arguments", required_argument, 0, 'a'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"erase", no_argument, 0, 'e'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"unauthoritative", no_argument, 0, 'u'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"authoritative", no_argument, 0, 'A'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"condition", required_argument, 0, 'n'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"do-complete", optional_argument, 0, 'C'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"help", no_argument, 0, 'h'
|
||||
}
|
||||
,
|
||||
{
|
||||
0, 0, 0, 0
|
||||
}
|
||||
}
|
||||
;
|
||||
{ L"exclusive", no_argument, 0, 'x' },
|
||||
{ L"no-files", no_argument, 0, 'f' },
|
||||
{ L"require-parameter", no_argument, 0, 'r' },
|
||||
{ L"path", required_argument, 0, 'p' },
|
||||
{ L"command", required_argument, 0, 'c' },
|
||||
{ L"short-option", required_argument, 0, 's' },
|
||||
{ L"long-option", required_argument, 0, 'l' },
|
||||
{ L"old-option", required_argument, 0, 'o' },
|
||||
{ L"description", required_argument, 0, 'd' },
|
||||
{ L"arguments", required_argument, 0, 'a' },
|
||||
{ L"erase", no_argument, 0, 'e' },
|
||||
{ L"unauthoritative", no_argument, 0, 'u' },
|
||||
{ L"authoritative", no_argument, 0, 'A' },
|
||||
{ L"condition", required_argument, 0, 'n' },
|
||||
{ L"wraps", required_argument, 0, 'w' },
|
||||
{ L"do-complete", optional_argument, 0, 'C' },
|
||||
{ L"help", no_argument, 0, 'h' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
int opt_index = 0;
|
||||
|
||||
int opt = wgetopt_long(argc,
|
||||
argv,
|
||||
L"a:c:p:s:l:o:d:frxeuAn:C::h",
|
||||
L"a:c:p:s:l:o:d:frxeuAn:C::w:h",
|
||||
long_options,
|
||||
&opt_index);
|
||||
if (opt == -1)
|
||||
@@ -474,6 +426,10 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||
case 'n':
|
||||
condition = woptarg;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
wrap_targets.push_back(woptarg);
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
do_complete = true;
|
||||
@@ -497,15 +453,19 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||
{
|
||||
if (condition && wcslen(condition))
|
||||
{
|
||||
if (parser.test(condition))
|
||||
const wcstring condition_string = condition;
|
||||
parse_error_list_t errors;
|
||||
if (parse_util_detect_errors(condition_string, &errors, false /* do not accept incomplete */))
|
||||
{
|
||||
append_format(stderr_buffer,
|
||||
L"%ls: Condition '%ls' contained a syntax error\n",
|
||||
L"%ls: Condition '%ls' contained a syntax error",
|
||||
argv[0],
|
||||
condition);
|
||||
|
||||
parser.test(condition, NULL, &stderr_buffer, argv[0]);
|
||||
|
||||
for (size_t i=0; i < errors.size(); i++)
|
||||
{
|
||||
append_format(stderr_buffer, L"\n%s: ", argv[0]);
|
||||
stderr_buffer.append(errors.at(i).describe(condition_string));
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
}
|
||||
@@ -515,15 +475,22 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||
{
|
||||
if (comp && wcslen(comp))
|
||||
{
|
||||
if (parser.test_args(comp, 0, 0))
|
||||
wcstring prefix;
|
||||
if (argv[0])
|
||||
{
|
||||
prefix.append(argv[0]);
|
||||
prefix.append(L": ");
|
||||
}
|
||||
|
||||
wcstring err_text;
|
||||
if (parser.detect_errors_in_argument_list(comp, &err_text, prefix.c_str()))
|
||||
{
|
||||
append_format(stderr_buffer,
|
||||
L"%ls: Completion '%ls' contained a syntax error\n",
|
||||
argv[0],
|
||||
comp);
|
||||
|
||||
parser.test_args(comp, &stderr_buffer, argv[0]);
|
||||
|
||||
stderr_buffer.append(err_text);
|
||||
stderr_buffer.push_back(L'\n');
|
||||
res = true;
|
||||
}
|
||||
}
|
||||
@@ -536,9 +503,9 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||
const wchar_t *token;
|
||||
|
||||
parse_util_token_extent(do_complete_param.c_str(), do_complete_param.size(), &token, 0, 0, 0);
|
||||
|
||||
const wchar_t *prev_temporary_buffer = temporary_buffer;
|
||||
temporary_buffer = do_complete_param.c_str();
|
||||
|
||||
/* Create a scoped transient command line, so that bulitin_commandline will see our argument, not the reader buffer */
|
||||
builtin_commandline_scoped_transient_t temp_buffer(do_complete_param);
|
||||
|
||||
if (recursion_level < 1)
|
||||
{
|
||||
@@ -551,33 +518,32 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||
{
|
||||
const completion_t &next = comp.at(i);
|
||||
|
||||
const wchar_t *prepend;
|
||||
/* Make a fake commandline, and then apply the completion to it. */
|
||||
const wcstring faux_cmdline = token;
|
||||
size_t tmp_cursor = faux_cmdline.size();
|
||||
wcstring faux_cmdline_with_completion = completion_apply_to_command_line(next.completion, next.flags, faux_cmdline, &tmp_cursor, false);
|
||||
|
||||
if (next.flags & COMPLETE_REPLACES_TOKEN)
|
||||
/* completion_apply_to_command_line will append a space unless COMPLETE_NO_SPACE is set. We don't want to set COMPLETE_NO_SPACE because that won't close quotes. What we want is to close the quote, but not append the space. So we just look for the space and clear it. */
|
||||
if (!(next.flags & COMPLETE_NO_SPACE) && string_suffixes_string(L" ", faux_cmdline_with_completion))
|
||||
{
|
||||
prepend = L"";
|
||||
}
|
||||
else
|
||||
{
|
||||
prepend = token;
|
||||
faux_cmdline_with_completion.resize(faux_cmdline_with_completion.size() - 1);
|
||||
}
|
||||
|
||||
/* The input data is meant to be something like you would have on the command line, e.g. includes backslashes. The output should be raw, i.e. unescaped. So we need to unescape the command line. See #1127 */
|
||||
unescape_string_in_place(&faux_cmdline_with_completion, UNESCAPE_DEFAULT);
|
||||
stdout_buffer.append(faux_cmdline_with_completion);
|
||||
|
||||
if (!(next.description).empty())
|
||||
/* Append any description */
|
||||
if (! next.description.empty())
|
||||
{
|
||||
append_format(stdout_buffer, L"%ls%ls\t%ls\n", prepend, next.completion.c_str(), next.description.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
append_format(stdout_buffer, L"%ls%ls\n", prepend, next.completion.c_str());
|
||||
stdout_buffer.push_back(L'\t');
|
||||
stdout_buffer.append(next.description);
|
||||
}
|
||||
stdout_buffer.push_back(L'\n');
|
||||
}
|
||||
|
||||
recursion_level--;
|
||||
}
|
||||
|
||||
temporary_buffer = prev_temporary_buffer;
|
||||
|
||||
}
|
||||
else if (woptind != argc)
|
||||
{
|
||||
@@ -596,6 +562,8 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
int flags = COMPLETE_AUTO_SPACE;
|
||||
|
||||
if (remove)
|
||||
{
|
||||
builtin_complete_remove(cmd,
|
||||
@@ -603,6 +571,7 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||
short_opt.c_str(),
|
||||
gnu_opt,
|
||||
old_opt);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -618,7 +587,18 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||
desc,
|
||||
flags);
|
||||
}
|
||||
|
||||
|
||||
// Handle wrap targets (probably empty)
|
||||
// We only wrap commands, not paths
|
||||
for (size_t w=0; w < wrap_targets.size(); w++)
|
||||
{
|
||||
const wcstring &wrap_target = wrap_targets.at(w);
|
||||
for (size_t i=0; i < cmd.size(); i++)
|
||||
{
|
||||
|
||||
(remove ? complete_remove_wrapper : complete_add_wrapper)(cmd.at(i), wrap_target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,6 @@ static int builtin_jobs(parser_t &parser, wchar_t **argv)
|
||||
int found=0;
|
||||
int mode=JOBS_DEFAULT;
|
||||
int print_last = 0;
|
||||
const job_t *j;
|
||||
|
||||
argc = builtin_count_args(argv);
|
||||
woptind=0;
|
||||
@@ -305,7 +304,7 @@ static int builtin_jobs(parser_t &parser, wchar_t **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
j = job_get_from_pid(pid);
|
||||
const job_t *j = job_get_from_pid(pid);
|
||||
|
||||
if (j && !job_is_completed(j))
|
||||
{
|
||||
@@ -344,6 +343,7 @@ static int builtin_jobs(parser_t &parser, wchar_t **argv)
|
||||
append_format(stdout_buffer,
|
||||
_(L"%ls: There are no jobs\n"),
|
||||
argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -357,16 +357,17 @@ long builtin_printf_state_t::print_esc(const wchar_t *escstart, bool octal_0)
|
||||
esc_value = esc_value * 16 + hex_to_bin(*p);
|
||||
if (esc_length == 0)
|
||||
this->fatal_error(_(L"missing hexadecimal number in escape"));
|
||||
this->append_output(esc_value);
|
||||
this->append_output(ENCODE_DIRECT_BASE + esc_value % 256);
|
||||
}
|
||||
else if (is_octal_digit(*p))
|
||||
{
|
||||
/* Parse \0ooo (if octal_0 && *p == L'0') or \ooo (otherwise).
|
||||
Allow \ooo if octal_0 && *p != L'0'; this is an undocumented
|
||||
extension to POSIX that is compatible with Bash 2.05b. */
|
||||
/* Wrap mod 256, which matches historic behavior */
|
||||
for (esc_length = 0, p += octal_0 && *p == L'0'; esc_length < 3 && is_octal_digit(*p); ++esc_length, ++p)
|
||||
esc_value = esc_value * 8 + octal_to_bin(*p);
|
||||
this->append_output(esc_value);
|
||||
this->append_output(ENCODE_DIRECT_BASE + esc_value % 256);
|
||||
}
|
||||
else if (*p && wcschr(L"\"\\abcefnrtv", *p))
|
||||
{
|
||||
@@ -467,6 +468,7 @@ void builtin_printf_state_t::print_direc(const wchar_t *start, size_t length, wc
|
||||
fmt.append(L"L");
|
||||
break;
|
||||
case L's':
|
||||
case L'c':
|
||||
fmt.append(L"l");
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -69,7 +69,7 @@ static int my_env_set(const wchar_t *key, const wcstring_list_t &val, int scope)
|
||||
|
||||
/* Don't bother validating (or complaining about) values that are already present */
|
||||
wcstring_list_t existing_values;
|
||||
const env_var_t existing_variable = env_get_string(key);
|
||||
const env_var_t existing_variable = env_get_string(key, scope);
|
||||
if (! existing_variable.missing_or_empty())
|
||||
tokenize_variable_array(existing_variable, existing_values);
|
||||
|
||||
@@ -157,9 +157,16 @@ static int my_env_set(const wchar_t *key, const wcstring_list_t &val, int scope)
|
||||
break;
|
||||
}
|
||||
|
||||
case ENV_SCOPE:
|
||||
{
|
||||
append_format(stderr_buffer, _(L"%ls: Tried to set the special variable '%ls' with the wrong scope\n"), L"set", key);
|
||||
retcode=1;
|
||||
break;
|
||||
}
|
||||
|
||||
case ENV_INVALID:
|
||||
{
|
||||
append_format(stderr_buffer, _(L"%ls: Unknown error"), L"set");
|
||||
append_format(stderr_buffer, _(L"%ls: Tried to set the special variable '%ls' to an invalid value\n"), L"set", key);
|
||||
retcode=1;
|
||||
break;
|
||||
}
|
||||
@@ -353,7 +360,7 @@ static void print_variables(int include_values, int esc, bool shorten_ok, int sc
|
||||
|
||||
if (include_values)
|
||||
{
|
||||
env_var_t value = env_get_string(key);
|
||||
env_var_t value = env_get_string(key, scope);
|
||||
if (!value.missing())
|
||||
{
|
||||
int shorten = 0;
|
||||
@@ -428,7 +435,7 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||
int slice=0;
|
||||
int i;
|
||||
|
||||
wchar_t *bad_char;
|
||||
const wchar_t *bad_char = NULL;
|
||||
|
||||
|
||||
/* Parse options to obtain the requested operation and the modifiers */
|
||||
@@ -519,7 +526,7 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||
}
|
||||
|
||||
|
||||
/* We can't both list and erase varaibles */
|
||||
/* We can't both list and erase variables */
|
||||
if (erase && list)
|
||||
{
|
||||
append_format(stderr_buffer,
|
||||
@@ -588,7 +595,7 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||
wcstring_list_t result;
|
||||
size_t j;
|
||||
|
||||
env_var_t dest_str = env_get_string(dest);
|
||||
env_var_t dest_str = env_get_string(dest, scope);
|
||||
if (! dest_str.missing())
|
||||
tokenize_variable_array(dest_str, result);
|
||||
|
||||
@@ -678,14 +685,6 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (slice && erase && (scope != ENV_USER))
|
||||
{
|
||||
free(dest);
|
||||
append_format(stderr_buffer, _(L"%ls: Can not specify scope when erasing array slice\n"), argv[0]);
|
||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
set assignment can work in two modes, either using slices or
|
||||
using the whole array. We detect which mode is used here.
|
||||
@@ -697,39 +696,47 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||
/*
|
||||
Slice mode
|
||||
*/
|
||||
size_t idx_count, val_count;
|
||||
std::vector<long> indexes;
|
||||
wcstring_list_t result;
|
||||
|
||||
const env_var_t dest_str = env_get_string(dest);
|
||||
const env_var_t dest_str = env_get_string(dest, scope);
|
||||
if (! dest_str.missing())
|
||||
tokenize_variable_array(dest_str, result);
|
||||
|
||||
for (; woptind<argc; woptind++)
|
||||
{
|
||||
if (!parse_index(indexes, argv[woptind], dest, result.size()))
|
||||
{
|
||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||
retcode = 1;
|
||||
break;
|
||||
}
|
||||
tokenize_variable_array(dest_str, result);
|
||||
}
|
||||
else if (erase)
|
||||
{
|
||||
retcode = 1;
|
||||
}
|
||||
|
||||
val_count = argc-woptind-1;
|
||||
idx_count = indexes.size();
|
||||
|
||||
if (!erase)
|
||||
if (!retcode)
|
||||
{
|
||||
for (; woptind<argc; woptind++)
|
||||
{
|
||||
if (val_count < idx_count)
|
||||
if (!parse_index(indexes, argv[woptind], dest, result.size()))
|
||||
{
|
||||
append_format(stderr_buffer, _(BUILTIN_SET_ARG_COUNT), argv[0]);
|
||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||
retcode=1;
|
||||
retcode = 1;
|
||||
break;
|
||||
}
|
||||
if (val_count == idx_count)
|
||||
|
||||
size_t idx_count = indexes.size();
|
||||
size_t val_count = argc-woptind-1;
|
||||
|
||||
if (!erase)
|
||||
{
|
||||
woptind++;
|
||||
break;
|
||||
if (val_count < idx_count)
|
||||
{
|
||||
append_format(stderr_buffer, _(BUILTIN_SET_ARG_COUNT), argv[0]);
|
||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||
retcode=1;
|
||||
break;
|
||||
}
|
||||
if (val_count == idx_count)
|
||||
{
|
||||
woptind++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -800,6 +807,16 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if we are setting variables above the effective scope.
|
||||
See https://github.com/fish-shell/fish-shell/issues/806
|
||||
*/
|
||||
|
||||
env_var_t global_dest = env_get_string(dest, ENV_GLOBAL);
|
||||
if (universal && ! global_dest.missing())
|
||||
{
|
||||
append_format(stderr_buffer, _(L"%ls: Warning: universal scope selected, but a global variable '%ls' exists.\n"), L"set", dest);
|
||||
}
|
||||
|
||||
free(dest);
|
||||
|
||||
if (retcode == STATUS_BUILTIN_OK && preserve_incoming_failure_exit_status)
|
||||
|
||||
@@ -11,6 +11,8 @@ Functions used for implementing the set_color builtin.
|
||||
|
||||
#if HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#elif HAVE_NCURSES_CURSES_H
|
||||
#include <ncurses/curses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#endif
|
||||
@@ -81,6 +83,12 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
||||
|
||||
int argc = builtin_count_args(argv);
|
||||
|
||||
/* Some code passes variables to set_color that don't exist, like $fish_user_whatever. As a hack, quietly return failure. */
|
||||
if (argc <= 1)
|
||||
{
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
const wchar_t *bgcolor = NULL;
|
||||
bool bold = false, underline=false;
|
||||
int errret;
|
||||
@@ -126,37 +134,31 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/* Remaining argument is foreground color */
|
||||
const wchar_t *fgcolor = NULL;
|
||||
if (woptind < argc)
|
||||
/* Remaining arguments are foreground color */
|
||||
std::vector<rgb_color_t> fgcolors;
|
||||
for (; woptind < argc; woptind++)
|
||||
{
|
||||
if (woptind + 1 == argc)
|
||||
rgb_color_t fg = rgb_color_t(argv[woptind]);
|
||||
if (fg.is_none() || fg.is_ignore())
|
||||
{
|
||||
fgcolor = argv[woptind];
|
||||
}
|
||||
else
|
||||
{
|
||||
append_format(stderr_buffer,
|
||||
_(L"%ls: Too many arguments\n"),
|
||||
argv[0]);
|
||||
append_format(stderr_buffer, _(L"%ls: Unknown color '%ls'\n"), argv[0], argv[woptind]);
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
fgcolors.push_back(fg);
|
||||
}
|
||||
|
||||
if (fgcolor == NULL && bgcolor == NULL && !bold && !underline)
|
||||
if (fgcolors.empty() && bgcolor == NULL && !bold && !underline)
|
||||
{
|
||||
append_format(stderr_buffer,
|
||||
_(L"%ls: Expected an argument\n"),
|
||||
argv[0]);
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
|
||||
const rgb_color_t fg = rgb_color_t(fgcolor ? fgcolor : L"");
|
||||
if (fgcolor && (fg.is_none() || fg.is_ignore()))
|
||||
{
|
||||
append_format(stderr_buffer, _(L"%ls: Unknown color '%ls'\n"), argv[0], fgcolor);
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
|
||||
// #1323: We may have multiple foreground colors. Choose the best one.
|
||||
// If we had no foreground coor, we'll get none(); if we have at least one we expect not-none
|
||||
const rgb_color_t fg = best_color(fgcolors, output_get_color_support());
|
||||
assert(fgcolors.empty() || !(fg.is_none() || fg.is_ignore()));
|
||||
|
||||
const rgb_color_t bg = rgb_color_t(bgcolor ? bgcolor : L"");
|
||||
if (bgcolor && (bg.is_none() || bg.is_ignore()))
|
||||
@@ -181,7 +183,6 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* Save old output function so we can restore it */
|
||||
int (* const saved_writer_func)(char) = output_get_writer();
|
||||
|
||||
@@ -205,21 +206,21 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
||||
{
|
||||
if (bg.is_normal())
|
||||
{
|
||||
write_background_color(0);
|
||||
write_color(rgb_color_t::black(), false /* not is_fg */);
|
||||
writembs(tparm(exit_attribute_mode));
|
||||
}
|
||||
}
|
||||
|
||||
if (fgcolor != NULL)
|
||||
if (! fg.is_none())
|
||||
{
|
||||
if (fg.is_normal() || fg.is_reset())
|
||||
{
|
||||
write_foreground_color(0);
|
||||
write_color(rgb_color_t::black(), true /* is_fg */);
|
||||
writembs(tparm(exit_attribute_mode));
|
||||
}
|
||||
else
|
||||
{
|
||||
write_foreground_color(index_for_color(fg));
|
||||
write_color(fg, true /* is_fg */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +228,7 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
||||
{
|
||||
if (! bg.is_normal() && ! bg.is_reset())
|
||||
{
|
||||
write_background_color(index_for_color(bg));
|
||||
write_color(bg, false /* not is_fg */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,9 +236,8 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
||||
output_set_writer(saved_writer_func);
|
||||
|
||||
/* Output the collected string */
|
||||
std::string local_output;
|
||||
std::swap(builtin_set_color_output, local_output);
|
||||
stdout_buffer.append(str2wcstring(local_output));
|
||||
stdout_buffer.append(str2wcstring(builtin_set_color_output));
|
||||
builtin_set_color_output.clear();
|
||||
|
||||
return STATUS_BUILTIN_OK;
|
||||
}
|
||||
|
||||
@@ -646,13 +646,11 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err)
|
||||
expression *result = parser.parse_expression(0, (unsigned int)args.size());
|
||||
|
||||
/* Handle errors */
|
||||
bool errored = false;
|
||||
for (size_t i = 0; i < parser.errors.size(); i++)
|
||||
{
|
||||
err.append(L"test: ");
|
||||
err.append(parser.errors.at(i));
|
||||
err.push_back(L'\n');
|
||||
errored = true;
|
||||
// For now we only show the first error
|
||||
break;
|
||||
}
|
||||
@@ -667,14 +665,12 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err)
|
||||
{
|
||||
append_format(err, L"test: unexpected argument at index %lu: '%ls'\n", (unsigned long)result->range.end, args.at(result->range.end).c_str());
|
||||
}
|
||||
errored = true;
|
||||
|
||||
delete result;
|
||||
result = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ static void print_all(int hard)
|
||||
|
||||
for (i=0; resource_arr[i].desc; i++)
|
||||
{
|
||||
w=maxi(w, my_wcswidth(resource_arr[i].desc));
|
||||
w=maxi(w, fish_wcswidth(resource_arr[i].desc));
|
||||
}
|
||||
|
||||
for (i=0; resource_arr[i].desc; i++)
|
||||
|
||||
24
color.cpp
24
color.cpp
@@ -6,7 +6,7 @@
|
||||
|
||||
bool rgb_color_t::try_parse_special(const wcstring &special)
|
||||
{
|
||||
bzero(&data, sizeof data);
|
||||
memset(&data, 0, sizeof data);
|
||||
const wchar_t *name = special.c_str();
|
||||
if (! wcscasecmp(name, L"normal"))
|
||||
{
|
||||
@@ -102,7 +102,7 @@ static unsigned char convert_color(const unsigned char rgb[3], const uint32_t *c
|
||||
|
||||
bool rgb_color_t::try_parse_rgb(const wcstring &name)
|
||||
{
|
||||
bzero(&data, sizeof data);
|
||||
memset(&data, 0, sizeof data);
|
||||
/* We support the following style of rgb formats (case insensitive):
|
||||
#FA3
|
||||
#F3A035
|
||||
@@ -125,7 +125,7 @@ bool rgb_color_t::try_parse_rgb(const wcstring &name)
|
||||
{
|
||||
int val = parse_hex_digit(name.at(digit_idx++));
|
||||
if (val < 0) break;
|
||||
data.rgb[i] = val*16+val;
|
||||
data.color.rgb[i] = val*16+val;
|
||||
}
|
||||
success = (i == 3);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ bool rgb_color_t::try_parse_rgb(const wcstring &name)
|
||||
int hi = parse_hex_digit(name.at(digit_idx++));
|
||||
int lo = parse_hex_digit(name.at(digit_idx++));
|
||||
if (lo < 0 || hi < 0) break;
|
||||
data.rgb[i] = hi*16+lo;
|
||||
data.color.rgb[i] = hi*16+lo;
|
||||
}
|
||||
success = (i == 3);
|
||||
}
|
||||
@@ -184,7 +184,7 @@ wcstring_list_t rgb_color_t::named_color_names(void)
|
||||
|
||||
bool rgb_color_t::try_parse_named(const wcstring &str)
|
||||
{
|
||||
bzero(&data, sizeof data);
|
||||
memset(&data, 0, sizeof data);
|
||||
size_t max = sizeof named_colors / sizeof *named_colors;
|
||||
for (size_t idx=0; idx < max; idx++)
|
||||
{
|
||||
@@ -298,7 +298,13 @@ static unsigned char term256_color_for_rgb(const unsigned char rgb[3])
|
||||
unsigned char rgb_color_t::to_term256_index() const
|
||||
{
|
||||
assert(type == type_rgb);
|
||||
return term256_color_for_rgb(data.rgb);
|
||||
return term256_color_for_rgb(data.color.rgb);
|
||||
}
|
||||
|
||||
color24_t rgb_color_t::to_color24() const
|
||||
{
|
||||
assert(type == type_rgb);
|
||||
return data.color;
|
||||
}
|
||||
|
||||
unsigned char rgb_color_t::to_name_index() const
|
||||
@@ -310,7 +316,7 @@ unsigned char rgb_color_t::to_name_index() const
|
||||
}
|
||||
else if (type == type_rgb)
|
||||
{
|
||||
return term8_color_for_rgb(data.rgb);
|
||||
return term8_color_for_rgb(data.color.rgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -327,7 +333,7 @@ void rgb_color_t::parse(const wcstring &str)
|
||||
if (! success) success = try_parse_rgb(str);
|
||||
if (! success)
|
||||
{
|
||||
bzero(this->data.rgb, sizeof this->data.rgb);
|
||||
memset(&this->data, 0, sizeof this->data);
|
||||
this->type = type_none;
|
||||
}
|
||||
}
|
||||
@@ -351,7 +357,7 @@ wcstring rgb_color_t::description() const
|
||||
case type_named:
|
||||
return format_string(L"named(%d: %ls)", (int)data.name_idx, name_for_color_idx(data.name_idx));
|
||||
case type_rgb:
|
||||
return format_string(L"rgb(0x%02x%02x%02x)", data.rgb[0], data.rgb[1], data.rgb[2]);
|
||||
return format_string(L"rgb(0x%02x%02x%02x)", data.color.rgb[0], data.color.rgb[1], data.color.rgb[2]);
|
||||
case type_reset:
|
||||
return L"reset";
|
||||
case type_normal:
|
||||
|
||||
12
color.h
12
color.h
@@ -8,6 +8,11 @@
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
|
||||
/* 24 bit color */
|
||||
struct color24_t
|
||||
{
|
||||
unsigned char rgb[3];
|
||||
};
|
||||
|
||||
/* A type that represents a color. We work hard to keep it at a size of 4 bytes. */
|
||||
class rgb_color_t
|
||||
@@ -36,7 +41,7 @@ class rgb_color_t
|
||||
union
|
||||
{
|
||||
unsigned char name_idx; //0-10
|
||||
unsigned char rgb[3];
|
||||
color24_t color;
|
||||
} data;
|
||||
|
||||
/** Try parsing a special color name like "normal" */
|
||||
@@ -129,9 +134,12 @@ class rgb_color_t
|
||||
/** Returns the name index for the given color. Requires that the color be named or RGB. */
|
||||
unsigned char to_name_index() const;
|
||||
|
||||
/** Returns the term256 index for the given color. Requires that the color be named or RGB. */
|
||||
/** Returns the term256 index for the given color. Requires that the color be RGB. */
|
||||
unsigned char to_term256_index() const;
|
||||
|
||||
/** Returns the 24 bit color for the given color. Requires that the color be RGB. */
|
||||
color24_t to_color24() const;
|
||||
|
||||
/** Returns whether the color is bold */
|
||||
bool is_bold() const
|
||||
{
|
||||
|
||||
392
common.cpp
392
common.cpp
@@ -45,9 +45,10 @@ parts of fish.
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#elif HAVE_NCURSES_CURSES_H
|
||||
#include <ncurses/curses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#endif
|
||||
@@ -72,7 +73,7 @@ parts of fish.
|
||||
#include "util.cpp"
|
||||
#include "fallback.cpp"
|
||||
|
||||
#define NOT_A_WCHAR WEOF
|
||||
#define NOT_A_WCHAR (static_cast<wint_t>(WEOF))
|
||||
|
||||
struct termios shell_modes;
|
||||
|
||||
@@ -83,16 +84,19 @@ static bool thread_assertions_configured_for_testing = false;
|
||||
wchar_t ellipsis_char;
|
||||
wchar_t omitted_newline_char;
|
||||
|
||||
char *profile=0;
|
||||
bool g_profiling_active = false;
|
||||
|
||||
const wchar_t *program_name;
|
||||
|
||||
int debug_level=1;
|
||||
|
||||
/**
|
||||
This struct should be continually updated by signals as the term resizes, and as such always contain the correct current size.
|
||||
This struct maintains the current state of the terminal size. It is updated on demand after receiving a SIGWINCH.
|
||||
Do not touch this struct directly, it's managed with a rwlock. Use common_get_width()/common_get_height().
|
||||
*/
|
||||
static struct winsize termsize;
|
||||
static volatile bool termsize_valid;
|
||||
static rwlock_t termsize_rwlock;
|
||||
|
||||
static char *wcs2str_internal(const wchar_t *in, char *out);
|
||||
|
||||
@@ -105,7 +109,7 @@ void show_stackframe()
|
||||
return;
|
||||
|
||||
void *trace[32];
|
||||
int i, trace_size = 0;
|
||||
int trace_size = 0;
|
||||
|
||||
trace_size = backtrace(trace, 32);
|
||||
char **messages = backtrace_symbols(trace, trace_size);
|
||||
@@ -113,7 +117,7 @@ void show_stackframe()
|
||||
if (messages)
|
||||
{
|
||||
debug(0, L"Backtrace:");
|
||||
for (i=0; i<trace_size; i++)
|
||||
for (int i=0; i<trace_size; i++)
|
||||
{
|
||||
fwprintf(stderr, L"%s\n", messages[i]);
|
||||
}
|
||||
@@ -213,14 +217,14 @@ static wcstring str2wcs_internal(const char *in, const size_t in_len)
|
||||
wc = ENCODE_DIRECT_BASE + (unsigned char)in[in_pos];
|
||||
result.push_back(wc);
|
||||
in_pos++;
|
||||
bzero(&state, sizeof state);
|
||||
memset(&state, 0, sizeof state);
|
||||
}
|
||||
else if (ret == 0)
|
||||
{
|
||||
/* Embedded null byte! */
|
||||
result.push_back(L'\0');
|
||||
in_pos++;
|
||||
bzero(&state, sizeof state);
|
||||
memset(&state, 0, sizeof state);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -252,7 +256,6 @@ char *wcs2str(const wchar_t *in)
|
||||
{
|
||||
if (! in)
|
||||
return NULL;
|
||||
char *out;
|
||||
size_t desired_size = MAX_UTF8_BYTES*wcslen(in)+1;
|
||||
char local_buff[512];
|
||||
if (desired_size <= sizeof local_buff / sizeof *local_buff)
|
||||
@@ -274,15 +277,13 @@ char *wcs2str(const wchar_t *in)
|
||||
else
|
||||
{
|
||||
// here we fall into the bad case of allocating a buffer probably much larger than necessary
|
||||
out = (char *)malloc(MAX_UTF8_BYTES*wcslen(in)+1);
|
||||
char *out = (char *)malloc(MAX_UTF8_BYTES*wcslen(in)+1);
|
||||
if (!out)
|
||||
{
|
||||
DIE_MEM();
|
||||
}
|
||||
return wcs2str_internal(in, out);
|
||||
}
|
||||
|
||||
return wcs2str_internal(in, out);
|
||||
}
|
||||
|
||||
char *wcs2str(const wcstring &in)
|
||||
@@ -314,7 +315,7 @@ std::string wcs2string(const wcstring &input)
|
||||
}
|
||||
else
|
||||
{
|
||||
bzero(converted, sizeof converted);
|
||||
memset(converted, 0, sizeof converted);
|
||||
size_t len = wcrtomb(converted, wc, &state);
|
||||
if (len == (size_t)(-1))
|
||||
{
|
||||
@@ -382,27 +383,6 @@ static char *wcs2str_internal(const wchar_t *in, char *out)
|
||||
return out;
|
||||
}
|
||||
|
||||
char **wcsv2strv(const wchar_t * const *in)
|
||||
{
|
||||
size_t i, count = 0;
|
||||
|
||||
while (in[count] != 0)
|
||||
count++;
|
||||
char **res = (char **)malloc(sizeof(char *)*(count+1));
|
||||
if (res == 0)
|
||||
{
|
||||
DIE_MEM();
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++)
|
||||
{
|
||||
res[i]=wcs2str(in[i]);
|
||||
}
|
||||
res[count]=0;
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
wcstring format_string(const wchar_t *format, ...)
|
||||
{
|
||||
va_list va;
|
||||
@@ -412,7 +392,7 @@ wcstring format_string(const wchar_t *format, ...)
|
||||
return result;
|
||||
}
|
||||
|
||||
wcstring vformat_string(const wchar_t *format, va_list va_orig)
|
||||
void append_formatv(wcstring &target, const wchar_t *format, va_list va_orig)
|
||||
{
|
||||
const int saved_err = errno;
|
||||
/*
|
||||
@@ -463,22 +443,21 @@ wcstring vformat_string(const wchar_t *format, va_list va_orig)
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
wcstring result = wcstring(buff);
|
||||
target.append(buff);
|
||||
|
||||
if (buff != static_buff)
|
||||
{
|
||||
free(buff);
|
||||
}
|
||||
|
||||
errno = saved_err;
|
||||
return result;
|
||||
}
|
||||
|
||||
void append_formatv(wcstring &str, const wchar_t *format, va_list ap)
|
||||
wcstring vformat_string(const wchar_t *format, va_list va_orig)
|
||||
{
|
||||
/* Preserve errno across this call since it likes to stomp on it */
|
||||
int err = errno;
|
||||
str.append(vformat_string(format, ap));
|
||||
errno = err;
|
||||
|
||||
wcstring result;
|
||||
append_formatv(result, format, va_orig);
|
||||
return result;
|
||||
}
|
||||
|
||||
void append_format(wcstring &str, const wchar_t *format, ...)
|
||||
@@ -489,17 +468,17 @@ void append_format(wcstring &str, const wchar_t *format, ...)
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
wchar_t *wcsvarname(const wchar_t *str)
|
||||
const wchar_t *wcsvarname(const wchar_t *str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
if ((!iswalnum(*str)) && (*str != L'_'))
|
||||
{
|
||||
return (wchar_t *)str;
|
||||
return str;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const wchar_t *wcsfuncname(const wchar_t *str)
|
||||
@@ -508,18 +487,19 @@ const wchar_t *wcsfuncname(const wchar_t *str)
|
||||
}
|
||||
|
||||
|
||||
int wcsvarchr(wchar_t chr)
|
||||
bool wcsvarchr(wchar_t chr)
|
||||
{
|
||||
return iswalnum(chr) || chr == L'_';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The glibc version of wcswidth seems to hang on some strings. fish uses this replacement.
|
||||
*/
|
||||
int my_wcswidth(const wchar_t *c)
|
||||
int fish_wcswidth(const wchar_t *str)
|
||||
{
|
||||
return fish_wcswidth(c, wcslen(c));
|
||||
return fish_wcswidth(str, wcslen(str));
|
||||
}
|
||||
|
||||
int fish_wcswidth(const wcstring& str)
|
||||
{
|
||||
return fish_wcswidth(str.c_str(), str.size());
|
||||
}
|
||||
|
||||
wchar_t *quote_end(const wchar_t *pos)
|
||||
@@ -576,7 +556,7 @@ wcstring wsetlocale(int category, const wchar_t *locale)
|
||||
return format_string(L"%s", res);
|
||||
}
|
||||
|
||||
bool contains_internal(const wchar_t *a, ...)
|
||||
bool contains_internal(const wchar_t *a, int vararg_handle, ...)
|
||||
{
|
||||
const wchar_t *arg;
|
||||
va_list va;
|
||||
@@ -584,7 +564,7 @@ bool contains_internal(const wchar_t *a, ...)
|
||||
|
||||
CHECK(a, 0);
|
||||
|
||||
va_start(va, a);
|
||||
va_start(va, vararg_handle);
|
||||
while ((arg=va_arg(va, const wchar_t *))!= 0)
|
||||
{
|
||||
if (wcscmp(a,arg) == 0)
|
||||
@@ -598,17 +578,19 @@ bool contains_internal(const wchar_t *a, ...)
|
||||
return res;
|
||||
}
|
||||
|
||||
/* wcstring variant of contains_internal. The first parameter is a wcstring, the rest are const wchar_t* */
|
||||
__sentinel bool contains_internal(const wcstring &needle, ...)
|
||||
/* wcstring variant of contains_internal. The first parameter is a wcstring, the rest are const wchar_t *. vararg_handle exists only to give us a POD-value to apss to va_start */
|
||||
__sentinel bool contains_internal(const wcstring &needle, int vararg_handle, ...)
|
||||
{
|
||||
const wchar_t *arg;
|
||||
va_list va;
|
||||
int res = 0;
|
||||
|
||||
va_start(va, needle);
|
||||
const wchar_t *needle_cstr = needle.c_str();
|
||||
va_start(va, vararg_handle);
|
||||
while ((arg=va_arg(va, const wchar_t *))!= 0)
|
||||
{
|
||||
if (needle == arg)
|
||||
/* libc++ has an unfortunate implementation of operator== that unconditonally wcslen's the wchar_t* parameter, so prefer wcscmp directly */
|
||||
if (! wcscmp(needle_cstr, arg))
|
||||
{
|
||||
res=1;
|
||||
break;
|
||||
@@ -711,6 +693,23 @@ void debug(int level, const char *msg, ...)
|
||||
errno = errno_old;
|
||||
}
|
||||
|
||||
void print_stderr(const wcstring &str)
|
||||
{
|
||||
fprintf(stderr, "%ls\n", str.c_str());
|
||||
}
|
||||
|
||||
void read_ignore(int fd, void *buff, size_t count)
|
||||
{
|
||||
size_t ignore __attribute__((unused));
|
||||
ignore = read(fd, buff, count);
|
||||
}
|
||||
|
||||
void write_ignore(int fd, const void *buff, size_t count)
|
||||
{
|
||||
size_t ignore __attribute__((unused));
|
||||
ignore = write(fd, buff, count);
|
||||
}
|
||||
|
||||
|
||||
void debug_safe(int level, const char *msg, const char *param1, const char *param2, const char *param3, const char *param4, const char *param5, const char *param6, const char *param7, const char *param8, const char *param9, const char *param10, const char *param11, const char *param12)
|
||||
{
|
||||
@@ -731,7 +730,7 @@ void debug_safe(int level, const char *msg, const char *param1, const char *para
|
||||
if (end == NULL)
|
||||
end = cursor + strlen(cursor);
|
||||
|
||||
write(STDERR_FILENO, cursor, end - cursor);
|
||||
write_ignore(STDERR_FILENO, cursor, end - cursor);
|
||||
|
||||
if (end[0] == '%' && end[1] == 's')
|
||||
{
|
||||
@@ -740,7 +739,7 @@ void debug_safe(int level, const char *msg, const char *param1, const char *para
|
||||
const char *format = params[param_idx++];
|
||||
if (! format)
|
||||
format = "(null)";
|
||||
write(STDERR_FILENO, format, strlen(format));
|
||||
write_ignore(STDERR_FILENO, format, strlen(format));
|
||||
cursor = end + 2;
|
||||
}
|
||||
else if (end[0] == '\0')
|
||||
@@ -756,12 +755,12 @@ void debug_safe(int level, const char *msg, const char *param1, const char *para
|
||||
}
|
||||
|
||||
// We always append a newline
|
||||
write(STDERR_FILENO, "\n", 1);
|
||||
write_ignore(STDERR_FILENO, "\n", 1);
|
||||
|
||||
errno = errno_old;
|
||||
}
|
||||
|
||||
void format_long_safe(char buff[128], long val)
|
||||
void format_long_safe(char buff[64], long val)
|
||||
{
|
||||
if (val == 0)
|
||||
{
|
||||
@@ -795,7 +794,7 @@ void format_long_safe(char buff[128], long val)
|
||||
}
|
||||
}
|
||||
|
||||
void format_long_safe(wchar_t buff[128], long val)
|
||||
void format_long_safe(wchar_t buff[64], long val)
|
||||
{
|
||||
if (val == 0)
|
||||
{
|
||||
@@ -807,10 +806,9 @@ void format_long_safe(wchar_t buff[128], long val)
|
||||
size_t idx = 0;
|
||||
bool negative = (val < 0);
|
||||
|
||||
while (val > 0)
|
||||
while (val != 0)
|
||||
{
|
||||
long rem = val % 10;
|
||||
/* Here we're assuming that wide character digits are contiguous - is that a correct assumption? */
|
||||
buff[idx++] = L'0' + (wchar_t)(rem < 0 ? -rem : rem);
|
||||
val /= 10;
|
||||
}
|
||||
@@ -830,19 +828,18 @@ void format_long_safe(wchar_t buff[128], long val)
|
||||
|
||||
void write_screen(const wcstring &msg, wcstring &buff)
|
||||
{
|
||||
const wchar_t *start, *pos;
|
||||
int line_width = 0;
|
||||
int tok_width = 0;
|
||||
int screen_width = common_get_width();
|
||||
|
||||
if (screen_width)
|
||||
{
|
||||
start = pos = msg.c_str();
|
||||
const wchar_t *start = msg.c_str();
|
||||
const wchar_t *pos = start;
|
||||
while (1)
|
||||
{
|
||||
int overflow = 0;
|
||||
|
||||
tok_width=0;
|
||||
int tok_width=0;
|
||||
|
||||
/*
|
||||
Tokenize on whitespace, and also calculate the width of the token
|
||||
@@ -1004,7 +1001,22 @@ static void escape_string_internal(const wchar_t *orig_in, size_t in_len, wcstri
|
||||
out += *in;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Experimental fix for #1614
|
||||
// The hope is that any time these appear in a string, they came from wildcard expansion
|
||||
case ANY_CHAR:
|
||||
out += L'?';
|
||||
break;
|
||||
|
||||
case ANY_STRING:
|
||||
out += L'*';
|
||||
break;
|
||||
|
||||
case ANY_STRING_RECURSIVE:
|
||||
out += L"**";
|
||||
break;
|
||||
|
||||
case L'&':
|
||||
case L'$':
|
||||
case L' ':
|
||||
@@ -1086,7 +1098,7 @@ static void escape_string_internal(const wchar_t *orig_in, size_t in_len, wcstri
|
||||
}
|
||||
}
|
||||
|
||||
wchar_t *escape(const wchar_t *in, escape_flags_t flags)
|
||||
wcstring escape(const wchar_t *in, escape_flags_t flags)
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
@@ -1094,9 +1106,9 @@ wchar_t *escape(const wchar_t *in, escape_flags_t flags)
|
||||
FATAL_EXIT();
|
||||
}
|
||||
|
||||
wcstring tmp;
|
||||
escape_string_internal(in, wcslen(in), &tmp, flags);
|
||||
return wcsdup(tmp.c_str());
|
||||
wcstring result;
|
||||
escape_string_internal(in, wcslen(in), &result, flags);
|
||||
return result;
|
||||
}
|
||||
|
||||
wcstring escape_string(const wcstring &in, escape_flags_t flags)
|
||||
@@ -1122,8 +1134,8 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Here's the character we'll ultimately append. Note that L'\0' is a valid thing to append. */
|
||||
wchar_t result_char = NOT_A_WCHAR;
|
||||
/* Here's the character we'll ultimately append, or NOT_A_WCHAR for none. Note that L'\0' is a valid thing to append. */
|
||||
wint_t result_char_or_none = NOT_A_WCHAR;
|
||||
|
||||
bool errored = false;
|
||||
size_t in_pos = 1; //in_pos always tracks the next character to read (and therefore the number of characters read so far)
|
||||
@@ -1131,7 +1143,7 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
switch (c)
|
||||
{
|
||||
|
||||
/* A null character after a backslash is an error */
|
||||
/* A null character after a backslash is an error */
|
||||
case L'\0':
|
||||
{
|
||||
/* Adjust in_pos to only include the backslash */
|
||||
@@ -1178,11 +1190,11 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
{
|
||||
chars=8;
|
||||
max_val = WCHAR_MAX;
|
||||
|
||||
|
||||
// Don't exceed the largest Unicode code point - see #1107
|
||||
if (0x10FFFF < max_val)
|
||||
max_val = (wchar_t)0x10FFFF;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1225,7 +1237,7 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
|
||||
if (res <= max_val)
|
||||
{
|
||||
result_char = (wchar_t)((byte_literal ? ENCODE_DIRECT_BASE : 0)+res);
|
||||
result_char_or_none = (wchar_t)((byte_literal ? ENCODE_DIRECT_BASE : 0)+res);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1238,14 +1250,14 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
/* \a means bell (alert) */
|
||||
case L'a':
|
||||
{
|
||||
result_char = L'\a';
|
||||
result_char_or_none = L'\a';
|
||||
break;
|
||||
}
|
||||
|
||||
/* \b means backspace */
|
||||
case L'b':
|
||||
{
|
||||
result_char = L'\b';
|
||||
result_char_or_none = L'\b';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1255,11 +1267,11 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
const wchar_t sequence_char = input[in_pos++];
|
||||
if (sequence_char >= L'a' && sequence_char <= (L'a'+32))
|
||||
{
|
||||
result_char = sequence_char-L'a'+1;
|
||||
result_char_or_none = sequence_char-L'a'+1;
|
||||
}
|
||||
else if (sequence_char >= L'A' && sequence_char <= (L'A'+32))
|
||||
{
|
||||
result_char = sequence_char-L'A'+1;
|
||||
result_char_or_none = sequence_char-L'A'+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1271,7 +1283,7 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
/* \x1b means escape */
|
||||
case L'e':
|
||||
{
|
||||
result_char = L'\x1b';
|
||||
result_char_or_none = L'\x1b';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1280,7 +1292,7 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
*/
|
||||
case L'f':
|
||||
{
|
||||
result_char = L'\f';
|
||||
result_char_or_none = L'\f';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1289,7 +1301,7 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
*/
|
||||
case L'n':
|
||||
{
|
||||
result_char = L'\n';
|
||||
result_char_or_none = L'\n';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1298,7 +1310,7 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
*/
|
||||
case L'r':
|
||||
{
|
||||
result_char = L'\r';
|
||||
result_char_or_none = L'\r';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1307,7 +1319,7 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
*/
|
||||
case L't':
|
||||
{
|
||||
result_char = L'\t';
|
||||
result_char_or_none = L'\t';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1316,14 +1328,14 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
*/
|
||||
case L'v':
|
||||
{
|
||||
result_char = L'\v';
|
||||
result_char_or_none = L'\v';
|
||||
break;
|
||||
}
|
||||
|
||||
/* If a backslash is followed by an actual newline, swallow them both */
|
||||
case L'\n':
|
||||
{
|
||||
result_char = NOT_A_WCHAR;
|
||||
result_char_or_none = NOT_A_WCHAR;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1331,13 +1343,16 @@ static size_t read_unquoted_escape(const wchar_t *input, wcstring *result, bool
|
||||
{
|
||||
if (unescape_special)
|
||||
result->push_back(INTERNAL_SEPARATOR);
|
||||
result_char = c;
|
||||
result_char_or_none = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! errored && result_char != NOT_A_WCHAR)
|
||||
if (! errored && result_char_or_none != NOT_A_WCHAR)
|
||||
{
|
||||
wchar_t result_char = static_cast<wchar_t>(result_char_or_none);
|
||||
// if result_char is not NOT_A_WCHAR, it must be a valid wchar
|
||||
assert((wint_t)result_char == result_char_or_none);
|
||||
result->push_back(result_char);
|
||||
}
|
||||
return errored ? 0 : in_pos;
|
||||
@@ -1367,7 +1382,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
{
|
||||
const wchar_t c = input[input_position];
|
||||
/* Here's the character we'll append to result, or NOT_A_WCHAR to suppress it */
|
||||
wchar_t to_append = c;
|
||||
wint_t to_append_or_none = c;
|
||||
if (mode == mode_unquoted)
|
||||
{
|
||||
|
||||
@@ -1389,7 +1404,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
input_position += escape_chars - 1;
|
||||
}
|
||||
/* We've already appended, don't append anything else */
|
||||
to_append = NOT_A_WCHAR;
|
||||
to_append_or_none = NOT_A_WCHAR;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1397,7 +1412,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
{
|
||||
if (unescape_special && (input_position == 0))
|
||||
{
|
||||
to_append = HOME_DIRECTORY;
|
||||
to_append_or_none = HOME_DIRECTORY;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1406,7 +1421,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
{
|
||||
if (unescape_special && (input_position == 0))
|
||||
{
|
||||
to_append = PROCESS_EXPAND;
|
||||
to_append_or_none = PROCESS_EXPAND;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1420,11 +1435,11 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
{
|
||||
assert(result.size() > 0);
|
||||
result.resize(result.size() - 1);
|
||||
to_append = ANY_STRING_RECURSIVE;
|
||||
to_append_or_none = ANY_STRING_RECURSIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
to_append = ANY_STRING;
|
||||
to_append_or_none = ANY_STRING;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1434,7 +1449,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
{
|
||||
if (unescape_special)
|
||||
{
|
||||
to_append = ANY_CHAR;
|
||||
to_append_or_none = ANY_CHAR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1443,7 +1458,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
{
|
||||
if (unescape_special)
|
||||
{
|
||||
to_append = VARIABLE_EXPAND;
|
||||
to_append_or_none = VARIABLE_EXPAND;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1453,7 +1468,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
if (unescape_special)
|
||||
{
|
||||
bracket_count++;
|
||||
to_append = BRACKET_BEGIN;
|
||||
to_append_or_none = BRACKET_BEGIN;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1463,7 +1478,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
if (unescape_special)
|
||||
{
|
||||
bracket_count--;
|
||||
to_append = BRACKET_END;
|
||||
to_append_or_none = BRACKET_END;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1473,7 +1488,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
/* If the last character was a separator, then treat this as a literal comma */
|
||||
if (unescape_special && bracket_count > 0 && string_last_char(result) != BRACKET_SEP)
|
||||
{
|
||||
to_append = BRACKET_SEP;
|
||||
to_append_or_none = BRACKET_SEP;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1481,14 +1496,14 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
case L'\'':
|
||||
{
|
||||
mode = mode_single_quotes;
|
||||
to_append = unescape_special ? INTERNAL_SEPARATOR : NOT_A_WCHAR;
|
||||
to_append_or_none = unescape_special ? INTERNAL_SEPARATOR : NOT_A_WCHAR;
|
||||
break;
|
||||
}
|
||||
|
||||
case L'\"':
|
||||
{
|
||||
mode = mode_double_quotes;
|
||||
to_append = unescape_special ? INTERNAL_SEPARATOR : NOT_A_WCHAR;
|
||||
to_append_or_none = unescape_special ? INTERNAL_SEPARATOR : NOT_A_WCHAR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1503,7 +1518,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
case '\\':
|
||||
case L'\'':
|
||||
{
|
||||
to_append = input[input_position + 1];
|
||||
to_append_or_none = input[input_position + 1];
|
||||
input_position += 1; /* Skip over the backslash */
|
||||
break;
|
||||
}
|
||||
@@ -1520,7 +1535,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
// 'We may ever escape a NULL character, but still appending a \ in case I am wrong.'
|
||||
// Not sure what it means or the importance of this
|
||||
input_position += 1; /* Skip over the backslash */
|
||||
to_append = L'\\';
|
||||
to_append_or_none = L'\\';
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1534,7 +1549,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
}
|
||||
else if (c == L'\'')
|
||||
{
|
||||
to_append = unescape_special ? INTERNAL_SEPARATOR : NOT_A_WCHAR;
|
||||
to_append_or_none = unescape_special ? INTERNAL_SEPARATOR : NOT_A_WCHAR;
|
||||
mode = mode_unquoted;
|
||||
}
|
||||
}
|
||||
@@ -1545,7 +1560,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
case L'"':
|
||||
{
|
||||
mode = mode_unquoted;
|
||||
to_append = unescape_special ? INTERNAL_SEPARATOR : NOT_A_WCHAR;
|
||||
to_append_or_none = unescape_special ? INTERNAL_SEPARATOR : NOT_A_WCHAR;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1561,7 +1576,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
}
|
||||
else
|
||||
{
|
||||
to_append = L'\0';
|
||||
to_append_or_none = L'\0';
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1570,7 +1585,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
case L'$':
|
||||
case '"':
|
||||
{
|
||||
to_append = input[input_position + 1];
|
||||
to_append_or_none = input[input_position + 1];
|
||||
input_position += 1; /* Skip over the backslash */
|
||||
break;
|
||||
}
|
||||
@@ -1578,7 +1593,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
case '\n':
|
||||
{
|
||||
/* Swallow newline */
|
||||
to_append = NOT_A_WCHAR;
|
||||
to_append_or_none = NOT_A_WCHAR;
|
||||
input_position += 1; /* Skip over the backslash */
|
||||
break;
|
||||
}
|
||||
@@ -1596,7 +1611,7 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
{
|
||||
if (unescape_special)
|
||||
{
|
||||
to_append = VARIABLE_EXPAND_SINGLE;
|
||||
to_append_or_none = VARIABLE_EXPAND_SINGLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1605,9 +1620,12 @@ static bool unescape_string_internal(const wchar_t * const input, const size_t i
|
||||
}
|
||||
|
||||
/* Now maybe append the char */
|
||||
if (to_append != NOT_A_WCHAR)
|
||||
if (to_append_or_none != NOT_A_WCHAR)
|
||||
{
|
||||
result.push_back(to_append);
|
||||
wchar_t to_append_char = static_cast<wchar_t>(to_append_or_none);
|
||||
// if result_char is not NOT_A_WCHAR, it must be a valid wchar
|
||||
assert((wint_t)to_append_char == to_append_or_none);
|
||||
result.push_back(to_append_char);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1650,39 +1668,60 @@ bool unescape_string(const wcstring &input, wcstring *output, unescape_flags_t e
|
||||
|
||||
void common_handle_winch(int signal)
|
||||
{
|
||||
#ifdef HAVE_WINSIZE
|
||||
if (ioctl(1,TIOCGWINSZ,&termsize)!=0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#else
|
||||
termsize.ws_col = 80;
|
||||
termsize.ws_row = 24;
|
||||
/* don't run ioctl() here, it's not safe to use in signals */
|
||||
termsize_valid = false;
|
||||
}
|
||||
|
||||
/* updates termsize as needed, and returns a copy of the winsize. */
|
||||
static struct winsize get_current_winsize()
|
||||
{
|
||||
#ifndef HAVE_WINSIZE
|
||||
struct winsize retval = {0};
|
||||
retval.ws_col = 80;
|
||||
retval.ws_row = 24;
|
||||
return retval;
|
||||
#endif
|
||||
scoped_rwlock guard(termsize_rwlock, true);
|
||||
struct winsize retval = termsize;
|
||||
if (!termsize_valid)
|
||||
{
|
||||
struct winsize size;
|
||||
if (ioctl(1,TIOCGWINSZ,&size) == 0)
|
||||
{
|
||||
retval = size;
|
||||
guard.upgrade();
|
||||
termsize = retval;
|
||||
}
|
||||
termsize_valid = true;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int common_get_width()
|
||||
{
|
||||
return termsize.ws_col;
|
||||
return get_current_winsize().ws_col;
|
||||
}
|
||||
|
||||
|
||||
int common_get_height()
|
||||
{
|
||||
return termsize.ws_row;
|
||||
return get_current_winsize().ws_row;
|
||||
}
|
||||
|
||||
void tokenize_variable_array(const wcstring &val, std::vector<wcstring> &out)
|
||||
{
|
||||
size_t pos = 0, end = val.size();
|
||||
while (pos < end)
|
||||
while (pos <= end)
|
||||
{
|
||||
size_t next_pos = val.find(ARRAY_SEP, pos);
|
||||
if (next_pos == wcstring::npos) break;
|
||||
out.push_back(val.substr(pos, next_pos - pos));
|
||||
pos = next_pos + 1; //skip the separator
|
||||
if (next_pos == wcstring::npos)
|
||||
{
|
||||
next_pos = end;
|
||||
}
|
||||
out.resize(out.size() + 1);
|
||||
out.back().assign(val, pos, next_pos - pos);
|
||||
pos = next_pos + 1; //skip the separator, or skip past the end
|
||||
}
|
||||
out.push_back(val.substr(pos, end - pos));
|
||||
}
|
||||
|
||||
bool string_prefixes_string(const wchar_t *proposed_prefix, const wcstring &value)
|
||||
@@ -1956,7 +1995,7 @@ void format_size_safe(char buff[128], unsigned long long sz)
|
||||
{
|
||||
const size_t buff_size = 128;
|
||||
const size_t max_len = buff_size - 1; //need to leave room for a null terminator
|
||||
bzero(buff, buff_size);
|
||||
memset(buff, 0, buff_size);
|
||||
size_t idx = 0;
|
||||
const char * const sz_name[]=
|
||||
{
|
||||
@@ -2105,7 +2144,7 @@ static pid_t initial_foreground_process_group = -1;
|
||||
|
||||
bool is_forked_child(void)
|
||||
{
|
||||
/* Just bail if nobody's called setup_fork_guards - e.g. fishd */
|
||||
/* Just bail if nobody's called setup_fork_guards, e.g. some of our tools */
|
||||
if (! initial_pid) return false;
|
||||
|
||||
bool is_child_of_fork = (getpid() != initial_pid);
|
||||
@@ -2184,7 +2223,7 @@ void scoped_lock::lock(void)
|
||||
{
|
||||
assert(! locked);
|
||||
assert(! is_forked_child());
|
||||
VOMIT_ON_FAILURE(pthread_mutex_lock(lock_obj));
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_mutex_lock(lock_obj));
|
||||
locked = true;
|
||||
}
|
||||
|
||||
@@ -2192,7 +2231,7 @@ void scoped_lock::unlock(void)
|
||||
{
|
||||
assert(locked);
|
||||
assert(! is_forked_child());
|
||||
VOMIT_ON_FAILURE(pthread_mutex_unlock(lock_obj));
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_mutex_unlock(lock_obj));
|
||||
locked = false;
|
||||
}
|
||||
|
||||
@@ -2201,11 +2240,94 @@ scoped_lock::scoped_lock(pthread_mutex_t &mutex) : lock_obj(&mutex), locked(fals
|
||||
this->lock();
|
||||
}
|
||||
|
||||
scoped_lock::scoped_lock(mutex_lock_t &lock) : lock_obj(&lock.mutex), locked(false)
|
||||
{
|
||||
this->lock();
|
||||
}
|
||||
|
||||
scoped_lock::~scoped_lock()
|
||||
{
|
||||
if (locked) this->unlock();
|
||||
}
|
||||
|
||||
void scoped_rwlock::lock(void)
|
||||
{
|
||||
assert(! (locked || locked_shared));
|
||||
assert(! is_forked_child());
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_rdlock(rwlock_obj));
|
||||
locked = true;
|
||||
}
|
||||
|
||||
void scoped_rwlock::unlock(void)
|
||||
{
|
||||
assert(locked);
|
||||
assert(! is_forked_child());
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_unlock(rwlock_obj));
|
||||
locked = false;
|
||||
}
|
||||
|
||||
void scoped_rwlock::lock_shared(void)
|
||||
{
|
||||
assert(! (locked || locked_shared));
|
||||
assert(! is_forked_child());
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_wrlock(rwlock_obj));
|
||||
locked_shared = true;
|
||||
}
|
||||
|
||||
void scoped_rwlock::unlock_shared(void)
|
||||
{
|
||||
assert(locked_shared);
|
||||
assert(! is_forked_child());
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_unlock(rwlock_obj));
|
||||
locked_shared = false;
|
||||
}
|
||||
|
||||
void scoped_rwlock::upgrade(void)
|
||||
{
|
||||
assert(locked_shared);
|
||||
assert(! is_forked_child());
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_unlock(rwlock_obj));
|
||||
locked = false;
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_wrlock(rwlock_obj));
|
||||
locked_shared = true;
|
||||
}
|
||||
|
||||
scoped_rwlock::scoped_rwlock(pthread_rwlock_t &rwlock, bool shared) : rwlock_obj(&rwlock), locked(false), locked_shared(false)
|
||||
{
|
||||
if (shared)
|
||||
{
|
||||
this->lock_shared();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->lock();
|
||||
}
|
||||
}
|
||||
|
||||
scoped_rwlock::scoped_rwlock(rwlock_t &rwlock, bool shared) : rwlock_obj(&rwlock.rwlock), locked(false), locked_shared(false)
|
||||
{
|
||||
if (shared)
|
||||
{
|
||||
this->lock_shared();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->lock();
|
||||
}
|
||||
}
|
||||
|
||||
scoped_rwlock::~scoped_rwlock()
|
||||
{
|
||||
if (locked)
|
||||
{
|
||||
this->unlock();
|
||||
}
|
||||
else if (locked_shared)
|
||||
{
|
||||
this->unlock_shared();
|
||||
}
|
||||
}
|
||||
|
||||
wcstokenizer::wcstokenizer(const wcstring &s, const wcstring &separator) :
|
||||
buffer(),
|
||||
str(),
|
||||
|
||||
157
common.h
157
common.h
@@ -59,6 +59,9 @@ typedef std::vector<wcstring> wcstring_list_t;
|
||||
*/
|
||||
#define BYTE_MAX 0xffu
|
||||
|
||||
/** BOM value */
|
||||
#define UTF8_BOM_WCHAR 0xFEFFu
|
||||
|
||||
/* Flags for unescape_string functions */
|
||||
enum
|
||||
{
|
||||
@@ -87,10 +90,47 @@ enum
|
||||
};
|
||||
typedef unsigned int escape_flags_t;
|
||||
|
||||
/* Directions */
|
||||
enum selection_direction_t
|
||||
{
|
||||
/* visual directions */
|
||||
direction_north,
|
||||
direction_east,
|
||||
direction_south,
|
||||
direction_west,
|
||||
direction_page_north,
|
||||
direction_page_south,
|
||||
|
||||
/* logical directions */
|
||||
direction_next,
|
||||
direction_prev,
|
||||
|
||||
/* special value that means deselect */
|
||||
direction_deselect
|
||||
};
|
||||
|
||||
inline bool selection_direction_is_cardinal(selection_direction_t dir)
|
||||
{
|
||||
switch (dir)
|
||||
{
|
||||
case direction_north:
|
||||
case direction_page_north:
|
||||
case direction_east:
|
||||
case direction_page_south:
|
||||
case direction_south:
|
||||
case direction_west:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Helper macro for errors
|
||||
*/
|
||||
#define VOMIT_ON_FAILURE(a) do { if (0 != (a)) { int err = errno; fprintf(stderr, "%s failed on line %d in file %s: %d (%s)\n", #a, __LINE__, __FILE__, err, strerror(err)); abort(); }} while (0)
|
||||
#define VOMIT_ON_FAILURE(a) do { if (0 != (a)) { VOMIT_ABORT(errno, #a); } } while (0)
|
||||
#define VOMIT_ON_FAILURE_NO_ERRNO(a) do { int err = (a); if (0 != err) { VOMIT_ABORT(err, #a); } } while (0)
|
||||
#define VOMIT_ABORT(err, str) do { int code = (err); fprintf(stderr, "%s failed on line %d in file %s: %d (%s)\n", str, __LINE__, __FILE__, code, strerror(code)); abort(); } while(0)
|
||||
|
||||
/** Exits without invoking destructors (via _exit), useful for code after fork. */
|
||||
void exit_without_destructors(int code) __attribute__((noreturn));
|
||||
@@ -118,7 +158,7 @@ extern int debug_level;
|
||||
/**
|
||||
Profiling flag. True if commands should be profiled.
|
||||
*/
|
||||
extern char *profile;
|
||||
extern bool g_profiling_active;
|
||||
|
||||
/**
|
||||
Name of the current program. Should be set at startup. Used by the
|
||||
@@ -126,6 +166,10 @@ extern char *profile;
|
||||
*/
|
||||
extern const wchar_t *program_name;
|
||||
|
||||
/* Variants of read() and write() that ignores return values, defeating a warning */
|
||||
void read_ignore(int fd, void *buff, size_t count);
|
||||
void write_ignore(int fd, const void *buff, size_t count);
|
||||
|
||||
/**
|
||||
This macro is used to check that an input argument is not null. It
|
||||
is a bit lika a non-fatal form of assert. Instead of exit-ing on
|
||||
@@ -149,10 +193,10 @@ extern const wchar_t *program_name;
|
||||
*/
|
||||
#define FATAL_EXIT() \
|
||||
{ \
|
||||
char exit_read_buff; \
|
||||
show_stackframe(); \
|
||||
read( 0, &exit_read_buff, 1 ); \
|
||||
exit_without_destructors( 1 ); \
|
||||
char exit_read_buff; \
|
||||
show_stackframe(); \
|
||||
read_ignore( 0, &exit_read_buff, 1 ); \
|
||||
exit_without_destructors( 1 ); \
|
||||
} \
|
||||
|
||||
|
||||
@@ -197,7 +241,7 @@ extern const wchar_t *program_name;
|
||||
/**
|
||||
Check if the specified string element is a part of the specified string list
|
||||
*/
|
||||
#define contains( str,... ) contains_internal( str, __VA_ARGS__, NULL )
|
||||
#define contains( str, ... ) contains_internal( str, 0, __VA_ARGS__, NULL )
|
||||
|
||||
/**
|
||||
Print a stack trace to stderr
|
||||
@@ -348,8 +392,8 @@ void format_size_safe(char buff[128], unsigned long long sz);
|
||||
void debug_safe(int level, const char *msg, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL, const char *param5 = NULL, const char *param6 = NULL, const char *param7 = NULL, const char *param8 = NULL, const char *param9 = NULL, const char *param10 = NULL, const char *param11 = NULL, const char *param12 = NULL);
|
||||
|
||||
/** Writes out a long safely */
|
||||
void format_long_safe(char buff[128], long val);
|
||||
void format_long_safe(wchar_t buff[128], long val);
|
||||
void format_long_safe(char buff[64], long val);
|
||||
void format_long_safe(wchar_t buff[64], long val);
|
||||
|
||||
|
||||
template<typename T>
|
||||
@@ -502,6 +546,22 @@ class narrow_string_rep_t
|
||||
|
||||
bool is_forked_child();
|
||||
|
||||
|
||||
class mutex_lock_t
|
||||
{
|
||||
public:
|
||||
pthread_mutex_t mutex;
|
||||
mutex_lock_t()
|
||||
{
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_mutex_init(&mutex, NULL));
|
||||
}
|
||||
|
||||
~mutex_lock_t()
|
||||
{
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_mutex_destroy(&mutex));
|
||||
}
|
||||
};
|
||||
|
||||
/* Basic scoped lock class */
|
||||
class scoped_lock
|
||||
{
|
||||
@@ -516,9 +576,52 @@ class scoped_lock
|
||||
void lock(void);
|
||||
void unlock(void);
|
||||
scoped_lock(pthread_mutex_t &mutex);
|
||||
scoped_lock(mutex_lock_t &lock);
|
||||
~scoped_lock();
|
||||
};
|
||||
|
||||
class rwlock_t
|
||||
{
|
||||
public:
|
||||
pthread_rwlock_t rwlock;
|
||||
rwlock_t()
|
||||
{
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_init(&rwlock, NULL));
|
||||
}
|
||||
|
||||
~rwlock_t()
|
||||
{
|
||||
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_destroy(&rwlock));
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Scoped lock class for rwlocks
|
||||
*/
|
||||
class scoped_rwlock
|
||||
{
|
||||
pthread_rwlock_t *rwlock_obj;
|
||||
bool locked;
|
||||
bool locked_shared;
|
||||
|
||||
/* No copying */
|
||||
scoped_rwlock &operator=(const scoped_lock &);
|
||||
scoped_rwlock(const scoped_lock &);
|
||||
|
||||
public:
|
||||
void lock(void);
|
||||
void unlock(void);
|
||||
void lock_shared(void);
|
||||
void unlock_shared(void);
|
||||
/*
|
||||
upgrade shared lock to exclusive.
|
||||
equivalent to `lock.unlock_shared(); lock.lock();`
|
||||
*/
|
||||
void upgrade(void);
|
||||
scoped_rwlock(pthread_rwlock_t &rwlock, bool shared = false);
|
||||
scoped_rwlock(rwlock_t &rwlock, bool shared = false);
|
||||
~scoped_rwlock();
|
||||
};
|
||||
|
||||
/**
|
||||
A scoped manager to save the current value of some variable, and optionally
|
||||
@@ -586,19 +689,13 @@ wcstring vformat_string(const wchar_t *format, va_list va_orig);
|
||||
void append_format(wcstring &str, const wchar_t *format, ...);
|
||||
void append_formatv(wcstring &str, const wchar_t *format, va_list ap);
|
||||
|
||||
/**
|
||||
Returns a newly allocated wide character string array equivalent of
|
||||
the specified multibyte character string array
|
||||
*/
|
||||
char **wcsv2strv(const wchar_t * const *in);
|
||||
|
||||
/**
|
||||
Test if the given string is a valid variable name.
|
||||
|
||||
\return null if this is a valid name, and a pointer to the first invalid character otherwise
|
||||
*/
|
||||
|
||||
wchar_t *wcsvarname(const wchar_t *str);
|
||||
const wchar_t *wcsvarname(const wchar_t *str);
|
||||
|
||||
|
||||
/**
|
||||
@@ -612,16 +709,18 @@ const wchar_t *wcsfuncname(const wchar_t *str);
|
||||
/**
|
||||
Test if the given string is valid in a variable name
|
||||
|
||||
\return 1 if this is a valid name, 0 otherwise
|
||||
\return true if this is a valid name, false otherwise
|
||||
*/
|
||||
|
||||
int wcsvarchr(wchar_t chr);
|
||||
|
||||
bool wcsvarchr(wchar_t chr);
|
||||
|
||||
/**
|
||||
A wcswidth workalike. Fish uses this since the regular wcswidth seems flaky.
|
||||
Convenience variants on fish_wcwswidth().
|
||||
|
||||
See fallback.h for the normal definitions.
|
||||
*/
|
||||
int my_wcswidth(const wchar_t *c);
|
||||
int fish_wcswidth(const wchar_t *str);
|
||||
int fish_wcswidth(const wcstring& str);
|
||||
|
||||
/**
|
||||
This functions returns the end of the quoted substring beginning at
|
||||
@@ -657,8 +756,8 @@ wcstring wsetlocale(int category, const wchar_t *locale);
|
||||
|
||||
\return zero if needle is not found, of if needle is null, non-zero otherwise
|
||||
*/
|
||||
__sentinel bool contains_internal(const wchar_t *needle, ...);
|
||||
__sentinel bool contains_internal(const wcstring &needle, ...);
|
||||
__sentinel bool contains_internal(const wchar_t *needle, int vararg_handle, ...);
|
||||
__sentinel bool contains_internal(const wcstring &needle, int vararg_handle, ...);
|
||||
|
||||
/**
|
||||
Call read while blocking the SIGCHLD signal. Should only be called
|
||||
@@ -701,16 +800,19 @@ ssize_t read_loop(int fd, void *buff, size_t count);
|
||||
void debug(int level, const char *msg, ...);
|
||||
void debug(int level, const wchar_t *msg, ...);
|
||||
|
||||
/** Writes a string to stderr, followed by a newline */
|
||||
void print_stderr(const wcstring &str);
|
||||
|
||||
/**
|
||||
Replace special characters with backslash escape sequences. Newline is
|
||||
replaced with \n, etc.
|
||||
|
||||
\param in The string to be escaped
|
||||
\param escape_all Whether all characters wich hold special meaning in fish (Pipe, semicolon, etc,) should be escaped, or only unprintable characters
|
||||
\return The escaped string, or 0 if there is not enough memory
|
||||
\param flags Flags to control the escaping
|
||||
\return The escaped string
|
||||
*/
|
||||
|
||||
wchar_t *escape(const wchar_t *in, escape_flags_t flags);
|
||||
wcstring escape(const wchar_t *in, escape_flags_t flags);
|
||||
wcstring escape_string(const wcstring &in, escape_flags_t flags);
|
||||
|
||||
/**
|
||||
@@ -811,6 +913,9 @@ void assert_is_not_forked_child(const char *who);
|
||||
#define ASSERT_IS_NOT_FORKED_CHILD_TRAMPOLINE(x) assert_is_not_forked_child(x)
|
||||
#define ASSERT_IS_NOT_FORKED_CHILD() ASSERT_IS_NOT_FORKED_CHILD_TRAMPOLINE(__FUNCTION__)
|
||||
|
||||
/** Macro to help suppress potentially unused variable warnings */
|
||||
#define USE(var) (void)(var)
|
||||
|
||||
extern "C" {
|
||||
__attribute__((noinline)) void debug_thread_error(void);
|
||||
}
|
||||
|
||||
710
complete.cpp
710
complete.cpp
File diff suppressed because it is too large
Load Diff
34
complete.h
34
complete.h
@@ -14,6 +14,7 @@
|
||||
|
||||
|
||||
#include <wchar.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "common.h"
|
||||
@@ -31,7 +32,7 @@
|
||||
#define NO_COMMON 2
|
||||
/**
|
||||
* Only use the argument list specifies with completion after
|
||||
* option. This is the same as (NO_FILES & NO_COMMON)
|
||||
* option. This is the same as (NO_FILES | NO_COMMON)
|
||||
*/
|
||||
#define EXCLUSIVE 3
|
||||
|
||||
@@ -54,13 +55,6 @@
|
||||
*/
|
||||
#define COMPLETE_SEP_STR L"\004"
|
||||
|
||||
/**
|
||||
* Separator between completion items in fish_pager. This is used for
|
||||
* completion grouping, e.g. when putting completions with the same
|
||||
* descriptions on the same line.
|
||||
*/
|
||||
#define COMPLETE_ITEM_SEP L'\uf500'
|
||||
|
||||
/**
|
||||
* Character that separates the completion and description on
|
||||
* programmable completions
|
||||
@@ -121,15 +115,17 @@ class completion_t
|
||||
The COMPLETE_NO_CASE can be used to signal that this completion
|
||||
is case insensitive.
|
||||
*/
|
||||
int flags;
|
||||
complete_flags_t flags;
|
||||
|
||||
/* Construction. Note: defining these so that they are not inlined reduces the executable size. */
|
||||
completion_t(const wcstring &comp, const wcstring &desc = L"", string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact), int flags_val = 0);
|
||||
completion_t(const wcstring &comp, const wcstring &desc = wcstring(), string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact), complete_flags_t flags_val = 0);
|
||||
completion_t(const completion_t &);
|
||||
completion_t &operator=(const completion_t &);
|
||||
|
||||
/* Compare two completions. No operating overlaoding to make this always explicit (there's potentially multiple ways to compare completions). */
|
||||
static bool is_alphabetically_less_than(const completion_t &a, const completion_t &b);
|
||||
|
||||
/* "Naturally less than" means in a natural ordering, where digits are treated as numbers. For example, foo10 is naturally greater than foo2 (but alphabetically less than it) */
|
||||
static bool is_naturally_less_than(const completion_t &a, const completion_t &b);
|
||||
static bool is_alphabetically_equal_to(const completion_t &a, const completion_t &b);
|
||||
};
|
||||
|
||||
@@ -142,9 +138,6 @@ enum
|
||||
};
|
||||
typedef uint32_t completion_request_flags_t;
|
||||
|
||||
/** Given a list of completions, returns a list of their completion fields */
|
||||
wcstring_list_t completions_to_wcstring_list(const std::vector<completion_t> &completions);
|
||||
|
||||
/**
|
||||
|
||||
Add a completion.
|
||||
@@ -213,7 +206,8 @@ void complete_set_authoritative(const wchar_t *cmd, bool cmd_type, bool authorit
|
||||
void complete_remove(const wchar_t *cmd,
|
||||
bool cmd_is_path,
|
||||
wchar_t short_opt,
|
||||
const wchar_t *long_opt);
|
||||
const wchar_t *long_opt,
|
||||
int long_mode);
|
||||
|
||||
|
||||
/** Find all completions of the command cmd, insert them into out.
|
||||
@@ -268,9 +262,17 @@ void complete_load(const wcstring &cmd, bool reload);
|
||||
\param flags completion flags
|
||||
|
||||
*/
|
||||
void append_completion(std::vector<completion_t> &completions, const wcstring &comp, const wcstring &desc = L"", int flags = 0, string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact));
|
||||
void append_completion(std::vector<completion_t> &completions, const wcstring &comp, const wcstring &desc = wcstring(), int flags = 0, string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact));
|
||||
|
||||
/* Function used for testing */
|
||||
void complete_set_variable_names(const wcstring_list_t *names);
|
||||
|
||||
/* Support for "wrap targets." A wrap target is a command that completes liek another command. The target chain is the sequence of wraps (A wraps B wraps C...). Any loops in the chain are silently ignored. */
|
||||
bool complete_add_wrapper(const wcstring &command, const wcstring &wrap_target);
|
||||
bool complete_remove_wrapper(const wcstring &command, const wcstring &wrap_target);
|
||||
wcstring_list_t complete_get_wrap_chain(const wcstring &command);
|
||||
|
||||
/* Wonky interface: returns all wraps. Even-values are the commands, odd values are the targets. */
|
||||
wcstring_list_t complete_get_wrap_pairs();
|
||||
|
||||
#endif
|
||||
|
||||
299
configure.ac
299
configure.ac
@@ -21,18 +21,9 @@ conf_arg=$@
|
||||
# List of output variables produced by this configure script
|
||||
#
|
||||
|
||||
AC_SUBST(docdir)
|
||||
AC_SUBST(HAVE_GETTEXT)
|
||||
AC_SUBST(HAVE_DOXYGEN)
|
||||
AC_SUBST(LDFLAGS_FISH)
|
||||
AC_SUBST(LIBS_FISH)
|
||||
AC_SUBST(LIBS_FISH_INDENT)
|
||||
AC_SUBST(LIBS_FISH_PAGER)
|
||||
AC_SUBST(LIBS_FISHD)
|
||||
AC_SUBST(LIBS_MIMEDB)
|
||||
AC_SUBST(localedir)
|
||||
AC_SUBST(optbindirs)
|
||||
AC_SUBST(prefix)
|
||||
|
||||
|
||||
#
|
||||
@@ -99,49 +90,11 @@ fi
|
||||
|
||||
AC_PROG_CXX([g++ c++])
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_SED
|
||||
AC_LANG(C++)
|
||||
|
||||
echo "CXXFLAGS: $CXXFLAGS"
|
||||
|
||||
#
|
||||
# Detect directories which may contain additional headers, libraries
|
||||
# and commands. This needs to be done early - before Autoconf starts
|
||||
# to mess with CXXFLAGS and all the other environemnt variables.
|
||||
#
|
||||
# This mostly helps OS X users, since fink usually installs out of
|
||||
# tree and doesn't update CXXFLAGS.
|
||||
#
|
||||
# It also helps FreeBSD which puts libiconv in /usr/local/lib
|
||||
|
||||
for i in /usr/pkg /sw /opt /opt/local /usr/local; do
|
||||
|
||||
AC_MSG_CHECKING([for $i/include include directory])
|
||||
if test -d $i/include; then
|
||||
AC_MSG_RESULT(yes)
|
||||
CXXFLAGS="$CXXFLAGS -I$i/include/"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for $i/lib library directory])
|
||||
if test -d $i/lib; then
|
||||
AC_MSG_RESULT(yes)
|
||||
LDFLAGS="$LDFLAGS -L$i/lib/"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for $i/bin command directory])
|
||||
if test -d $i/bin; then
|
||||
AC_MSG_RESULT(yes)
|
||||
optbindirs="$optbindirs $i/bin"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Tell autoconf to create config.h header
|
||||
#
|
||||
@@ -156,9 +109,11 @@ AC_CONFIG_HEADERS(config.h)
|
||||
AH_BOTTOM([#if __GNUC__ >= 3
|
||||
#define __warn_unused __attribute__ ((warn_unused_result))
|
||||
#define __sentinel __attribute__ ((sentinel))
|
||||
#define __packed __attribute__ ((packed))
|
||||
#else
|
||||
#define __warn_unused
|
||||
#define __sentinel
|
||||
#define __packed
|
||||
#endif])
|
||||
|
||||
|
||||
@@ -192,7 +147,7 @@ AS_IF([test x$local_gettext != xno],
|
||||
# Build/clean the documentation only if Doxygen is available
|
||||
#
|
||||
|
||||
doxygen_minimum=1.5
|
||||
doxygen_minimum=1.8.7
|
||||
|
||||
AC_ARG_WITH(
|
||||
doxygen,
|
||||
@@ -246,9 +201,10 @@ CXXFLAGS="$CXXFLAGS -fno-exceptions"
|
||||
|
||||
#
|
||||
# -Wall is there to keep me on my toes
|
||||
# But signed comparison warnings are way too aggressive
|
||||
#
|
||||
|
||||
CXXFLAGS="$CXXFLAGS -Wall"
|
||||
CXXFLAGS="$CXXFLAGS -Wall -Wno-sign-compare"
|
||||
|
||||
#
|
||||
# This is needed in order to get the really cool backtraces on Linux
|
||||
@@ -258,6 +214,16 @@ if test `uname` != "Darwin"; then
|
||||
LDFLAGS_FISH="$LDFLAGS_FISH -rdynamic"
|
||||
fi
|
||||
|
||||
#
|
||||
# On Cygwin, we need to add some flags for ncurses.
|
||||
#
|
||||
case `uname` in
|
||||
CYGWIN*)
|
||||
echo "adding flags for ncurses on Cygwin"
|
||||
CXXFLAGS="$CXXFLAGS -I/usr/include -I/usr/include/ncursesw"
|
||||
LDFLAGS_FISH="$LDFLAGS_FISH -L/usr/lib/ncursesw"
|
||||
;;
|
||||
esac
|
||||
|
||||
#
|
||||
# If we are compiling against glibc, set some flags to work around
|
||||
@@ -335,35 +301,6 @@ case $target_os in
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check for Solaris curses tputs having fixed length parameter list.
|
||||
AC_MSG_CHECKING([if we are using non varargs tparm.])
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[
|
||||
#include <curses.h>
|
||||
#include <term.h>
|
||||
],
|
||||
[
|
||||
tparm( "" );
|
||||
]
|
||||
)
|
||||
],
|
||||
[tparm_solaris_kludge=no],
|
||||
[tparm_solaris_kludge=yes]
|
||||
)
|
||||
if test "x$tparm_solaris_kludge" = "xyes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(
|
||||
[TPARM_SOLARIS_KLUDGE],
|
||||
[1],
|
||||
[Define to 1 if tparm accepts a fixed amount of paramters.]
|
||||
)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# BSD-specific flags go here
|
||||
#
|
||||
@@ -381,40 +318,6 @@ case $target_os in
|
||||
esac
|
||||
|
||||
|
||||
#
|
||||
# Set up PREFIX and related preprocessor symbols. Fish needs to know
|
||||
# where it will be installed. One of the reasons for this is so that
|
||||
# it can make sure the fish installation directory is in the path
|
||||
# during startup.
|
||||
#
|
||||
|
||||
if [[ "$prefix" = NONE ]]; then
|
||||
prefix=/usr/local
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Set up the directory where the documentation files should be
|
||||
# installed
|
||||
#
|
||||
|
||||
AC_ARG_VAR( [docdir], [Documentation directory] )
|
||||
|
||||
if test -z $docdir; then
|
||||
docdir=$datadir/doc/fish
|
||||
else
|
||||
docdir=$docdir
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Set up locale directory. This is where the .po files will be
|
||||
# installed.
|
||||
#
|
||||
|
||||
localedir=$datadir/locale
|
||||
|
||||
|
||||
#
|
||||
# See if Linux procfs is present. This is used to get extra
|
||||
# information about running processes.
|
||||
@@ -434,6 +337,9 @@ AC_DEFINE(
|
||||
[Define to 1 if the wgettext function should be used for translating strings.]
|
||||
)
|
||||
|
||||
# Disable curses macros that conflict with the STL
|
||||
AC_DEFINE([NCURSES_NOMACROS], [1], [Define to 1 to disable ncurses macros that conflict with the STL])
|
||||
AC_DEFINE([NOMACROS], [1], [Define to 1 to disable curses macros that conflict with the STL])
|
||||
|
||||
#
|
||||
# Check presense of various libraries. This is done on a per-binary
|
||||
@@ -445,63 +351,20 @@ AC_DEFINE(
|
||||
# Check for os dependant libraries for all binaries.
|
||||
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
|
||||
AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
|
||||
AC_SEARCH_LIBS( shm_open, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
|
||||
AC_SEARCH_LIBS( pthread_create, pthread, , [AC_MSG_ERROR([Cannot find the pthread library, needed to build this package.] )] )
|
||||
AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish. If this is Linux, try running 'sudo apt-get install libncurses5-dev' or 'sudo yum install ncurses-devel'])] )
|
||||
AC_SEARCH_LIBS( setupterm, [ncurses tinfo curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish. If this is Linux, try running 'sudo apt-get install libncurses5-dev' or 'sudo yum install ncurses-devel'])] )
|
||||
AC_SEARCH_LIBS( [nan], [m], [AC_DEFINE( [HAVE_NAN], [1], [Define to 1 if you have the nan function])] )
|
||||
|
||||
if test x$local_gettext != xno; then
|
||||
AC_SEARCH_LIBS( gettext, intl,,)
|
||||
fi
|
||||
|
||||
LIBS_SHARED=$LIBS
|
||||
|
||||
#
|
||||
# Check for libraries needed by fish.
|
||||
#
|
||||
|
||||
LIBS="$LIBS_SHARED"
|
||||
# Check for libiconv_open if we can't find iconv_open. Silly OS X does
|
||||
# weird macro magic for the sole purpose of amusing me.
|
||||
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_SEARCH_LIBS( libiconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )] )
|
||||
|
||||
LIBS_FISH=$LIBS
|
||||
|
||||
#
|
||||
# Check for libraries needed by fish_indent.
|
||||
#
|
||||
|
||||
LIBS="$LIBS_SHARED"
|
||||
LIBS_FISH_INDENT=$LIBS
|
||||
|
||||
#
|
||||
# Check for libraries needed by fish_pager.
|
||||
#
|
||||
|
||||
LIBS="$LIBS_SHARED"
|
||||
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_SEARCH_LIBS( libiconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )] )
|
||||
LIBS_FISH_PAGER=$LIBS
|
||||
|
||||
#
|
||||
# Check for libraries needed by fishd.
|
||||
#
|
||||
|
||||
LIBS="$LIBS_SHARED"
|
||||
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_SEARCH_LIBS( libiconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )] )
|
||||
LIBS_FISHD=$LIBS
|
||||
|
||||
#
|
||||
# Check for libraries needed by mimedb.
|
||||
#
|
||||
|
||||
LIBS="$LIBS_SHARED"
|
||||
LIBS_MIMEDB=$LIBS
|
||||
|
||||
|
||||
#
|
||||
# Check presense of various header files
|
||||
#
|
||||
|
||||
AC_CHECK_HEADERS([getopt.h termios.h sys/resource.h term.h ncurses/term.h ncurses.h curses.h stropts.h siginfo.h sys/select.h sys/ioctl.h execinfo.h spawn.h sys/sysctl.h])
|
||||
AC_CHECK_HEADERS([getopt.h termios.h sys/resource.h term.h ncurses/term.h ncurses.h ncurses/curses.h curses.h stropts.h siginfo.h sys/select.h sys/ioctl.h execinfo.h spawn.h sys/sysctl.h])
|
||||
|
||||
if test x$local_gettext != xno; then
|
||||
AC_CHECK_HEADERS([libintl.h])
|
||||
@@ -519,7 +382,6 @@ AC_CHECK_HEADER(
|
||||
[AC_MSG_ERROR([Could not find the header regex.h, needed to build fish])]
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# On some platforms (Solaris 10) adding -std=c99 in turn requires that
|
||||
# _POSIX_C_SOURCE be defined to 200112L otherwise several
|
||||
@@ -588,6 +450,10 @@ for i in "" "-D_POSIX_C_SOURCE=200112L" "-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=2
|
||||
/* As above (under at least Linux and FreeBSD). */
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
#include <termios.h>
|
||||
#endif
|
||||
],
|
||||
[
|
||||
/* Avert high-level optimisation, by making the program's
|
||||
@@ -634,6 +500,16 @@ if test ! x$local_found_posix_switch = xyes; then
|
||||
CXXFLAGS="$XCXXFLAGS"
|
||||
fi
|
||||
|
||||
#
|
||||
# Detect nanoseconds fields in struct stat
|
||||
#
|
||||
AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
|
||||
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
|
||||
|
||||
#
|
||||
# Check for D_TYPE in dirent, only on BSD and Linux
|
||||
#
|
||||
AC_STRUCT_DIRENT_D_TYPE
|
||||
|
||||
#
|
||||
# Check for presense of various functions used by fish
|
||||
@@ -641,7 +517,7 @@ fi
|
||||
|
||||
AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp fwprintf )
|
||||
AC_CHECK_FUNCS( futimes wcwidth wcswidth wcstok fputwc fgetwc )
|
||||
AC_CHECK_FUNCS( wcstol wcslcat wcslcpy lrand48_r killpg )
|
||||
AC_CHECK_FUNCS( wcstol wcslcat wcslcpy lrand48_r killpg mkostemp )
|
||||
AC_CHECK_FUNCS( backtrace backtrace_symbols sysconf getifaddrs )
|
||||
|
||||
if test x$local_gettext != xno; then
|
||||
@@ -733,7 +609,7 @@ AC_LINK_IFELSE(
|
||||
|
||||
#
|
||||
# If we have a fwprintf in libc, test that it actually works. As of
|
||||
# March 2006, it is broken under Dragonfly BSD.
|
||||
# March 2006, it is broken under DragonFly BSD.
|
||||
#
|
||||
|
||||
if test "$ac_cv_func_fwprintf" = yes; then
|
||||
@@ -818,6 +694,56 @@ else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Check for sys_errlist
|
||||
AC_MSG_CHECKING([for sys_errlist array])
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#include <stdio.h>
|
||||
],
|
||||
[
|
||||
const char *p;
|
||||
p = sys_errlist[sys_nerr];
|
||||
],
|
||||
have_sys_errlist=yes,
|
||||
have_sys_errlist=no
|
||||
)
|
||||
if test "$have_sys_errlist" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(
|
||||
[HAVE_SYS_ERRLIST],
|
||||
[1],
|
||||
[Define to 1 if the sys_errlist array is available.]
|
||||
)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Check for _sys_errs
|
||||
AC_MSG_CHECKING([for _sys_errs array])
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#include <string>
|
||||
],
|
||||
[
|
||||
std::string p;
|
||||
extern const char _sys_errs[];
|
||||
extern const int _sys_index[];
|
||||
p = _sys_errs[_sys_index[0]];
|
||||
],
|
||||
have__sys__errs=yes,
|
||||
have__sys__errs=no
|
||||
)
|
||||
if test "$have__sys__errs" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(
|
||||
[HAVE__SYS__ERRS],
|
||||
[1],
|
||||
[Define to 1 if the _sys_errs array is available.]
|
||||
)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Check if getopt_long exists and works
|
||||
AC_MSG_CHECKING([if getopt_long exists and works])
|
||||
AC_TRY_LINK(
|
||||
@@ -854,23 +780,42 @@ else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Check if del_curterm is broken - in that case we redefine
|
||||
# del_curterm as a no-op, to avoid a double-free
|
||||
# Check for Solaris curses tputs having fixed length parameter list.
|
||||
AC_MSG_CHECKING([if we are using non varargs tparm.])
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[
|
||||
#if HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
AC_MSG_CHECKING([If del_curterm is broken])
|
||||
case $target_os in
|
||||
*bsd*)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(
|
||||
[HAVE_BROKEN_DEL_CURTERM],
|
||||
[1],
|
||||
[del_curterm is broken, redefine it to a no-op to avoid a double-free bug]
|
||||
#if HAVE_TERM_H
|
||||
#include <term.h>
|
||||
#elif HAVE_NCURSES_TERM_H
|
||||
#include <ncurses/term.h>
|
||||
#endif
|
||||
],
|
||||
[
|
||||
tparm( "" );
|
||||
]
|
||||
)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[tparm_solaris_kludge=no],
|
||||
[tparm_solaris_kludge=yes]
|
||||
)
|
||||
if test "x$tparm_solaris_kludge" = "xyes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(
|
||||
[TPARM_SOLARIS_KLUDGE],
|
||||
[1],
|
||||
[Define to 1 if tparm accepts a fixed amount of paramters.]
|
||||
)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Tell the world what we know
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
|
||||
262
doc_src/FORMATTING.md
Normal file
262
doc_src/FORMATTING.md
Normal file
@@ -0,0 +1,262 @@
|
||||
# Formatting guide for fish docs
|
||||
|
||||
The fish documentation has been updated to support Doxygen 1.8.7+, and while the main benefit of this change is extensive Markdown support, the addition of a fish lexicon and syntax filter, combined with semantic markup rules allows for automatic formatting enhancements across the HTML user_docs, the developer docs and the man pages.
|
||||
|
||||
Initially my motivation was to fix a problem with long options ([Issue #1557](https://github.com/fish-shell/fish-shell/issues/1557) on GitHub), but as I worked on fixing the issue I realised there was an opportunity to simplify, reinforce and clarify the current documentation, hopefully making further contribution easier and cleaner, while allowing the documentation examples to presented more clearly with less author effort.
|
||||
|
||||
While the documentation is pretty robust to variations in the documentation source, adherence to the following style guide will help keep the already excellent documention in good shape moving forward.
|
||||
|
||||
## Line breaks and wrapping
|
||||
|
||||
Contrary to the rest of the fish source code, the documentation greatly benefits from the use of long lines and soft wrapping. It allows paragraphs to be treated as complete blocks by Doxygen, means that the semantic filter can see complete lines when deciding on how to apply syntax highlighting, and means that man pages will consistently wrap to the width of the users console in advanced pagers, such as 'most'.
|
||||
|
||||
## Doxygen special commands and aliases
|
||||
|
||||
While Markdown syntax forms the basis of the documentation content, there are some exceptions that require the use of Doxygen special commands. On the whole, Doxygen commands should be avoided, especially inline word formatting such as \\c as this would allow Doxygen to make unhelpful assumptions, such as converting double dashes (\--) to n-dashes (–).
|
||||
|
||||
### Structure: \\page, \\section and \\subsection
|
||||
|
||||
Use of Doxygen sections markers are important, as these determine what will be eventually output as a web page, man page or included in the developer docs.
|
||||
|
||||
Currently the make process for the documentation is quite convoluted, but basically the HTML docs are produced from a single, compiled file, doc.h. This contains a number of \\page markers that produce the various pages used in the documentation. The format of a \\page mark is:
|
||||
|
||||
\page universally_unique_page_id Page title
|
||||
|
||||
The source files that contain the page markers are currently:
|
||||
|
||||
- __index.hdr.in__: Core documentation
|
||||
- __commands.hdr.in__: Individual commands
|
||||
- __tutorial.hdr__: Tutorial
|
||||
- __design.hdr__: Design document
|
||||
- __faq.hdr__: Frequently Asked Questions
|
||||
- __license.hdr__: Fish and 3rd party licences
|
||||
|
||||
Unless there is a _VERY_ good reason and developer consensus, new pages should never be added.
|
||||
|
||||
The rest of the documentation is structured using \\section and \\subsection markers. Most of the source files (listed above) contain their full content, the exception being commands, which are separated out into source text files in the doc_src directory. These files are concatenated into one file, so each one starts with a \\section declaration. The synopsis, description and examples (if present) are declared as \\subsections. The format of these marks is practically identical to the page mark.
|
||||
|
||||
\section universally_unique_section_id Section title
|
||||
\subsection universally_unique_subsection_id Subsection title
|
||||
|
||||
Each page, section and subsection id _must_ be unique across the whole of the documentation, otherwise Doxygen will issue a warning.
|
||||
|
||||
### Semantic markup: the \\fish .. \\endfish block
|
||||
|
||||
While Doxygen has support for \\code..\\endcode blocks with enhanced markup and syntax colouring, it only understands the core Doxygen languages: C, C++, Objective C, Java, PHP, Python, Tcl and Fortran. To enhance Fish's syntax presentation, use the special \\fish..\\endfish blocks instead.
|
||||
|
||||
Text placed in this block will be parsed by Doxygen using the included lexicon filter (see lexicon_filter.in) as a Doxygen input filter. The filter is built during make so that it can pick up information on builtins, functions and shell commands mentioned in completions and apply markup to keywords found inside the \\fish block.
|
||||
|
||||
Basically, preformatted plain text inside the \\fish block is fed through the filter and is returned marked up so that Doxygen aliases can convert it back to a presentable form, according to the output document type.
|
||||
|
||||
For instance:
|
||||
|
||||
`echo hello world`
|
||||
|
||||
is transformed into:
|
||||
|
||||
`@cmnd{echo} @args{hello} @args{world}`
|
||||
|
||||
which is then transformed by Doxygen into an HTML version (`make user_doc`):
|
||||
|
||||
`<span class="command">echo</span> <span class="argument">hello</span> <span class="argument">world</span>`
|
||||
|
||||
A man page version (`make share/man`):
|
||||
|
||||
__echo__ hello world
|
||||
|
||||
And a simple HTML version for the developer docs (`make doc`) and the LATEX/PDF manual (`make doc/refman.pdf`):
|
||||
|
||||
`echo hello world`
|
||||
|
||||
### Fonts
|
||||
|
||||
In older browsers, it was easy to set the fonts used for the three basic type styles (serif, sans-serif and monospace). Modern browsers have removed these options in their respective quests for simplification, assuming the content author will provide suitable styles for the content in the site's CSS, or the end user will provide overriding styles manually. Doxygen's default styling is very simple and most users will just accept this default.
|
||||
|
||||
I've tried to use a sensible set of fonts in the documentation's CSS based on 'good' terminal fonts and as a result the firt preference font used throughout the documentation is '[DejaVu](http://dejavu-fonts.org)'. The rationale behaind this is that while DejaVu is getting a little long in the tooth, it still provides the most complete support across serif, sans-serif and monospace styles (giving a well balanced feel and consistent [x-height](http://en.wikipedia.org/wiki/X-height)), has the widest support for extended Unicode characters and has a free, permissive licenses (though it's still incompatible with GPLv2, though arguably less so than the SIL Open Font license, though this is a moot point when using it solely in the docs).
|
||||
|
||||
#### Fonts inside \\fish blocks and \`backticks\`
|
||||
|
||||
As the point of these contructs is to make fish's syntax clearer to the user, it makes sense to mimic what the user will see in the console, therefore any content is formatted using the monospaced style, specifically monospaced fonts are chosen in the following order:
|
||||
|
||||
1. __DejaVu Sans Mono__: Explained above. [[↓](http://dejavu-fonts.org)]
|
||||
2. __Source Code Pro__: Monospaced code font, part of Adobe's free Edge Web Fonts. [[↓](https://edgewebfonts.adobe.com)]
|
||||
3. __Menlo__: Apple supplied variant of DejaVu.
|
||||
4. __Ubuntu Mono__: Ubuntu Linux's default monospaced font. [[↓](http://font.ubuntu.com)]
|
||||
5. __Consolas__: Modern Microsoft supplied console font.
|
||||
6. __Monaco__: Apple supplied console font since 1984!
|
||||
7. __Lucida Console__: Generic mono terminal font, standard in many OS's and distros.
|
||||
8. __monospace__: Catchall style. Chooses default monospaced font, often Courier.
|
||||
9. __fixed__: As above, more often used on mobile devices.
|
||||
|
||||
#### General Fonts
|
||||
|
||||
1. __DejaVu Sans__: As above.[[↓](http://dejavu-fonts.org)]
|
||||
2. __Roboto__: Elegant Google free font and is Doxygen's default [[↓](http://www.google.com/fonts/specimen/Roboto)]
|
||||
3. __Lucida Grande__: Default Apple OS X content font.
|
||||
4. __Calibri__: Default Microsoft Office font (since 2007).
|
||||
5. __Verdana__: Good general font found in a lot of OSs.
|
||||
6. __Helvetica Neue__: Better spaced and balanced Helvetica/Arial variant.
|
||||
7. __Helvetica__: Standard humanist typeface found almost everywhere.
|
||||
8. __Arial__: Microsoft's Helvetica.
|
||||
9. __sans-serif__: Catchall style. Chooses default sans-serif typeface, often Helvetica.
|
||||
|
||||
The ordering of the fonts is important as it's designed to allow the documentation to settle into a number of different identities according to the fonts available. If you have the complete DejaVu family installed, then the docs are presented using that, and if your Console is set up to use the same fonts, presentation will be completely consistent.
|
||||
|
||||
On OS X, with nothing extra installed, the docs will default to Menlo and Lucida Grande giving a Mac feel. Under Windows, it will default to using Consolas and Calibri on recent versions, giving a modern Windows style.
|
||||
|
||||
#### Other sources:
|
||||
|
||||
- [Font Squirrel](http://www.fontsquirrel.com): Good source of open source font packages.
|
||||
|
||||
### Choosing a CLI style: using a \\fish{style} block
|
||||
|
||||
By default, when output as HTML, a \\fish block uses syntax colouring suited to the style of the documentation rather than trying to mimic the terminal. The block has a light, bordered background and a colour scheme that 'suggests' what the user would see in a console.
|
||||
|
||||
Additional stying can be applied adding a style declaration:
|
||||
|
||||
\fish{additional_style [another_style...]}
|
||||
...
|
||||
\endfish
|
||||
|
||||
This will translate to classes applied to the `<div>` tag, like so:
|
||||
|
||||
<div class="fish additional_style another_style">
|
||||
...
|
||||
</div>
|
||||
|
||||
The various classes are defined in `doc_src/user_doc.css` and new style can be simply added
|
||||
|
||||
The documentation currently defines a couple of additional styles:
|
||||
|
||||
- __cli-dark__: Used in the _tutorial_ and _FAQ_ to simulate a dark background terminal, with fish's default colours (slightly tweaked for legibility in the browser).
|
||||
|
||||
- __synopsis__: A simple colour theme helpful for displaying the logical 'summary' of a command's syntax, options and structure.
|
||||
|
||||
## Markdown
|
||||
|
||||
Apart from the exceptions discussed above, the rest of the documentation now supports the use of Markdown. As such the use of Doxygen special commands for HTML tags is unnecessary.
|
||||
|
||||
There are a few exceptions and extensions to the Markdown [standard](http://daringfireball.net/projects/markdown/) that are documented in the Doxygen [documentation](http://www.stack.nl/~dimitri/doxygen/manual/markdown.html).
|
||||
|
||||
### \`Backticks\`
|
||||
|
||||
As is standard in Markdown and 'Github Flavoured Markdown' (GFM), backticks can be used to denote inline technical terms in the documentation, `like so`. In the documentation this will set the font to the monospaced 'console' typeface and will cause the enclosed term to stand out.
|
||||
|
||||
However, fenced code blocks using 4 spaces or 3 backticks (\`\`\`) should be avoided as Doxygen will interpret these as \\code blocks and try to apply standard syntax colouring, which doesn't work so well for fish examples. Use `\fish..\endfish` blocks instead.
|
||||
|
||||
### Lists
|
||||
|
||||
Standard Markdown list rules apply, but as Doxygen will collapse white space on output, combined with the use of long lines, it's a good idea to include an extra new line between long list items to assist future editing.
|
||||
|
||||
## Special cases
|
||||
|
||||
The following can be used in \\fish blocks to render some fish scenarios. These are mostly used in the tutorial when an interactive situation needs to be displayed.
|
||||
|
||||
### Custom formatting tags
|
||||
|
||||
- `<s>`: auto\<s\>suggestion\</s\>.
|
||||
- `<m>`: \<m\>Matched\</m\> items, such as tab completions.
|
||||
- `<sm>`: Matched items \<sm\>searched\<sm\> for, like grep results.
|
||||
- `<error>`: \<error\>This would be shown as an error.\</error\>
|
||||
- `<asis>`: \<asis\>This test will not be parsed for fish markup.\</asis\>
|
||||
- `<outp>`: \<outp\>This would be rendered as command/script output.\</outp\>
|
||||
|
||||
### Prompts and cursors
|
||||
|
||||
- `>_`: Display a basic prompt.
|
||||
- `~>_`: Display a prompt with a the home directory as the current working directory.
|
||||
- `___` (3 underscores): Display a cursor.
|
||||
|
||||
|
||||
### Keyboard shortcuts: @key{} and @cursor_key{}
|
||||
|
||||
Graphical keyboard shortcuts can be defined using the following special commands. These allow for the different text requirements across the html and man pages. The HTML uses CSS to create a keyboard style, whereas the man page would display the key as text.
|
||||
|
||||
- `@key{lable}`
|
||||
Displays a key with a purely textual lable, such as: 'Tab', 'Page Up', 'Page Down', 'Home', 'End', 'F1', 'F19' and so on.
|
||||
|
||||
- `@key{modifier,lable}`
|
||||
Displays a keystroke requiring the use of a 'modifier' key, such as 'Control-A', 'Shift-X', 'Alt-Tab' etc.
|
||||
|
||||
- `@key{modifier,entity,lable}`
|
||||
Displays a keystroke using a graphical entity, such as an arrow symbol for cursor key based shortcuts.
|
||||
|
||||
- `@cursor_key{entity,lable}`
|
||||
A special case for cursor keys, when no modifier is needed. i.e. `@cursor_key{↑,up}` for the up arrow key.
|
||||
|
||||
Some useful Unicode/HTML5 entities:
|
||||
|
||||
- Up arrow: `↑`
|
||||
- Down arrow: `↓`
|
||||
- Left arrow: `←`
|
||||
- Right arrow `→`
|
||||
- Shift: `⇧`
|
||||
- Tab: `⇥`
|
||||
- Mac option: `⌥`
|
||||
- Mac command: `⌘`
|
||||
|
||||
## Notes
|
||||
|
||||
### Doxygen
|
||||
|
||||
Tested on:
|
||||
- Ubuntu 14.04 with Doxygen 1.8.8, built from [GitHub source](https://github.com/doxygen/doxygen.git).
|
||||
- CentOS 6.5 with Doxygen 1.8.8, built from [GitHub source](https://github.com/doxygen/doxygen.git).
|
||||
- Mac OS X 10.9 with Homebrew install Doxygen 1.8.7 and 1.8.8.
|
||||
|
||||
Graphviz was also installed in all the above testing.
|
||||
|
||||
Doxygen 1.8.6 and lower do not have the \\htmlonly[block] directive which fixes a multitude of problems in the rendering of the docs. In Doxygen 1.8.7 the list of understood HTML entities was greatly increased. I tested earlier versions and many little issues returned.
|
||||
|
||||
As fish ships with pre-built documentation, I don't see this as an issue.
|
||||
|
||||
### Updated Configure/Makefile
|
||||
|
||||
- Tested on Ubuntu 14.04, CentOS 6.5 and Mac OS X 10.9.
|
||||
- Makefile has GNU/BSD sed/grep detection.
|
||||
|
||||
### HTML output
|
||||
|
||||
- The output HTML is HTML5 compliant, but should quickly and elegantly degrade on older browsers without losing basic structure.
|
||||
- The CSS avoids the use or browser specific extenstions (i.e. -webkit, -moz etc), using the W3C HTML5 standard instead.
|
||||
- It's been tested in Chrome 37.0 and Firefox 32.0 on Mac OS X 10.9 (+Safari 7), Windows 8.1 (+Internet Explorer 11) and Ubuntu Desktop 14.04.
|
||||
- My assumption is basically that if someone cares enough to want to install fish, they'll be keeping a browser current.
|
||||
|
||||
### Man page output
|
||||
|
||||
- Tested on Ubuntu 14.04, CentOS 6.5 and Mac OS X 10.9.
|
||||
- Output is substantially cleaner.
|
||||
- Tested in cat, less, more and most pagers using the following fish script:
|
||||
|
||||
```
|
||||
function manTest --description 'Test manpage' --argument page
|
||||
set -l pager
|
||||
for i in $argv
|
||||
switch $i
|
||||
case "-l"
|
||||
set pager -P '/usr/bin/less -is'
|
||||
case "-m"
|
||||
set pager -P '/usr/bin/more -s'
|
||||
case "-c"
|
||||
set pager -P '/bin/cat'
|
||||
end
|
||||
end
|
||||
man $pager ~/Projects/OpenSource/fish-shell/share/man/man1/$page.1
|
||||
end
|
||||
|
||||
# Assumes 'most' is the default system pager.
|
||||
# NOT PORTABLE! Paths would be need to be updated on other systems.
|
||||
```
|
||||
|
||||
### Developer docs and LATEX/PDF output
|
||||
|
||||
- HTML developer docs tested on Ubuntu 14.04, CentOS 6.5 and Mac OS X 10.9.
|
||||
- LATEX/PDF reference manual tested on Mac OS X 10.9 using MacTEX. PDF production returns an error (due to Doxygen's use of an outdated 'float' package), but manual PDF output is ok.
|
||||
|
||||
### Future changes
|
||||
|
||||
1. The documentation creation process would be better if it could be modularised further and moved out of the makefile into a number of supporting scripts. This would allow both the automake and Xcode build processes to use the documentation scripts directly.
|
||||
2. Remove the Doxygen dependency entirely for the user documentation. This would be very acheivable now that the bulk of the documentation is in Markdown.
|
||||
3. It would be useful to gauge what parts of the documentation are actually used by users. Judging by the amount of 'missing comment' errors during the developer docs build phase, this aspect of the docs has been rather neglected. If it is not longer used or useful, then this could change the future direction of the documentation and significantly streamline the process.
|
||||
|
||||
#### Author: Mark Griffiths [@GitHub](https://github.com/MarkGriffiths)
|
||||
44
doc_src/abbr.txt
Normal file
44
doc_src/abbr.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
\section abbr abbr - manage fish abbreviations
|
||||
|
||||
\subsection abbr-synopsis Synopsis
|
||||
\fish{synopsis}
|
||||
abbr -a word="phrase"
|
||||
abbr -s
|
||||
abbr -l
|
||||
abbr -e word
|
||||
\endfish
|
||||
|
||||
\subsection abbr-description Description
|
||||
|
||||
`abbr` manipulates the list of abbreviations that fish will expand.
|
||||
|
||||
Abbreviations are user-defined character sequences or words that are replaced with longer phrases after they are entered. For example, a frequently-run command such as `git checkout` can be abbreviated to `gco`. After entering `gco` and pressing @key{Space} or @key{Enter}, the full text `git checkout` will appear in the command line.
|
||||
|
||||
Abbreviations are stored, by default, in a universal variable.
|
||||
|
||||
The following parameters are available:
|
||||
|
||||
- `-a WORD PHRASE` or `--add WORD PHRASE` Adds a new abbreviation, where WORD will be expanded to PHRASE.
|
||||
|
||||
- `-s` or `--show` Show all abbreviated words and their expanded phrases in a manner suitable for export and import.
|
||||
|
||||
- `-l` or `--list` Lists all abbreviated words.
|
||||
|
||||
- `-e WORD` or `--erase WORD` Erase the abbreviation WORD.
|
||||
|
||||
\subsection abbr-example Examples
|
||||
|
||||
\fish
|
||||
abbr -a gco git checkout
|
||||
\endfish
|
||||
Add a new abbreviation where `gco` will be replaced with `git checkout`.
|
||||
|
||||
\fish
|
||||
abbr -e gco
|
||||
\endfish
|
||||
Erase the `gco` abbreviation.
|
||||
|
||||
\fish
|
||||
ssh another_host abbr -s | source
|
||||
\endfish
|
||||
Import the abbreviations defined on another_host over SSH.
|
||||
@@ -1,34 +1,34 @@
|
||||
\section alias alias - create a function
|
||||
|
||||
\subsection alias-synopsis Synopsis
|
||||
<pre>alias NAME DEFINITION
|
||||
alias NAME=DEFINITION</pre>
|
||||
\fish{synopsis}
|
||||
alias NAME DEFINITION
|
||||
alias NAME=DEFINITION
|
||||
\endfish
|
||||
|
||||
\subsection alias-description Description
|
||||
|
||||
\c alias is a simple wrapper for the \c function builtin.
|
||||
It exists for backwards compatibility with Posix
|
||||
shells. For other uses, it is recommended to define a <a
|
||||
href='#function'>function</a>.
|
||||
`alias` is a simple wrapper for the `function` builtin. It exists for backwards compatibility with Posix shells. For other uses, it is recommended to define a <a href='#function'>function</a>.
|
||||
|
||||
\c fish does not keep track of which functions have been defined using
|
||||
\c alias. They must be erased using <code>functions -e</code>.
|
||||
`fish` does not keep track of which functions have been defined using `alias`. They must be erased using `functions -e`.
|
||||
|
||||
- NAME is the name of the alias
|
||||
- DEFINITION is the actual command to execute. The string " $argv" will be appended.
|
||||
- `NAME` is the name of the alias
|
||||
|
||||
- `DEFINITION` is the actual command to execute. The string `$argv` will be appended.
|
||||
|
||||
You cannot create an alias to a function with the same name.
|
||||
|
||||
|
||||
\subsection alias-example Example
|
||||
|
||||
The following code will create \c rmi, which runs \c rm with additional
|
||||
arguments on every invocation.
|
||||
The following code will create `rmi`, which runs `rm` with additional arguments on every invocation.
|
||||
|
||||
<code>alias rmi "rm -i"</code>
|
||||
\fish
|
||||
alias rmi "rm -i"
|
||||
|
||||
This is equivalent to entering the following function:
|
||||
# This is equivalent to entering the following function:
|
||||
|
||||
<pre>function rmi
|
||||
function rmi
|
||||
rm -i $argv
|
||||
end</pre>
|
||||
|
||||
end
|
||||
\endfish
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
\section and and - conditionally execute a command
|
||||
|
||||
\subsection and-synopsis Synopsis
|
||||
<tt>COMMAND1; and COMMAND2</tt>
|
||||
\fish{synopsis}
|
||||
COMMAND1; and COMMAND2
|
||||
\endfish
|
||||
|
||||
\subsection and-description Description
|
||||
|
||||
\c and is used to execute a command if the current exit
|
||||
status (as set by the last previous command) is 0.
|
||||
`and` is used to execute a command if the current exit status (as set by the last previous command) is 0.
|
||||
|
||||
\c and does not change the current exit status.
|
||||
`and` does not change the current exit status.
|
||||
|
||||
The exit status of the last foreground command to exit can always be accessed using the <a href="index.html#variables-status">$status</a> variable.
|
||||
|
||||
The exit status of the last foreground command to exit can always be
|
||||
accessed using the <a href="index.html#variables-status">$status</a>
|
||||
variable.
|
||||
|
||||
\subsection and-example Example
|
||||
|
||||
The following code runs the \c make command to build a program. If the
|
||||
build succeeds, <code>make</code>'s exit status is 0, and the program is installed. If either step fails,
|
||||
the exit status is 1, and <tt>make clean</tt> is run, which removes the files created by the.
|
||||
build process.
|
||||
The following code runs the `make` command to build a program. If the build succeeds, `make`'s exit status is 0, and the program is installed. If either step fails, the exit status is 1, and `make clean` is run, which removes the files created by the build process.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
make; and make install; or make clean
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
||||
BIN
doc_src/ascii_fish.png
Normal file
BIN
doc_src/ascii_fish.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
@@ -1,49 +1,45 @@
|
||||
\section begin begin - start a new block of code
|
||||
|
||||
\subsection begin-synopsis Synopsis
|
||||
<tt>begin; [COMMANDS...;] end</tt>
|
||||
\fish{synopsis}
|
||||
begin; [COMMANDS...;] end
|
||||
\endfish
|
||||
|
||||
\subsection begin-description Description
|
||||
|
||||
\c begin is used to create a new block of code.
|
||||
`begin` is used to create a new block of code.
|
||||
|
||||
The block
|
||||
is unconditionally executed. <code>begin; ...; end</tt> is equivalent
|
||||
to <tt>if true; ...; end</tt>.
|
||||
The block is unconditionally executed. `begin; ...; end` is equivalent to `if true; ...; end`.
|
||||
|
||||
\c begin is used to group a number of commands into a block.
|
||||
This allows the introduction of a new variable scope, redirection of the input or
|
||||
output of a set of commands as a group, or to specify precedence when
|
||||
using the conditional commands like \c and.
|
||||
`begin` is used to group a number of commands into a block. This allows the introduction of a new variable scope, redirection of the input or output of a set of commands as a group, or to specify precedence when using the conditional commands like `and`.
|
||||
|
||||
`begin` does not change the current exit status.
|
||||
|
||||
\c begin does not change the current exit status.
|
||||
|
||||
\subsection begin-example Example
|
||||
|
||||
The following code sets a number of variables inside of a block
|
||||
scope. Since the variables are set inside the block and have local
|
||||
scope, they will be automatically deleted when the block ends.
|
||||
The following code sets a number of variables inside of a block scope. Since the variables are set inside the block and have local scope, they will be automatically deleted when the block ends.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
begin
|
||||
set -l PIRATE Yarrr
|
||||
...
|
||||
set -l PIRATE Yarrr
|
||||
...
|
||||
end
|
||||
# This will not output anything, since the PIRATE variable went out
|
||||
# of scope at the end of the block
|
||||
|
||||
echo $PIRATE
|
||||
</pre>
|
||||
# This will not output anything, since the PIRATE variable
|
||||
# went out of scope at the end of the block
|
||||
\endfish
|
||||
|
||||
In the following code, all output is redirected to the file out.html.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
begin
|
||||
echo $xml_header
|
||||
echo $html_header
|
||||
if test -e $file
|
||||
...
|
||||
end
|
||||
...
|
||||
|
||||
end > out.html
|
||||
</pre>
|
||||
echo $xml_header
|
||||
echo $html_header
|
||||
if test -e $file
|
||||
...
|
||||
end
|
||||
...
|
||||
end > out.html
|
||||
\endfish
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
\section bg bg - send jobs to background
|
||||
|
||||
\subsection bg-synopsis Synopsis
|
||||
<tt>bg [PID...]</tt>
|
||||
\fish{synopsis}
|
||||
bg [PID...]
|
||||
\endfish
|
||||
|
||||
\subsection bg-description Description
|
||||
|
||||
\c bg sends <a href="index.html#syntax-job-control">jobs</a> to the background, resuming them if they are stopped. A background job is
|
||||
executed simultaneously with fish, and does not have access to the
|
||||
keyboard. If no job is specified, the last job to be used is put in the background. If PID is specified, the jobs with the specified process group IDs are put in the background.
|
||||
`bg` sends <a href="index.html#syntax-job-control">jobs</a> to the background, resuming them if they are stopped. A background job is executed simultaneously with fish, and does not have access to the keyboard. If no job is specified, the last job to be used is put in the background. If PID is specified, the jobs with the specified process group IDs are put in the background.
|
||||
|
||||
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>.
|
||||
|
||||
|
||||
\subsection bg-example Example
|
||||
|
||||
<tt>bg \%1</tt> will put the job with job ID 1 in the background.
|
||||
|
||||
`bg %1` will put the job with job ID 1 in the background.
|
||||
|
||||
174
doc_src/bind.txt
174
doc_src/bind.txt
@@ -1,97 +1,125 @@
|
||||
\section bind bind - handle fish key bindings
|
||||
|
||||
\subsection bind-synopsis Synopsis
|
||||
<tt>bind [OPTIONS] SEQUENCE COMMAND</tt>
|
||||
\fish{synopsis}
|
||||
bind [(-M | --mode) MODE] [(-m | --sets-mode) NEW_MODE]
|
||||
[(-k | --key)] SEQUENCE COMMAND [COMMAND...]
|
||||
bind [(-M | --mode) MODE] [(-k | --key)] SEQUENCE
|
||||
bind (-K | --key-names) [(-a | --all)]
|
||||
bind (-f | --function-names)
|
||||
bind (-e | --erase) [(-M | --mode) MODE]
|
||||
(-a | --all | [(-k | --key)] SEQUENCE [SEQUENCE...])
|
||||
\endfish
|
||||
|
||||
\subsection bind-description Description
|
||||
|
||||
<tt>bind</tt> adds a binding for the specified key sequence to the
|
||||
specified command.
|
||||
`bind` adds a binding for the specified key sequence to the specified command.
|
||||
|
||||
SEQUENCE is the character sequence to bind to. These should be written as
|
||||
<a href="index.html#escapes">fish escape sequences</a>. For example, because pressing
|
||||
the Alt key and another character sends that character prefixed with
|
||||
an escape character, Alt-based key bindings can be written using the
|
||||
\c \\e escape. For example, Alt-w can be written as
|
||||
<tt>\\ew</tt>. The control character can be written in much the same way
|
||||
using the \c \\c escape, for example Control-x (^X) can be written as
|
||||
<tt>\\cx</tt>. Note that Alt-based key bindings are case sensitive and
|
||||
Control-based key bindings are not. This is a constraint of text-based
|
||||
terminals, not \c fish.
|
||||
SEQUENCE is the character sequence to bind to. These should be written as <a href="index.html#escapes">fish escape sequences</a>. For example, because pressing the Alt key and another character sends that character prefixed with an escape character, Alt-based key bindings can be written using the `\e` escape. For example, @key{Alt,w} can be written as `\ew`. The control character can be written in much the same way using the `\c` escape, for example @key{Control,X} (^X) can be written as `\cx`. Note that Alt-based key bindings are case sensitive and Control-based key bindings are not. This is a constraint of text-based terminals, not `fish`.
|
||||
|
||||
The default key binding can be set by specifying a SEQUENCE of the empty
|
||||
string (that is, <code>''</code>). It will be used whenever no
|
||||
other binding matches. For most key bindings, it makes sense to use
|
||||
the \c self-insert function (i.e. <tt>bind '' self-insert</tt> as the
|
||||
default keybinding. This will insert any keystrokes not specifically
|
||||
bound to into the editor. Non-printable characters are ignored by the
|
||||
editor, so this will not result in control sequences being
|
||||
printable.
|
||||
The default key binding can be set by specifying a `SEQUENCE` of the empty string (that is, ```''``` ). It will be used whenever no other binding matches. For most key bindings, it makes sense to use the `self-insert` function (i.e. ```bind '' self-insert```) as the default keybinding. This will insert any keystrokes not specifically bound to into the editor. Non- printable characters are ignored by the editor, so this will not result in control sequences being printable.
|
||||
|
||||
If the -k switch is used, the name of the key (such as down, up or
|
||||
backspace) is used instead of a sequence. The names used are the same
|
||||
as the corresponding curses variables, but without the 'key_'
|
||||
prefix. (See \c terminfo(5) for more information, or use <tt>bind
|
||||
--key-names</tt> for a list of all available named keys.)
|
||||
If the `-k` switch is used, the name of the key (such as 'down', 'up' or 'backspace') is used instead of a sequence. The names used are the same as the corresponding curses variables, but without the 'key_' prefix. (See `terminfo(5)` for more information, or use `bind --key-names` for a list of all available named keys.)
|
||||
|
||||
COMMAND can be any fish command, but it can also be one of a set of
|
||||
special input functions. These include functions for moving the
|
||||
cursor, operating on the kill-ring, performing tab completion,
|
||||
etc. Use 'bind --function-names' for a complete list of these input
|
||||
functions.
|
||||
`COMMAND` can be any fish command, but it can also be one of a set of special input functions. These include functions for moving the cursor, operating on the kill-ring, performing tab completion, etc. Use `bind --function-names` for a complete list of these input functions.
|
||||
|
||||
When COMMAND is a shellscript command, it is a good practice to put
|
||||
the actual code into a <a href="#function">function</a> and simply
|
||||
bind to the function name. This way it becomes significantly easier to
|
||||
test the function while editing, and the result is usually more
|
||||
readable as well.
|
||||
When `COMMAND` is a shellscript command, it is a good practice to put the actual code into a <a href="#function">function</a> and simply bind to the function name. This way it becomes significantly easier to test the function while editing, and the result is usually more readable as well.
|
||||
|
||||
If such a script produces output, the script needs to finish by
|
||||
calling 'commandline -f repaint' in order to tell fish that a repaint
|
||||
is in order.
|
||||
If such a script produces output, the script needs to finish by calling `commandline -f repaint` in order to tell fish that a repaint is in order.
|
||||
|
||||
Key bindings are not saved between sessions by default. To save custom
|
||||
keybindings, edit the \c fish_user_key_bindings function and insert the
|
||||
appropriate \c bind statements.
|
||||
When multiple `COMMAND`s are provided, they are all run in the specified order when the key is pressed.
|
||||
|
||||
If no `SEQUENCE` is provided, all bindings (or just the bindings in the specified `MODE`) are printed. If `SEQUENCE` is provided without `COMMAND`, just the binding matching that sequence is printed.
|
||||
|
||||
Key bindings are not saved between sessions by default. To save custom keybindings, edit the `fish_user_key_bindings` function and insert the appropriate `bind` statements.
|
||||
|
||||
Key bindings may use "modes", which mimics Vi's modal input behavior. The default mode is "default", and every bind applies to a single mode. The mode can be viewed/changed with the `$fish_bind_mode` variable.
|
||||
|
||||
The following parameters are available:
|
||||
|
||||
- <tt>-k</tt> or <tt>--key</tt> Specify a key name, such as 'left' or 'backspace' instead of a character sequence
|
||||
- <tt>-K</tt> or <tt>--key-names</tt> Display a list of available key names
|
||||
- <tt>-f</tt> or <tt>--function-names</tt> Display a list of available input functions
|
||||
- `-k` or `--key` Specify a key name, such as 'left' or 'backspace' instead of a character sequence
|
||||
|
||||
- `-K` or `--key-names` Display a list of available key names. Specifying `-a` or `--all` includes keys that don't have a known mapping
|
||||
|
||||
- `-f` or `--function-names` Display a list of available input functions
|
||||
|
||||
- `-M MODE` or `--mode MODE` Specify a bind mode that the bind is used in. Defaults to "default"
|
||||
|
||||
- `-m NEW_MODE` or `--sets-mode NEW_MODE` Change the current mode to `NEW_MODE` after this binding is executed
|
||||
|
||||
- `-e` or `--erase` Erase the binding with the given sequence and mode instead of defining a new one. Multiple sequences can be specified with this flag. Specifying `-a` or `--all` with `-M` or `--mode` erases all binds in the given mode regardless of sequence. Specifying `-a` or `--all` without `-M` or `--mode` erases all binds in all modes regardless of sequence.
|
||||
|
||||
- `-a` or `--all` See `--erase` and `--key-names`
|
||||
|
||||
The following special input functions are available:
|
||||
|
||||
- \c backward-char, moves one character to the left
|
||||
- \c backward-delete-char, deletes one character of input to the left of the cursor
|
||||
- \c backward-kill-line, move everything from the beginning of the line to the cursor to the killring
|
||||
- \c backward-kill-word, move the word to the left of the cursor to the killring
|
||||
- \c backward-word, move one word to the left
|
||||
- \c beginning-of-history, move to the beginning of the history
|
||||
- \c beginning-of-line, move to the beginning of the line
|
||||
- \c capitalize-word, make the current word begin with a capital letter
|
||||
- \c complete, guess the remainder of the current token
|
||||
- \c delete-char, delete one character to the right of the cursor
|
||||
- \c delete-line, delete the entire line
|
||||
- \c downcase-word, make the current word lowercase
|
||||
- \c dump-functions, print a list of all key-bindings
|
||||
- \c end-of-history, move to the end of the history
|
||||
- \c end-of-line, move to the end of the line
|
||||
- \c explain, print a description of possible problems with the current command
|
||||
- \c forward-char, move one character to the right
|
||||
- \c forward-word, move one word to the right
|
||||
- \c history-search-backward, search the history for the previous match
|
||||
- \c history-search-forward, search the history for the next match
|
||||
- \c kill-line, move everything from the cursor to the end of the line to the killring
|
||||
- \c kill-whole-line, move the line to the killring
|
||||
- \c kill-word, move the next word to the killring
|
||||
- \c upcase-word, make the current word uppercase
|
||||
- \c yank, insert the latest entry of the killring into the buffer
|
||||
- \c yank-pop, rotate to the previous entry of the killring
|
||||
- `backward-char`, moves one character to the left
|
||||
|
||||
- `backward-delete-char`, deletes one character of input to the left of the cursor
|
||||
|
||||
- `backward-kill-line`, move everything from the beginning of the line to the cursor to the killring
|
||||
|
||||
- `backward-kill-word`, move the word to the left of the cursor to the killring
|
||||
|
||||
- `backward-word`, move one word to the left
|
||||
|
||||
- `beginning-of-history`, move to the beginning of the history
|
||||
|
||||
- `beginning-of-line`, move to the beginning of the line
|
||||
|
||||
- `capitalize-word`, make the current word begin with a capital letter
|
||||
|
||||
- `complete`, guess the remainder of the current token
|
||||
|
||||
- `delete-char`, delete one character to the right of the cursor
|
||||
|
||||
- `delete-line`, delete the entire line
|
||||
|
||||
- `downcase-word`, make the current word lowercase
|
||||
|
||||
- `dump-functions`, print a list of all key-bindings
|
||||
|
||||
- `end-of-history`, move to the end of the history
|
||||
|
||||
- `end-of-line`, move to the end of the line
|
||||
|
||||
- `explain`, print a description of possible problems with the current command
|
||||
|
||||
- `forward-char`, move one character to the right
|
||||
|
||||
- `forward-word`, move one word to the right
|
||||
|
||||
- `history-search-backward`, search the history for the previous match
|
||||
|
||||
- `history-search-forward`, search the history for the next match
|
||||
|
||||
- `kill-line`, move everything from the cursor to the end of the line to the killring
|
||||
|
||||
- `kill-whole-line`, move the line to the killring
|
||||
|
||||
- `kill-word`, move the next word to the killring
|
||||
|
||||
- `upcase-word`, make the current word uppercase
|
||||
|
||||
- `yank`, insert the latest entry of the killring into the buffer
|
||||
|
||||
- `yank-pop`, rotate to the previous entry of the killring
|
||||
|
||||
|
||||
\subsection bind-example Examples
|
||||
|
||||
<tt>bind \\cd 'exit'</tt> causes \c fish to exit when Control-d is pressed.
|
||||
\fish
|
||||
bind \cd 'exit'
|
||||
\endfish
|
||||
Causes `fish` to exit when @key{Control,D} is pressed.
|
||||
|
||||
<tt>bind -k ppage history-search-backward</tt> performs a history search when the Page Up key is pressed.
|
||||
\fish
|
||||
bind -k ppage history-search-backward
|
||||
\endfish
|
||||
Performs a history search when the @key{Page Up} key is pressed.
|
||||
|
||||
\fish
|
||||
set -g fish_key_bindings fish_vi_key_bindings
|
||||
bind -M insert \cc kill-whole-line force-repaint
|
||||
\endfish
|
||||
Turns on Vi key bindings and rebinds @key{Control,C} to clear the input line.
|
||||
|
||||
@@ -1,40 +1,41 @@
|
||||
\section block block - temporarily block delivery of events
|
||||
|
||||
\subsection block-synopsis Synopsis
|
||||
<tt>block [OPTIONS...]</tt>
|
||||
\fish{synopsis}
|
||||
block [OPTIONS...]
|
||||
\endfish
|
||||
|
||||
\subsection block-description Description
|
||||
|
||||
\c block prevents events triggered by \c fish or the
|
||||
<a href="commands.html#emit"><code>emit</code></a> command from
|
||||
being delivered and acted upon while the block is in place.
|
||||
`block` prevents events triggered by `fish` or the <a href="commands.html#emit">`emit`</a> command from being delivered and acted upon while the block is in place.
|
||||
|
||||
In functions, \c block can be useful while performing work that
|
||||
should not be interrupted by the shell.
|
||||
In functions, `block` can be useful while performing work that should not be interrupted by the shell.
|
||||
|
||||
The block can be removed. Any events which triggered while the
|
||||
block was in place will then be delivered.
|
||||
The block can be removed. Any events which triggered while the block was in place will then be delivered.
|
||||
|
||||
Event blocks should not be confused with code blocks, which are created
|
||||
with <code>begin</code>, <code>if</code>, <code>while</code> or
|
||||
<code>for</code>
|
||||
Event blocks should not be confused with code blocks, which are created with `begin`, `if`, `while` or `for`
|
||||
|
||||
The following parameters are available:
|
||||
|
||||
- <tt>-l</tt> or <tt>--local</tt> Release the block automatically at the end of the current innermost code block scope
|
||||
- <tt>-g</tt> or <tt>--global</tt> Never automatically release the lock
|
||||
- <tt>-e</tt> or <tt>--erase</tt> Release global block
|
||||
- `-l` or `--local` Release the block automatically at the end of the current innermost code block scope
|
||||
|
||||
- `-g` or `--global` Never automatically release the lock
|
||||
|
||||
- `-e` or `--erase` Release global block
|
||||
|
||||
|
||||
\subsection block-example Example
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
# Create a function that listens for events
|
||||
function --on-event foo foo; echo 'foo fired'; end
|
||||
|
||||
# Block the delivery of events
|
||||
block -g
|
||||
|
||||
emit foo
|
||||
# No output will be produced
|
||||
|
||||
block -e
|
||||
# 'foo fired' will now be printed
|
||||
</pre>
|
||||
|
||||
\endfish
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
\section break break - stop the current inner loop
|
||||
|
||||
\subsection break-synopsis Synopsis
|
||||
<tt>LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end</tt>
|
||||
\fish{synopsis}
|
||||
LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end
|
||||
\endfish
|
||||
|
||||
\subsection break-description Description
|
||||
|
||||
\c break halts a currently running loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. It is usually added inside of a conditional block such as an <a href="#if">if</a> statement or a <a href="#switch">switch</a> statement.
|
||||
`break` halts a currently running loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. It is usually added inside of a conditional block such as an <a href="#if">if</a> statement or a <a href="#switch">switch</a> statement.
|
||||
|
||||
There are no parameters for `break`.
|
||||
|
||||
There are no parameters for <code>break</code>.
|
||||
|
||||
\subsection break-example Example
|
||||
The following code searches all .c files for "smurf", and halts at the first occurrence.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
for i in *.c
|
||||
if grep smurf $i
|
||||
echo Smurfs are present in $i
|
||||
break
|
||||
end
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
\section breakpoint breakpoint - Launch debug mode
|
||||
|
||||
\subsection breakpoint-synopsis Synopsis
|
||||
<tt>breakpoint</tt>
|
||||
\fish{synopsis}
|
||||
breakpoint
|
||||
\endfish
|
||||
|
||||
\subsection breakpoint-description Description
|
||||
|
||||
\c breakpoint is used to halt a running script and launch
|
||||
an interactive debugging prompt.
|
||||
`breakpoint` is used to halt a running script and launch an interactive debugging prompt.
|
||||
|
||||
For more details, see <a href="index.html#debugging">Debugging fish
|
||||
scripts</a> in the \c fish manual.
|
||||
For more details, see <a href="index.html#debugging">Debugging fish scripts</a> in the `fish` manual.
|
||||
|
||||
There are no parameters for <code>breakpoint</code>.
|
||||
There are no parameters for `breakpoint`.
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
\section builtin builtin - run a builtin command
|
||||
|
||||
\subsection builtin-synopsis Synopsis
|
||||
<tt>builtin BUILTINNAME [OPTIONS...]</tt>
|
||||
\fish{synopsis}
|
||||
builtin BUILTINNAME [OPTIONS...]
|
||||
\endfish
|
||||
|
||||
\subsection builtin-description Description
|
||||
|
||||
\c builtin forces the shell to use a builtin command, rather than a function or program.
|
||||
`builtin` forces the shell to use a builtin command, rather than a function or program.
|
||||
|
||||
The following parameters are available:
|
||||
|
||||
- <tt>-n</tt> or <tt>--names</tt> List the names of all defined builtins
|
||||
- `-n` or `--names` List the names of all defined builtins
|
||||
|
||||
|
||||
\subsection builtin-example Example
|
||||
|
||||
<tt>builtin jobs</tt> executes the jobs builtin, even if a function named jobs exists.
|
||||
\fish
|
||||
builtin jobs
|
||||
# executes the jobs builtin, even if a function named jobs exists
|
||||
\endfish
|
||||
|
||||
@@ -1,35 +1,27 @@
|
||||
\section case case - conditionally execute a block of commands
|
||||
|
||||
\subsection case-synopsis Synopsis
|
||||
<tt>switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end</tt>
|
||||
\fish{synopsis}
|
||||
switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
||||
\endfish
|
||||
|
||||
\subsection case-description Description
|
||||
|
||||
\c switch performs one of several blocks of commands, depending on whether
|
||||
a specified value equals one of several wildcarded values. \c case is used
|
||||
together with the \c switch statement in order to determine which block should
|
||||
be executed.
|
||||
`switch` performs one of several blocks of commands, depending on whether a specified value equals one of several wildcarded values. `case` is used together with the `switch` statement in order to determine which block should be executed.
|
||||
|
||||
Each \c case command is given one or more parameters. The first \c case
|
||||
command with a parameter that matches the string specified in the
|
||||
switch command will be evaluated. \c case parameters may contain
|
||||
wildcards. These need to be escaped or quoted in order to avoid
|
||||
regular wildcard expansion using filenames.
|
||||
Each `case` command is given one or more parameters. The first `case` command with a parameter that matches the string specified in the switch command will be evaluated. `case` parameters may contain wildcards. These need to be escaped or quoted in order to avoid regular wildcard expansion using filenames.
|
||||
|
||||
Note that fish does not fall through on case statements. Only the
|
||||
first matching case is executed.
|
||||
Note that fish does not fall through on case statements. Only the first matching case is executed.
|
||||
|
||||
Note that command substitutions in a case statement will be evaluated even if its body is not taken. All substitutions, including command substitutions, must be performed before the value can be compared against the parameter.
|
||||
|
||||
Note that command substitutions in a case statement will be
|
||||
evaluated even if its body is not taken. All substitutions, including
|
||||
command substitutions, must be performed before the value can be compared
|
||||
against the parameter.
|
||||
|
||||
\subsection case-example Example
|
||||
|
||||
If the variable \$animal contains the name of an animal, the following
|
||||
code would attempt to classify it:
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
switch $animal
|
||||
case cat
|
||||
echo evil
|
||||
@@ -43,8 +35,8 @@ switch $animal
|
||||
case '*'
|
||||
echo I have no idea what a $animal is
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
If the above code was run with \c \$animal set to \c whale, the output
|
||||
would be \c mammal.
|
||||
If the above code was run with `$animal` set to `whale`, the output
|
||||
would be `mammal`.
|
||||
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
\section cd cd - change directory
|
||||
|
||||
\subsection cd-synopsis Synopsis
|
||||
<tt>cd [DIRECTORY]</tt>
|
||||
\fish{synopsis}
|
||||
cd [DIRECTORY]
|
||||
\endfish
|
||||
|
||||
\subsection cd-description Description
|
||||
\c cd changes the current working directory.
|
||||
`cd` changes the current working directory.
|
||||
|
||||
If \c DIRECTORY is supplied, it will become the new directory. If no parameter
|
||||
is given, the contents of the \c HOME environment variable will be used.
|
||||
If `DIRECTORY` is supplied, it will become the new directory. If no parameter is given, the contents of the `HOME` environment variable will be used.
|
||||
|
||||
If \c DIRECTORY is a relative path, the paths found in the
|
||||
\c CDPATH environment variable array will be tried as prefixes for the specified
|
||||
path.
|
||||
If `DIRECTORY` is a relative path, the paths found in the `CDPATH` environment variable array will be tried as prefixes for the specified path.
|
||||
|
||||
Note that the shell will attempt to change directory without requiring `cd` if the name of a directory is provided (starting with `.`, `/` or `~`, or ending with `/`).
|
||||
|
||||
Note that the shell will attempt to change directory without requiring \c cd
|
||||
if the name of a directory is provided (starting with '.', '/' or '~', or ending
|
||||
with '/').
|
||||
|
||||
\subsection cd-example Examples
|
||||
|
||||
\c cd changes the working directory to your home directory.
|
||||
\fish
|
||||
cd
|
||||
# changes the working directory to your home directory.
|
||||
|
||||
<code>cd /usr/src/fish-shell</code> changes the working directory to
|
||||
<code>/usr/src/fish-shell</code>.
|
||||
cd /usr/src/fish-shell
|
||||
# changes the working directory to /usr/src/fish-shell
|
||||
\endfish
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
\section command command - run a program
|
||||
|
||||
\subsection command-synopsis Synopsis
|
||||
<tt>command COMMANDNAME [OPTIONS...]</tt>
|
||||
\fish{synopsis}
|
||||
command [OPTIONS] COMMANDNAME [ARGS...]
|
||||
\endfish
|
||||
|
||||
\subsection command-description Description
|
||||
|
||||
\c command forces the shell to execute the program \c COMMANDNAME and ignore any functions or builtins with the same name.
|
||||
`command` forces the shell to execute the program `COMMANDNAME` and ignore any functions or builtins with the same name.
|
||||
|
||||
\subsection command-example Example
|
||||
The following options are available:
|
||||
|
||||
<tt>command ls</tt> causes fish to execute the \c ls program, even if an 'ls' function exists.
|
||||
- `-s` or `--search` returns the name of the disk file that would be executed, or nothing if no file with the specified name could be found in the `$PATH`.
|
||||
|
||||
With the `-s` option, `command` treats every argument as a separate command to look up and sets the exit status to 0 if any of the specified commands were found, or 1 if no commands could be found.
|
||||
|
||||
For basic compatibility with POSIX `command`, the `-v` flag is recognized as an alias for `-s`.
|
||||
|
||||
\subsection command-example Examples
|
||||
|
||||
`command ls` causes fish to execute the `ls` program, even if an `ls` function exists.
|
||||
|
||||
`command -s ls` returns the path to the `ls` program.
|
||||
|
||||
@@ -1,63 +1,59 @@
|
||||
\section commandline commandline - set or get the current command line buffer
|
||||
|
||||
\subsection commandline-synopsis Synopsis
|
||||
<tt>commandline [OPTIONS] [CMD]</tt>
|
||||
\fish{synopsis}
|
||||
commandline [OPTIONS] [CMD]
|
||||
\endfish
|
||||
|
||||
\subsection commandline-description Description
|
||||
|
||||
\c commandline can be used to set or get the current contents of the command
|
||||
line buffer.
|
||||
`commandline` can be used to set or get the current contents of the command line buffer.
|
||||
|
||||
With no parameters, \c commandline returns the current value of the command
|
||||
line.
|
||||
With no parameters, `commandline` returns the current value of the command line.
|
||||
|
||||
With \c CMD specified, the command line buffer is erased and replaced with
|
||||
the contents of \c CMD.
|
||||
With `CMD` specified, the command line buffer is erased and replaced with the contents of `CMD`.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- \c -C or \c --cursor set or get the current cursor position, not
|
||||
the contents of the buffer. If no argument is given, the current
|
||||
cursor position is printed, otherwise the argument is interpreted
|
||||
as the new cursor position.
|
||||
- \c -f or \c --function inject readline functions into the
|
||||
reader. This option cannot be combined with any other option. It
|
||||
will cause any additional arguments to be interpreted as readline
|
||||
functions, and these functions will be injected into the reader, so
|
||||
that they will be returned to the reader before any additional
|
||||
actual key presses are read.
|
||||
- `-C` or `--cursor` set or get the current cursor position, not the contents of the buffer. If no argument is given, the current cursor position is printed, otherwise the argument is interpreted as the new cursor position.
|
||||
|
||||
The following options change the way \c commandline updates the
|
||||
command line buffer:
|
||||
- `-f` or `--function` inject readline functions into the reader. This option cannot be combined with any other option. It will cause any additional arguments to be interpreted as readline functions, and these functions will be injected into the reader, so that they will be returned to the reader before any additional actual key presses are read.
|
||||
|
||||
- \c -a or \c --append do not remove the current commandline, append
|
||||
the specified string at the end of it
|
||||
- \c -i or \c --insert do not remove the current commandline, insert
|
||||
the specified string at the current cursor position
|
||||
- \c -r or \c --replace remove the current commandline and replace it
|
||||
with the specified string (default)
|
||||
The following options change the way `commandline` updates the command line buffer:
|
||||
|
||||
The following options change what part of the commandline is printed
|
||||
or updated:
|
||||
- `-a` or `--append` do not remove the current commandline, append the specified string at the end of it
|
||||
|
||||
- \c -b or \c --current-buffer select the entire buffer (default)
|
||||
- \c -j or \c --current-job select the current job
|
||||
- \c -p or \c --current-process select the current process
|
||||
- \c -t or \c --current-token select the current token.
|
||||
- `-i` or `--insert` do not remove the current commandline, insert the specified string at the current cursor position
|
||||
|
||||
The following options change the way \c commandline prints the current
|
||||
commandline buffer:
|
||||
- `-r` or `--replace` remove the current commandline and replace it with the specified string (default)
|
||||
|
||||
- \c -c or \c --cut-at-cursor only print selection up until the
|
||||
current cursor position
|
||||
- \c -o or \c --tokenize tokenize the selection and print one string-type token per line
|
||||
The following options change what part of the commandline is printed or updated:
|
||||
|
||||
- `-b` or `--current-buffer` select the entire buffer (default)
|
||||
|
||||
- `-j` or `--current-job` select the current job
|
||||
|
||||
- `-p` or `--current-process` select the current process
|
||||
|
||||
- `-t` or `--current-token` select the current token.
|
||||
|
||||
The following options change the way `commandline` prints the current commandline buffer:
|
||||
|
||||
- `-c` or `--cut-at-cursor` only print selection up until the current cursor position
|
||||
|
||||
- `-o` or `--tokenize` tokenize the selection and print one string-type token per line
|
||||
|
||||
If `commandline` is called during a call to complete a given string using `complete -C STRING`, `commandline` will consider the specified string to be the current contents of the command line.
|
||||
|
||||
The following options output metadata about the commandline state:
|
||||
|
||||
- `-L` or `--line` print the line that the cursor is on, with the topmost line starting at 1
|
||||
|
||||
- `-S` or `--search-mode` evaluates to true if the commandline is performing a history search
|
||||
|
||||
- `-P` or `--paging-mode` evaluates to true if the commandline is showing pager contents, such as tab completions
|
||||
|
||||
If \c commandline is called during a call to complete a given string
|
||||
using <code>complete -C STRING</code>, \c commandline will consider the
|
||||
specified string to be the current contents of the command line.
|
||||
|
||||
\subsection commandline-example Example
|
||||
|
||||
<tt>commandline -j $history[3]</tt> replaces the job under the cursor with the
|
||||
third item from the command line history.
|
||||
`commandline -j $history[3]` replaces the job under the cursor with the third item from the command line history.
|
||||
|
||||
@@ -1,15 +1,38 @@
|
||||
/** \page commands Commands bundled with fish
|
||||
|
||||
\htmlonly <div class="fish_left_bar fish_left_little"> \endhtmlonly
|
||||
@command_list_toc@
|
||||
\htmlonly </div> \endhtmlonly
|
||||
|
||||
\htmlonly
|
||||
<div class="fish_right_bar fish_right_big">
|
||||
<h1 class="interior_title_borderless">Commands</h1>
|
||||
Fish ships with a large number of builtin commands, shellscript functions and external commands. These are all described below.
|
||||
/**
|
||||
\page commands Commands
|
||||
\htmlonly[block]
|
||||
<div class="fish_left_bar">
|
||||
<div class="logo"></div>
|
||||
<div class="menu commands_menu">
|
||||
\endhtmlonly
|
||||
@command_list@
|
||||
\htmlonly </div> \endhtmlonly
|
||||
@command_list_toc@
|
||||
|
||||
\htmlonly[block]
|
||||
</div>
|
||||
</div>
|
||||
<div class="commands fish_right_bar">
|
||||
<h1 class="interior_title">Command reference</h1>
|
||||
\endhtmlonly
|
||||
`fish` ships with a large number of builtin commands, shellscript functions and external commands. These are all described below.
|
||||
|
||||
Almost all fish commands respond to the `-h` or `--help` options to display their relevant help, also accessible using the `help` and `man` commands, like so:
|
||||
|
||||
\fish
|
||||
echo -h
|
||||
echo --help
|
||||
# Prints help to the terminal window
|
||||
|
||||
man echo
|
||||
# Displays the man page in the system pager
|
||||
# (normally 'less', 'more' or 'most').
|
||||
|
||||
help echo
|
||||
# Open a web browser to show the relevant documentation
|
||||
\endfish
|
||||
|
||||
@command_list@
|
||||
|
||||
\htmlonly[block]
|
||||
</div>
|
||||
\endhtmlonly
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
\section complete complete - edit command specific tab-completions
|
||||
|
||||
\subsection complete-synopsis Synopsis
|
||||
<tt>complete (-c|--command|-p|--path) COMMAND [(-s|--short-option) SHORT_OPTION] [(-l|--long-option|-o|--old-option) LONG_OPTION [(-a||--arguments) OPTION_ARGUMENTS] [(-d|--description) DESCRIPTION] </tt>
|
||||
\fish{synopsis}
|
||||
complete ( -c | --command | -p | --path ) COMMAND
|
||||
[( -s | --short-option ) SHORT_OPTION]
|
||||
[( -l | --long-option | -o | --old-option ) LONG_OPTION]
|
||||
[( -a | --arguments ) OPTION_ARGUMENTS]
|
||||
[( -w | --wraps ) WRAPPED_COMMAND]
|
||||
[( -d | --description ) DESCRIPTION]
|
||||
\endfish
|
||||
|
||||
\subsection complete-description Description
|
||||
|
||||
@@ -9,69 +16,88 @@ For an introduction to specifying completions, see <a
|
||||
href='index.html#completion-own'>Writing your own completions</a> in
|
||||
the fish manual.
|
||||
|
||||
- <tt>COMMAND</tt> is the name of the command for which to add a completion
|
||||
- <tt>SHORT_OPTION</tt> is a one character option for the command
|
||||
- <tt>LONG_OPTION</tt> is a multi character option for the command
|
||||
- <tt>OPTION_ARGUMENTS</tt> is parameter containing a space-separated list of possible option-arguments, which may contain subshells
|
||||
- <tt>DESCRIPTION</tt> is a description of what the option and/or option arguments do
|
||||
- <tt>-C STRING</tt> or <tt>--do-complete=STRING</tt> makes complete try to find all possible completions for the specified string
|
||||
- <tt>-e</tt> or <tt>--erase</tt> implies that the specified completion should be deleted
|
||||
- <tt>-f</tt> or <tt>--no-files</tt> specifies that the option specified by this completion may not be followed by a filename
|
||||
- <tt>-n</tt> or <tt>--condition</tt> specifies a shell command that must return 0 if the completion is to be used. This makes it possible to specify completions that should only be used in some cases.
|
||||
- <tt>-o</tt> or <tt>--old-option</tt> implies that the command uses old long style options with only one dash
|
||||
- <tt>-p</tt> or <tt>--path</tt> implies that the string COMMAND is the full path of the command
|
||||
- <tt>-r</tt> or <tt>--require-parameter</tt> specifies that the option specified by this completion always must have an option argument, i.e. may not be followed by another option
|
||||
- <tt>-u</tt> or <tt>--unauthoritative</tt> implies that there may be more options than the ones specified, and that fish should not assume that options not listed are spelling errors
|
||||
- <tt>-A</tt> or <tt>--authoritative</tt> implies that there may be no more options than the ones specified, and that fish should assume that options not listed are spelling errors
|
||||
- <tt>-x</tt> or <tt>--exclusive</tt> implies both <tt>-r</tt> and <tt>-f</tt>
|
||||
- `COMMAND` is the name of the command for which to add a completion.
|
||||
|
||||
Command specific tab-completions in \c fish are based on the notion
|
||||
of options and arguments. An option is a parameter which begins with a
|
||||
hyphen, such as '-h', '-help' or '--help'. Arguments are parameters
|
||||
that do not begin with a hyphen. Fish recognizes three styles of
|
||||
options, the same styles as the GNU version of the getopt
|
||||
library. These styles are:
|
||||
- `SHORT_OPTION` is a one character option for the command.
|
||||
|
||||
- Short options, like '-a'. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like '-la', which is equivalent to '-l -a'). Option arguments may be specified in the following parameter ('-w 32') or by appending the option with the value ('-w32').
|
||||
- Old style long options, like '-Wall'. Old style long options can be more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('-ao null').
|
||||
- GNU style long options, like '--colors'. GNU style long options can be more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('--quoting-style shell') or by appending the option with a '=' and the value ('--quoting-style=shell'). GNU style long options may be abbreviated so long as the abbreviation is unique ('--h' is equivalent to '--help' if help is the only long option beginning with an 'h').
|
||||
- `LONG_OPTION` is a multi character option for the command.
|
||||
|
||||
The options for specifying command name, command path, or command
|
||||
switches may all be used multiple times to specify multiple commands
|
||||
which have the same completion or multiple switches accepted by a
|
||||
command.
|
||||
- `OPTION_ARGUMENTS` is parameter containing a space-separated list of possible option-arguments, which may contain subshells.
|
||||
|
||||
- `DESCRIPTION` is a description of what the option and/or option arguments do.
|
||||
|
||||
- `-C STRING` or `--do-complete=STRING` makes complete try to find all possible completions for the specified string.
|
||||
|
||||
- `-w WRAPPED_COMMAND` or `--wraps=WRAPPED_COMMAND` causes the specified command to inherit completions from the wrapped command.
|
||||
|
||||
- `-e` or `--erase` implies that the specified completion should be deleted.
|
||||
|
||||
- `-f` or `--no-files` specifies that the option specified by this completion may not be followed by a filename.
|
||||
|
||||
- `-n` or `--condition` specifies a shell command that must return 0 if the completion is to be used. This makes it possible to specify completions that should only be used in some cases.
|
||||
|
||||
- `-o` or `--old-option` implies that the command uses old long style options with only one dash.
|
||||
|
||||
- `-p` or `--path` implies that the string `COMMAND` is the full path of the command.
|
||||
|
||||
- `-r` or `--require-parameter` specifies that the option specified by this completion always must have an option argument, i.e. may not be followed by another option.
|
||||
|
||||
- `-u` or `--unauthoritative` implies that there may be more options than the ones specified, and that fish should not assume that options not listed are spelling errors.
|
||||
|
||||
- `-A` or `--authoritative` implies that there may be no more options than the ones specified, and that fish should assume that options not listed are spelling errors.
|
||||
|
||||
- `-x` or `--exclusive` implies both `-r` and `-f`.
|
||||
|
||||
Command specific tab-completions in `fish` are based on the notion of options and arguments. An option is a parameter which begins with a hyphen, such as '`-h`', '`-help`' or '`--help`'. Arguments are parameters that do not begin with a hyphen. Fish recognizes three styles of options, the same styles as the GNU version of the getopt library. These styles are:
|
||||
|
||||
- Short options, like '`-a`'. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like '`-la`', which is equivalent to '`-l -a`'). Option arguments may be specified in the following parameter ('`-w 32`') or by appending the option with the value ('`-w32`').
|
||||
|
||||
- Old style long options, like '`-Wall`'. Old style long options can be more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('`-ao null`').
|
||||
|
||||
- GNU style long options, like '`--colors`'. GNU style long options can be more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('`--quoting-style`') or by appending the option with a '`=`' and the value ('`--quoting-style=shell`'). GNU style long options may be abbreviated so long as the abbreviation is unique ('`--h`') is equivalent to '`--help`' if help is the only long option beginning with an 'h').
|
||||
|
||||
The options for specifying command name, command path, or command switches may all be used multiple times to specify multiple commands which have the same completion or multiple switches accepted by a command.
|
||||
|
||||
The `-w` or `--wraps` options causes the specified command to inherit completions from another command. The inheriting command is said to "wrap" the inherited command. The wrapping command may have its own completions in addition to inherited ones. A command may wrap multiple commands, and wrapping is transitive: if A wraps B, and B wraps C, then A automatically inherits all of C's completions. Wrapping can be removed using the `-e` or `--erase` options.
|
||||
|
||||
When erasing completions, it is possible to either erase all completions for a specific command by specifying `complete -e -c COMMAND`, or by specifying a specific completion option to delete by specifying either a long, short or old style option.
|
||||
|
||||
When erasing completions, it is possible to either erase all
|
||||
completions for a specific command by specifying <tt>complete -e -c
|
||||
COMMAND</tt>, or by specifying a specific completion option to delete
|
||||
by specifying either a long, short or old style option.
|
||||
|
||||
\subsection complete-example Example
|
||||
|
||||
The short style option <tt>-o</tt> for the \c gcc command requires
|
||||
that a file follows it. This can be done using writing <tt>complete
|
||||
-c gcc -s o -r</tt>.
|
||||
The short style option `-o` for the `gcc` command requires that a file follows it. This can be done using writing:
|
||||
|
||||
The short style option <tt>-d</tt> for the \c grep command requires
|
||||
that one of the strings 'read', 'skip' or 'recurse' is used. This can
|
||||
be specified writing <tt>complete -c grep -s d -x -a "read skip
|
||||
recurse"</tt>.
|
||||
\fish
|
||||
complete -c gcc -s o -r
|
||||
\endfish
|
||||
|
||||
The \c su command takes any username as an argument. Usernames are
|
||||
given as the first colon-separated field in the file /etc/passwd. This
|
||||
can be specified as: <tt>complete -x -c su -d "Username" -a "(cat
|
||||
/etc/passwd|cut -d : -f 1)" </tt>.
|
||||
The short style option `-d` for the `grep` command requires that one of the strings '`read`', '`skip`' or '`recurse`' is used. This can be specified writing:
|
||||
|
||||
The \c rpm command has several different modes. If the \c -e or \c
|
||||
--erase flag has been specified, \c rpm should delete one or more
|
||||
packages, in which case several switches related to deleting packages
|
||||
are valid, like the \c nodeps switch.
|
||||
\fish
|
||||
complete -c grep -s d -x -a "read skip recurse"
|
||||
\endfish
|
||||
|
||||
The `su` command takes any username as an argument. Usernames are given as the first colon-separated field in the file /etc/passwd. This can be specified as:
|
||||
|
||||
\fish
|
||||
complete -x -c su -d "Username" -a "(cat /etc/passwd | cut -d : -f 1)"
|
||||
\endfish
|
||||
|
||||
The `rpm` command has several different modes. If the `-e` or `--erase` flag has been specified, `rpm` should delete one or more packages, in which case several switches related to deleting packages are valid, like the `nodeps` switch.
|
||||
|
||||
This can be written as:
|
||||
|
||||
<tt>complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d
|
||||
"Don't check dependencies"</tt>
|
||||
\fish
|
||||
complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d "Don't check dependencies"
|
||||
\endfish
|
||||
|
||||
where \c __fish_contains_opt is a function that checks the commandline
|
||||
buffer for the presence of a specified set of options.
|
||||
where `__fish_contains_opt` is a function that checks the commandline buffer for the presence of a specified set of options.
|
||||
|
||||
To implement an alias, use the `-w` or `--wraps` option:
|
||||
|
||||
\fish
|
||||
complete -c hub -w git
|
||||
\endfish
|
||||
|
||||
Now hub inherits all of the completions from git. Note this can also be specified in a function declaration.
|
||||
|
||||
|
||||
@@ -1,26 +1,38 @@
|
||||
\section contains contains - test if a word is present in a list
|
||||
|
||||
\subsection contains-synopsis Synopsis
|
||||
<code>contains [OPTIONS] KEY [VALUES...]</code>
|
||||
\fish{synopsis}
|
||||
contains [OPTIONS] KEY [VALUES...]
|
||||
\endfish
|
||||
|
||||
\subsection contains-description Description
|
||||
|
||||
\c contains tests whether the set \c VALUES contains the string
|
||||
<code>KEY</code>. If so, \c contains exits with status 0; if not, it exits
|
||||
with status 1.
|
||||
`contains` tests whether the set `VALUES` contains the string `KEY`. If so, `contains` exits with status 0; if not, it exits with status 1.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- \c -i or \c --index print the word index
|
||||
- \c -h or \c --help display this message
|
||||
- `-i` or `--index` print the word index
|
||||
|
||||
Note that, like GNU tools, `contains` interprets all arguments starting with a `-` as options to contains, until it reaches an argument that is `--` (two dashes). See the examples below.
|
||||
|
||||
\subsection contains-example Example
|
||||
<pre>
|
||||
for i in ~/bin /usr/local/bin
|
||||
if not contains \$i \$PATH
|
||||
set PATH \$PATH \$i
|
||||
end
|
||||
end
|
||||
</pre>
|
||||
|
||||
The above code tests if \c ~/bin and \c /usr/local/bin are in the path and adds them if not.
|
||||
\fish
|
||||
for i in ~/bin /usr/local/bin
|
||||
if not contains $i $PATH
|
||||
set PATH $PATH $i
|
||||
end
|
||||
end
|
||||
\endfish
|
||||
|
||||
The above code tests if `~/bin` and `/usr/local/bin` are in the path and adds them if not.
|
||||
|
||||
\fish
|
||||
function hasargs
|
||||
if contains -- -q $argv
|
||||
echo '$argv contains a -q option'
|
||||
end
|
||||
end
|
||||
\endfish
|
||||
|
||||
The above code checks for `-q` in the argument list, using the `--` argument to demarcate options to `contains` from the key to search for.
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
\section continue continue - skip the remainder of the current iteration of the current inner loop
|
||||
|
||||
\subsection continue-synopsis Synopsis
|
||||
<tt>LOOP_CONSTRUCT; [COMMANDS...;] continue; [COMMANDS...;] end</tt>
|
||||
\fish{synopsis}
|
||||
LOOP_CONSTRUCT; [COMMANDS...;] continue; [COMMANDS...;] end
|
||||
\endfish
|
||||
|
||||
\subsection continue-description Description
|
||||
\c continue skips the remainder of the current iteration of the current inner loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. It is usually added inside of a conditional block such as an <a href="#if">if</a> statement or a <a href="#switch">switch</a> statement.
|
||||
|
||||
`continue` skips the remainder of the current iteration of the current inner loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. It is usually added inside of a conditional block such as an <a href="#if">if</a> statement or a <a href="#switch">switch</a> statement.
|
||||
|
||||
\subsection continue-example Example
|
||||
|
||||
The following code removes all tmp files that do not contain the word smurf.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
for i in *.tmp
|
||||
if grep smurf $i
|
||||
continue
|
||||
end
|
||||
rm $i
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
@@ -1,29 +1,25 @@
|
||||
\section count count - count the number of elements of an array
|
||||
|
||||
\subsection count-synopsis Synopsis
|
||||
<tt>count $VARIABLE</tt>
|
||||
\fish{synopsis}
|
||||
count $VARIABLE
|
||||
\endfish
|
||||
|
||||
\subsection count-description Description
|
||||
|
||||
<tt>count</tt> prints the number of arguments that were
|
||||
passed to it. This is usually used to find out how many elements an
|
||||
environment variable array contains.
|
||||
`count` prints the number of arguments that were passed to it. This is usually used to find out how many elements an environment variable array contains.
|
||||
|
||||
\c count does not accept any options, including '-h'.
|
||||
`count` does not accept any options, including `-h` or `--help`.
|
||||
|
||||
`count` exits with a non-zero exit status if no arguments were passed to it, and with zero if at least one argument was passed.
|
||||
|
||||
\c count exits with a non-zero exit status if no arguments were passed
|
||||
to it, and with zero if at least one argument was passed.
|
||||
|
||||
\subsection count-example Example
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
count $PATH
|
||||
</pre>
|
||||
# Returns the number of directories in the users PATH variable.
|
||||
|
||||
returns the number of directories in the users PATH variable.
|
||||
|
||||
<pre>
|
||||
count *.txt
|
||||
</pre>
|
||||
|
||||
returns the number of files in the current working directory ending with the suffix '.txt'.
|
||||
# Returns the number of files in the current working directory ending with the suffix '.txt'.
|
||||
\endfish
|
||||
@@ -1,138 +1,110 @@
|
||||
/** \page design Design document
|
||||
|
||||
\htmlonly <div class="fish_only_bar"> \endhtmlonly
|
||||
/**
|
||||
\page design Design document
|
||||
\htmlonly[block]
|
||||
<div class="fish_only_bar">
|
||||
<div class="design">
|
||||
<h1 class="interior_title">Design documentation</h1>
|
||||
\endhtmlonly
|
||||
|
||||
\section design-overview Overview
|
||||
|
||||
This is a description of the design principles that have been used to
|
||||
design fish. The fish design has three high level goals. These are:
|
||||
This is a description of the design principles that have been used to design fish. The fish design has three high level goals. These are:
|
||||
|
||||
-# Everything that can be done in other shell languages should be
|
||||
possible to do in fish, though fish may rely on external commands in
|
||||
doing so.
|
||||
-# Fish should be user friendly, but not at the expense of expressiveness.
|
||||
Most tradeoffs between power and ease of use can be avoided with careful design.
|
||||
-# Whenever possible without breaking the above goals, fish should
|
||||
follow the Posix syntax.
|
||||
-# Everything that can be done in other shell languages should be possible to do in fish, though fish may rely on external commands in doing so.
|
||||
|
||||
-# Fish should be user friendly, but not at the expense of expressiveness. Most tradeoffs between power and ease of use can be avoided with careful design.
|
||||
|
||||
-# Whenever possible without breaking the above goals, fish should follow the Posix syntax.
|
||||
|
||||
To achieve these high-level goals, the fish design relies on a number of more specific design principles. These are presented below, together with a rationale and a few examples for each.
|
||||
|
||||
To achieve these high-level goals, the fish design relies on a number
|
||||
of more specific design principles. These are presented below,
|
||||
together with a rationale and a few examples for each.
|
||||
|
||||
\section ortho The law of orthogonality
|
||||
|
||||
The shell language should have a small set of orthogonal features. Any
|
||||
situation where two features are related but not identical, one of them
|
||||
should be removed, and the other should be made powerful and general
|
||||
enough to handle all common use cases of either feature.
|
||||
The shell language should have a small set of orthogonal features. Any situation where two features are related but not identical, one of them should be removed, and the other should be made powerful and general enough to handle all common use cases of either feature.
|
||||
|
||||
Rationale:
|
||||
|
||||
Related features make the language larger, which makes it harder to
|
||||
learn. It also increases the size of the sourcecode, making the
|
||||
program harder to maintain and update.
|
||||
Related features make the language larger, which makes it harder to learn. It also increases the size of the source code, making the program harder to maintain and update.
|
||||
|
||||
Examples:
|
||||
|
||||
- Here documents are too similar to using echo inside of a pipeline.
|
||||
- Subshells, command substitution and process substitution are strongly related. \c fish only supports command substitution, the others can be achieved either using a block or the psub shellscript function.
|
||||
- Having both aliases and functions is confusing, especially since both of them have limitations and problems. \c fish functions have none of the drawbacks of either syntax.
|
||||
- The many Posix quoting styles are silly, especially \$''.
|
||||
|
||||
\section sep The law of responsiveness
|
||||
- Subshells, command substitution and process substitution are strongly related. `fish` only supports command substitution, the others can be achieved either using a block or the psub shellscript function.
|
||||
|
||||
- Having both aliases and functions is confusing, especially since both of them have limitations and problems. `fish` functions have none of the drawbacks of either syntax.
|
||||
|
||||
- The many Posix quoting styles are silly, especially $''.
|
||||
|
||||
|
||||
\section design-response The law of responsiveness
|
||||
|
||||
The shell should attempt to remain responsive to the user at all times, even in the face of contended or unresponsive filesystems. It is only acceptable to block in response to a user initiated action, such as running a command.
|
||||
|
||||
Rationale:
|
||||
|
||||
Bad performance increases user-facing complexity, because it trains users to recognize and route around slow use cases. It is also incredibly frustrating.
|
||||
|
||||
Examples:
|
||||
|
||||
- Features like syntax highlighting and autosuggestions must perform all of their disk I/O asynchronously.
|
||||
|
||||
- Startup should minimize forks and disk I/O, so that fish can be started even if the system is under load.
|
||||
|
||||
\section conf Configurability is the root of all evil
|
||||
\section design-configurability Configurability is the root of all evil
|
||||
|
||||
Every configuration option in a program is a place where the program
|
||||
is too stupid to figure out for itself what the user really wants, and
|
||||
should be considered a failiure of both the program and the programmer
|
||||
who implemented it.
|
||||
Every configuration option in a program is a place where the program is too stupid to figure out for itself what the user really wants, and should be considered a failure of both the program and the programmer who implemented it.
|
||||
|
||||
Rationale:
|
||||
|
||||
Different configuration options are a nightmare to maintain, since the
|
||||
number of potential bugs caused by specific configuration combinations
|
||||
quickly becomes an issue. Configuration options often imply
|
||||
assumptions about the code which change when reimplementing the code,
|
||||
causing issues with backwards compatibility. But mostly, configuration
|
||||
options should be avoided since they simply should not exist, as the
|
||||
program should be smart enough to do what is best, or at least a good
|
||||
enough approximation of it.
|
||||
Different configuration options are a nightmare to maintain, since the number of potential bugs caused by specific configuration combinations quickly becomes an issue. Configuration options often imply assumptions about the code which change when reimplementing the code, causing issues with backwards compatibility. But mostly, configuration options should be avoided since they simply should not exist, as the program should be smart enough to do what is best, or at least a good enough approximation of it.
|
||||
|
||||
Examples:
|
||||
|
||||
- Fish allows the user to set various syntax highlighting colors. This is needed because fish does not know what colors the terminal uses by default, which might make some things unreadable. The proper solution would be for text color preferences to be defined centrally by the user for all programs, and for the terminal emulator to send these color properties to fish.
|
||||
|
||||
- Fish does not allow you to set the history filename, the number of history entries, different language substyles or any number of other common shell configuration options.
|
||||
|
||||
A special note on the evils of configurability is the long list of
|
||||
very useful features found in some shells, that are not turned on by
|
||||
default. Both zsh and bash support command specific completions, but
|
||||
no such completions are shipped with bash by default, and they are
|
||||
turned off by default in zsh. Other features that zsh support that are
|
||||
disabled by default include tab-completion of strings containing
|
||||
wildcards, a sane completion pager and a history file.
|
||||
A special note on the evils of configurability is the long list of very useful features found in some shells, that are not turned on by default. Both zsh and bash support command-specific completions, but no such completions are shipped with bash by default, and they are turned off by default in zsh. Other features that zsh supports that are disabled by default include tab-completion of strings containing wildcards, a sane completion pager and a history file.
|
||||
|
||||
\section user The law of user focus
|
||||
|
||||
When designing a program, one should first think about how to make a
|
||||
intuitive and powerful program. Implementation issues should only be
|
||||
considered once a user interface has been designed.
|
||||
When designing a program, one should first think about how to make a intuitive and powerful program. Implementation issues should only be considered once a user interface has been designed.
|
||||
|
||||
Rationale:
|
||||
|
||||
This design rule is different than the others, since it describes how
|
||||
one should go about designing new features, not what the features
|
||||
should be. The problem with focusing on what can be done, and what is
|
||||
easy to do, is that to much of the implementation is exposed. This
|
||||
means that the user must know a great deal about the underlying system
|
||||
to be able to guess how the shell works, it also means that the
|
||||
language will often be rather low-level.
|
||||
This design rule is different than the others, since it describes how one should go about designing new features, not what the features should be. The problem with focusing on what can be done, and what is easy to do, is that too much of the implementation is exposed. This means that the user must know a great deal about the underlying system to be able to guess how the shell works, it also means that the language will often be rather low-level.
|
||||
|
||||
Examples:
|
||||
|
||||
- There should only be one type of input to the shell, lists of commands. Loops, conditionals and variable assignments are all performed through regular commands.
|
||||
- The differences between builtin commands and shellscript functions should be made as small as possible. Builtins and shellscript functions should have exactly the same types of argument expansion as other commands, should be possible to use in any position in a pipeline, and should support any io redirection.
|
||||
|
||||
- The differences between built-in commands and shellscript functions should be made as small as possible. Built-ins and shellscript functions should have exactly the same types of argument expansion as other commands, should be possible to use in any position in a pipeline, and should support any I/O redirection.
|
||||
|
||||
- Instead of forking when performing command substitution to provide a fake variable scope, all fish commands are performed from the same process, and fish instead supports true scoping.
|
||||
- All blocks end with the \c end builtin.
|
||||
|
||||
- All blocks end with the `end` built-in.
|
||||
|
||||
\section disc The law of discoverability
|
||||
|
||||
A program should be designed to make its features as
|
||||
easy as possible to discover for the user.
|
||||
A program should be designed to make its features as easy as possible to discover for the user.
|
||||
|
||||
Rationale:
|
||||
A program whose features are discoverable turns a new user into an expert in a shorter span of time, since the user will become an expert on the program simply by using it.
|
||||
|
||||
A program whose features are discoverable turns a new user into an
|
||||
expert in a shorter span of time, since the user will become an expert
|
||||
on the program simply by using it.
|
||||
|
||||
The main benefit of a graphical program over a command line-based
|
||||
program is discoverability. In a graphical program, one can discover
|
||||
all the common features by simply looking at the user interface and
|
||||
guessing what the different buttons, menus and other widgets do. The
|
||||
traditional way to discover features in commandline programs is
|
||||
through manual pages. This requires both that the user starts to use a
|
||||
different program, and the she/he then remembers the new information
|
||||
until the next time she/he uses the same program.
|
||||
The main benefit of a graphical program over a command-line-based program is discoverability. In a graphical program, one can discover all the common features by simply looking at the user interface and guessing what the different buttons, menus and other widgets do. The traditional way to discover features in command-line programs is through manual pages. This requires both that the user starts to use a different program, and then she/he remembers the new information until the next time she/he uses the same program.
|
||||
|
||||
Examples:
|
||||
|
||||
- Everything should be tab-completable, and every tab completion should have a description.
|
||||
- Every syntax error and error in a builtin command should contain an error message describing what went wrong and a relevant help page. Whenever possible, errors should be flagged red by the syntax highlighter.
|
||||
|
||||
- Every syntax error and error in a built-in command should contain an error message describing what went wrong and a relevant help page. Whenever possible, errors should be flagged red by the syntax highlighter.
|
||||
|
||||
- The help manual should be easy to read, easily available from the shell, complete and contain many examples
|
||||
- The language should be uniform, so that once the user understands the command/argument syntax, he will know the whole language, and be able to use tab-completion to discover new featues.
|
||||
|
||||
- The language should be uniform, so that once the user understands the command/argument syntax, she/he will know the whole language, and be able to use tab-completion to discover new features.
|
||||
|
||||
|
||||
\htmlonly[block]
|
||||
</div>
|
||||
</div>
|
||||
\endhtmlonly
|
||||
|
||||
*/
|
||||
|
||||
\htmlonly </div> \endhtmlonly
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
\section dirh dirh - print directory history
|
||||
|
||||
\subsection dirh-synopsis Synopsis
|
||||
<tt>dirh</tt>
|
||||
\fish{synopsis}
|
||||
dirh
|
||||
\endfish
|
||||
|
||||
\subsection dirh-description Description
|
||||
|
||||
<tt>dirh</tt> prints the current directory history. The current position in the
|
||||
history is highlighted using the color defined in the
|
||||
<tt>fish_color_history_current</tt> environment variable.
|
||||
`dirh` prints the current directory history. The current position in the history is highlighted using the color defined in the `fish_color_history_current` environment variable.
|
||||
|
||||
\c dirh does not accept any parameters.
|
||||
`dirh` does not accept any parameters.
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
\section dirs dirs - print directory stack
|
||||
|
||||
\subsection dirs-synopsis Synopsis
|
||||
<tt>dirs</tt>
|
||||
\fish{synopsis}
|
||||
dirs
|
||||
\endfish
|
||||
|
||||
\subsection dirs-description Description
|
||||
<tt>dirs</tt> prints the current directory stack, as created by the
|
||||
<code><a href="#pushd">pushd</a></code> command.
|
||||
|
||||
\c dirs does not accept any parameters.
|
||||
`dirs` prints the current directory stack, as created by the <a href="#pushd">`pushd`</a> command.
|
||||
|
||||
`dirs` does not accept any parameters.
|
||||
|
||||
@@ -1,39 +1,60 @@
|
||||
\section echo echo - display a line of text
|
||||
|
||||
\subsection echo-synopsis Synopsis
|
||||
<tt>echo [STRING]</tt>
|
||||
\fish{synopsis}
|
||||
echo [OPTIONS] [STRING]
|
||||
\endfish
|
||||
|
||||
\subsection echo-description Description
|
||||
|
||||
\c echo displays a string of text.
|
||||
`echo` displays a string of text.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- \c -n, \c Do not output a newline
|
||||
- \c -s, \c Do not separate arguments with spaces
|
||||
- \c -E, \c Disable interpretation of backslash escapes (default)
|
||||
- \c -e, \c Enable interpretation of backslash escapes
|
||||
- \c -h, \c --help Display this help
|
||||
- `-n`, Do not output a newline
|
||||
|
||||
- `-s`, Do not separate arguments with spaces
|
||||
|
||||
- `-E`, Disable interpretation of backslash escapes (default)
|
||||
|
||||
- `-e`, Enable interpretation of backslash escapes
|
||||
|
||||
\subsection echo-escapes Escape Sequences
|
||||
|
||||
If \c -e is used, the following sequences are recognized:
|
||||
If `-e` is used, the following sequences are recognized:
|
||||
|
||||
- \c \\\\ \c backslash
|
||||
- \\a alert (BEL)
|
||||
- \\b backspace
|
||||
- \\c produce no further output
|
||||
- \\e escape
|
||||
- \\f form feed
|
||||
- \\n new line
|
||||
- \\r carriage return
|
||||
- \\t horizontal tab
|
||||
- \\v vertical tab
|
||||
- \\0NNN byte with octal value NNN (1 to 3 digits)
|
||||
- \\xHH byte with hexadecimal value HH (1 to 2 digits)
|
||||
- `\` backslash
|
||||
|
||||
- `\a` alert (BEL)
|
||||
|
||||
- `\b` backspace
|
||||
|
||||
- `\c` produce no further output
|
||||
|
||||
- `\e` escape
|
||||
|
||||
- `\f` form feed
|
||||
|
||||
- `\n` new line
|
||||
|
||||
- `\r` carriage return
|
||||
|
||||
- `\t` horizontal tab
|
||||
|
||||
- `\v` vertical tab
|
||||
|
||||
- `\0NNN` byte with octal value NNN (1 to 3 digits)
|
||||
|
||||
- `\xHH` byte with hexadecimal value HH (1 to 2 digits)
|
||||
|
||||
\subsection echo-example Example
|
||||
|
||||
<tt>echo 'Hello World'</tt> Print hello world to stdout
|
||||
\fish
|
||||
echo 'Hello World'
|
||||
\endfish
|
||||
Print hello world to stdout
|
||||
|
||||
<tt>echo -e 'Top\\nBottom'</tt> Print Top and Bottom on separate lines, using an escape sequence
|
||||
\fish
|
||||
echo -e 'Top\nBottom'
|
||||
\endfish
|
||||
Print Top and Bottom on separate lines, using an escape sequence
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
\section else else - execute command if a condition is not met
|
||||
|
||||
\subsection else-synopsis Synopsis
|
||||
<tt>if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end</tt>
|
||||
\fish{synopsis}
|
||||
if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end
|
||||
\endfish
|
||||
|
||||
\subsection else-description Description
|
||||
<tt>if</tt> will execute the command \c CONDITION. If the condition's exit
|
||||
status is 0, the commands \c COMMANDS_TRUE will execute. If it is not 0 and
|
||||
<tt>else</tt> is given, \c COMMANDS_FALSE will be executed.
|
||||
|
||||
`if` will execute the command `CONDITION`. If the condition's exit status is 0, the commands `COMMANDS_TRUE` will execute. If it is not 0 and `else` is given, `COMMANDS_FALSE` will be executed.
|
||||
|
||||
|
||||
\subsection else-example Example
|
||||
|
||||
The following code tests whether a file \c foo.txt exists as a regular file.
|
||||
The following code tests whether a file `foo.txt` exists as a regular file.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
if test -f foo.txt
|
||||
echo foo.txt exists
|
||||
else
|
||||
echo foo.txt does not exist
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
\section emit emit - Emit a generic event
|
||||
|
||||
\subsection block-synopsis Synopsis
|
||||
<tt>emit EVENT_NAME [ARGUMENTS...]</tt>
|
||||
\subsection emit-synopsis Synopsis
|
||||
\fish{synopsis}
|
||||
emit EVENT_NAME [ARGUMENTS...]
|
||||
\endfish
|
||||
|
||||
\subsection emit-description Description
|
||||
|
||||
\c emit emits, or fires, an event. Events are delivered to, or caught by, special functions called event handlers. The arguments are passed to the event handlers as function arguments.
|
||||
`emit` emits, or fires, an event. Events are delivered to, or caught by, special functions called event handlers. The arguments are passed to the event handlers as function arguments.
|
||||
|
||||
|
||||
\subsection emit-example Example
|
||||
|
||||
The following code first defines an event handler for the generic
|
||||
event named 'test_event', and then emits an event of that type.
|
||||
The following code first defines an event handler for the generic event named 'test_event', and then emits an event of that type.
|
||||
|
||||
<pre>function event_test --on-event test_event
|
||||
\fish
|
||||
function event_test --on-event test_event
|
||||
echo event test: $argv
|
||||
end
|
||||
|
||||
emit test_event something
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
\section end end - end a block of commands.
|
||||
|
||||
\subsection end-synopsis Synopsis
|
||||
<pre>
|
||||
\fish{synopsis}
|
||||
begin; [COMMANDS...] end
|
||||
if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end
|
||||
while CONDITION; COMMANDS...; end
|
||||
for VARNAME in [VALUES...]; COMMANDS...; end
|
||||
switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
\subsection end-description Description
|
||||
<tt>end</tt> ends a block of commands.
|
||||
|
||||
`end` ends a block of commands.
|
||||
|
||||
For more information, read the
|
||||
documentation for the block constructs, such as \c if, \c for and \c
|
||||
while.
|
||||
documentation for the block constructs, such as `if`, `for` and `while`.
|
||||
|
||||
The \c end command does not change the current exit status.
|
||||
The `end` command does not change the current exit status.
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
\section eval eval - evaluate the specified commands
|
||||
|
||||
\subsection eval-synopsis Synopsis
|
||||
<tt>eval [COMMANDS...]</tt>
|
||||
\fish{synopsis}
|
||||
eval [COMMANDS...]
|
||||
\endfish
|
||||
|
||||
\subsection eval-description Description
|
||||
<tt>eval</tt> evaluates the specified parameters as a command. If more than one parameter is specified, all parameters will be joined using a space character as a separator.
|
||||
`eval` evaluates the specified parameters as a command. If more than one parameter is specified, all parameters will be joined using a space character as a separator.
|
||||
|
||||
|
||||
\subsection eval-example Example
|
||||
|
||||
The following code will call the ls command. Note that \c fish does not
|
||||
support the use of environment variables as direct commands; \c eval can
|
||||
be used to work around this.
|
||||
The following code will call the ls command. Note that `fish` does not support the use of shell variables as direct commands; `eval` can be used to work around this.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
set cmd ls
|
||||
eval $cmd
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
\section exec exec - execute command in current process
|
||||
|
||||
\subsection exec-synopsis Synopsis
|
||||
<tt>exec COMMAND [OPTIONS...]</tt>
|
||||
\fish{synopsis}
|
||||
exec COMMAND [OPTIONS...]
|
||||
\endfish
|
||||
|
||||
\subsection exec-description Description
|
||||
|
||||
\c exec replaces the currently running shell with a new command.
|
||||
On successful completion, \c exec never returns. \c exec cannot be used
|
||||
inside a pipeline.
|
||||
`exec` replaces the currently running shell with a new command. On successful completion, `exec` never returns. `exec` cannot be used inside a pipeline.
|
||||
|
||||
|
||||
\subsection exec-example Example
|
||||
|
||||
<tt>exec emacs</tt> starts up the emacs text editor, and exits \c fish.
|
||||
When emacs exits, the session will terminate.
|
||||
`exec emacs` starts up the emacs text editor, and exits `fish`. When emacs exits, the session will terminate.
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
\section exit exit - exit the shell
|
||||
|
||||
\subsection exit-synopsis Synopsis
|
||||
<tt>exit [STATUS]</tt>
|
||||
\fish{synopsis}
|
||||
exit [STATUS]
|
||||
\endfish
|
||||
|
||||
\subsection exit-description Description
|
||||
|
||||
\c exit causes fish to exit. If <tt>STATUS</tt> is
|
||||
supplied, it will be converted to an integer and used as the exit
|
||||
code. Otherwise, the exit code will be that of the last command executed.
|
||||
`exit` causes fish to exit. If `STATUS` is supplied, it will be converted to an integer and used as the exit code. Otherwise, the exit code will be that of the last command executed.
|
||||
|
||||
If exit is called while sourcing a file (using the <a
|
||||
href="#source">.</a> builtin) the rest of the file will be skipped,
|
||||
but the shell itself will not exit.
|
||||
If exit is called while sourcing a file (using the <a href="#source">source</a> builtin) the rest of the file will be skipped, but the shell itself will not exit.
|
||||
|
||||
10
doc_src/false.txt
Normal file
10
doc_src/false.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
\section false false - return an unsuccessful result
|
||||
|
||||
\subsection false-synopsis Synopsis
|
||||
\fish{synopsis}
|
||||
false
|
||||
\endfish
|
||||
|
||||
\subsection false-description Description
|
||||
|
||||
`false` sets the exit status to 1.
|
||||
232
doc_src/faq.hdr
232
doc_src/faq.hdr
@@ -1,9 +1,14 @@
|
||||
/** \page faq Frequently asked questions
|
||||
/**
|
||||
\page faq Frequently asked questions
|
||||
\htmlonly[block]
|
||||
<div class="fish_left_bar">
|
||||
<div class="logo"></div>
|
||||
<div class="menu faq_menu">
|
||||
|
||||
\htmlonly <div class="fish_left_bar fish_left_big"> \endhtmlonly
|
||||
\endhtmlonly
|
||||
|
||||
- <a href='#faq-envvar'>How do I set or clear an environment variable?</a>
|
||||
- <a href='#faq-login-cmd'>How do I run a command every login? What's fish's equivalent to <tt>.bashrc</tt>?</a>
|
||||
- <a href='#faq-login-cmd'>How do I run a command every login? What's fish's equivalent to `.bashrc`?</a>
|
||||
- <a href='#faq-prompt'>How do I set my prompt?</a>
|
||||
- <a href='#faq-cmd-history'>How do I run a command from history?</a>
|
||||
- <a href='#faq-subcommand'>How do I run a subcommand? The backtick doesn't work!</a>
|
||||
@@ -20,257 +25,198 @@
|
||||
- <a href='#faq-history'>Why doesn't history substitution ("!$" etc.) work?</a>
|
||||
- <a href='#faq-uninstalling'>How do I uninstall fish?</a>
|
||||
|
||||
\htmlonly
|
||||
\htmlonly[block]
|
||||
</div>
|
||||
<div class="fish_right_bar fish_right_little">
|
||||
</div>
|
||||
<div class="faq fish_right_bar">
|
||||
<h1 class="interior_title">Frequently Asked Questions</h1>
|
||||
|
||||
\endhtmlonly
|
||||
|
||||
|
||||
\section faq-envvar How do I set or clear an environment variable?
|
||||
|
||||
Use the <a href="commands.html#set"><code>set</code></a> command:
|
||||
Use the <a href="commands.html#set">`set`</a> command:
|
||||
|
||||
<pre>set -x key value
|
||||
set -e key</pre>
|
||||
\fish{cli-dark}
|
||||
set -x key value
|
||||
set -e key
|
||||
\endfish
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-login-cmd How do I run a command every login? What's fish's equivalent to .bashrc?
|
||||
|
||||
Edit the file <tt>~/.config/fish/config.fish</tt>, creating it if it does not
|
||||
exist. (Note the leading period.)
|
||||
Edit the file `~/.config/fish/config.fish`, creating it if it does not exist (Note the leading period).
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-prompt How do I set my prompt?
|
||||
|
||||
The prompt is the output of the \c fish_prompt function. Put it in
|
||||
<tt>~/.config/fish/functions/fish_prompt.fish</tt>. For example, a simple
|
||||
prompt is:
|
||||
<pre>function fish_prompt
|
||||
set_color $fish_color_cwd
|
||||
echo -n (prompt_pwd)
|
||||
set_color normal
|
||||
echo -n ' > '
|
||||
end</pre>
|
||||
The prompt is the output of the `fish_prompt` function. Put it in `~/.config/fish/functions/fish_prompt.fish`. For example, a simple prompt is:
|
||||
|
||||
You can also use the Web configuration tool,
|
||||
<a href="commands.html#fish_config"><code>fish_config</code></a>, to preview
|
||||
and choose from a gallery of sample prompts.
|
||||
\fish{cli-dark}
|
||||
function fish_prompt
|
||||
set_color $fish_color_cwd
|
||||
echo -n (prompt_pwd)
|
||||
set_color normal
|
||||
echo -n ' > '
|
||||
end
|
||||
\endfish
|
||||
|
||||
You can also use the Web configuration tool, <a href="commands.html#fish_config">`fish_config`</a>, to preview and choose from a gallery of sample prompts.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-cmd-history How do I run a command from history?
|
||||
|
||||
Type some part of the command, and then hit the up or down arrow keys to
|
||||
navigate through history matches.
|
||||
Type some part of the command, and then hit the @cursor_key{↑,up} or @cursor_key{↓,down} arrow keys to navigate through history matches.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-subcommand How do I run a subcommand? The backtick doesn't work!
|
||||
|
||||
\c fish uses parentheses for subcommands. For example:
|
||||
`fish` uses parentheses for subcommands. For example:
|
||||
|
||||
<pre>for i in (ls)
|
||||
echo $i
|
||||
end</pre>
|
||||
\fish{cli-dark}
|
||||
for i in (ls)
|
||||
echo $i
|
||||
end
|
||||
\endfish
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-exit-status How do I get the exit status of a command?
|
||||
|
||||
Use the \c $status variable. This replaces the \c $? variable used in some
|
||||
other shells.
|
||||
Use the `$status` variable. This replaces the `$?` variable used in some other shells.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-single-env How do I set an environment variable for just one command?
|
||||
|
||||
<i><tt>SOME_VAR=1 command</tt> produces an error: <tt>Unknown command "SOME_VAR=1"</tt>.</i>
|
||||
<i>`SOME_VAR=1 command` produces an error: `Unknown command "SOME_VAR=1"`.</i>
|
||||
|
||||
Use the \c env command.
|
||||
Use the `env` command.
|
||||
|
||||
<tt>env SOME_VAR=1 command</tt>
|
||||
`env SOME_VAR=1 command`
|
||||
|
||||
You can also declare a local variable in a block:
|
||||
|
||||
<pre>begin
|
||||
set -lx SOME_VAR 1
|
||||
command
|
||||
end</pre>
|
||||
\fish{cli-dark}
|
||||
begin
|
||||
set -lx SOME_VAR 1
|
||||
command
|
||||
end
|
||||
\endfish
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-customize-colors How do I customize my syntax highlighting colors?
|
||||
|
||||
Use the web configuration tool,
|
||||
<a href="commands.html#fish_config"><code>fish_config</code></a>, or alter the
|
||||
<a href="index.html#variables-color">\c fish_color family of environment variables</a>.
|
||||
Use the web configuration tool, <a href="commands.html#fish_config">`fish_config`</a>, or alter the <a href="index.html#variables-color">`fish_color` family of environment variables</a>.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-update-manpage-completions How do I update man page completions?
|
||||
|
||||
Use the
|
||||
<a href="commands.html#fish_update_completions"><tt>fish_update_completions</tt></a>
|
||||
command.
|
||||
Use the <a href="commands.html#fish_update_completions">`fish_update_completions`</a> command.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-cwd-symlink Why does cd, $PWD and and various fish commands always resolve symlinked directories to their canonical path?
|
||||
|
||||
<i>
|
||||
For example if ~/images is a symlink to ~/Documents/Images, if I write
|
||||
'cd images', my prompt will say ~/D/Images, not ~/images.
|
||||
</i>
|
||||
<i>For example if `~/images` is a symlink to `~/Documents/Images`, if I write '`cd images`', my prompt will say `~/Documents/Images`, not `~/images`.</i>
|
||||
|
||||
Because it is impossible to consistently keep symlinked directories
|
||||
unresolved. It is indeed possible to do this partially, and many other
|
||||
shells do so. But it was felt there are enough serious corner cases
|
||||
that this is a bad idea. Most such issues have to do with how '..' is
|
||||
handled, and are varitations of the following example:
|
||||
Because it is impossible to consistently keep symlinked directories unresolved. It is indeed possible to do this partially, and many other shells do so. But it was felt there are enough serious corner cases that this is a bad idea. Most such issues have to do with how '..' is handled, and are varitations of the following example:
|
||||
|
||||
Writing <code>cd images; ls ..</code> given the above directory
|
||||
structure would list the contents of ~/Documents, not of ~, even
|
||||
though using <code>cd ..</code> changes the current directory to ~,
|
||||
and the prompt, the pwd builtin and many other directory information
|
||||
sources suggest that the current directory is ~/images and its
|
||||
parent is ~. This issue is not possible to fix without either making
|
||||
every single command into a builtin, breaking Unix semantics or
|
||||
implementing kludges in every single command.
|
||||
Writing `cd images; ls ..` given the above directory structure would list the contents of `~/Documents`, not of `~`, even though using `cd ..` changes the current directory to `~`, and the prompt, the `pwd` builtin and many other directory information sources suggest that the current directory is `~/images` and its parent is `~`. This issue is not possible to fix without either making every single command into a builtin, breaking Unix semantics or implementing kludges in every single command. This issue can also be seen when doing IO redirection.
|
||||
|
||||
This issue can also be seen when doing IO redirection.
|
||||
|
||||
Another related issue is that many programs that operate on recursive
|
||||
directory trees, like the find command, silently ignore symlinked
|
||||
directories. For example, <code>find $PWD -name '*.txt'</code>
|
||||
silently fails in shells that don't resolve symlinked paths.
|
||||
Another related issue is that many programs that operate on recursive directory trees, like the find command, silently ignore symlinked directories. For example, ```find $PWD -name '*.txt'``` silently fails in shells that don't resolve symlinked paths.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-cd-implicit I accidentally entered a directory path and fish changed directory. What happened?
|
||||
|
||||
If fish is unable to locate a command with a given name, and it starts with '.', '/' or '~', fish will
|
||||
test if a directory of that name exists. If it does, it is implicitly
|
||||
assumed that you want to change working directory. For example, the
|
||||
fastest way to switch to your home directory is to simply press
|
||||
<code>~</code> and enter.
|
||||
If fish is unable to locate a command with a given name, and it starts with '`.`', '`/`' or '`~`', fish will test if a directory of that name exists. If it does, it is implicitly assumed that you want to change working directory. For example, the fastest way to switch to your home directory is to simply press `~` and enter.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-open The open command doesn't work.
|
||||
|
||||
The \c open command uses the MIME type database and the <code>.desktop</code> files
|
||||
used by Gnome and KDE to identify filetypes and default actions. If
|
||||
at least one of these environments is installed, but the open command is
|
||||
not working, this probably means that the relevant files are installed
|
||||
in a non-standard location. Consider <a href="index.html#more-help">asking for
|
||||
more help</a>.
|
||||
The `open` command uses the MIME type database and the `.desktop` files used by Gnome and KDE to identify filetypes and default actions. If at least one of these environments is installed, but the open command is not working, this probably means that the relevant files are installed in a non-standard location. Consider <a href="index.html#more-help">asking for more help</a>.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-default How do I make fish my default shell?
|
||||
|
||||
If you installed fish manually (e.g. by compiling it, not by using a
|
||||
package manager), you first need to add fish to the list of shells by
|
||||
executing the following command (assuming you installed fish in
|
||||
/usr/local) as root:
|
||||
If you installed fish manually (e.g. by compiling it, not by using a package manager), you first need to add fish to the list of shells by executing the following command (assuming you installed fish in /usr/local) as root:
|
||||
|
||||
\fish{cli-dark}
|
||||
echo /usr/local/bin/fish >>/etc/shells
|
||||
\endfish
|
||||
|
||||
<code>echo /usr/local/bin/fish >>/etc/shells</code>
|
||||
|
||||
If you installed a prepackaged version of fish, the package manager
|
||||
should have already done this for you.
|
||||
If you installed a prepackaged version of fish, the package manager should have already done this for you.
|
||||
|
||||
In order to change your default shell, type:
|
||||
|
||||
<code>chsh -s /usr/local/bin/fish</code>
|
||||
\fish{cli-dark}
|
||||
chsh -s /usr/local/bin/fish
|
||||
\endfish
|
||||
|
||||
You may need to adjust the above path to e.g. \c /usr/bin/fish. Use the command <code>which fish</code> if you are unsure of where fish is installed.
|
||||
You may need to adjust the above path to e.g. `/usr/bin/fish`. Use the command `which fish` if you are unsure of where fish is installed.
|
||||
|
||||
Unfortunately, there is no way to make the changes take effect at once.
|
||||
You will need to log out and back in again.
|
||||
Unfortunately, there is no way to make the changes take effect at once. You will need to log out and back in again.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-titlebar I'm seeing weird output before each prompt when using screen. What's wrong?
|
||||
|
||||
Quick answer:
|
||||
|
||||
Run the following command in fish:
|
||||
|
||||
<pre>
|
||||
echo 'function fish_title;end' > ~/.config/fish/config.fish
|
||||
</pre>
|
||||
\fish{cli-dark}
|
||||
function fish_title; end; funcsave fish_title
|
||||
\endfish
|
||||
|
||||
Problem solved!
|
||||
|
||||
The long answer:
|
||||
|
||||
Fish is trying to set the titlebar message of your terminal. While
|
||||
screen itself supports this feature, your terminal does
|
||||
not. Unfortunately, when the underlying terminal doesn't support
|
||||
setting the titlebar, screen simply passes through the escape codes
|
||||
and text to the underlying terminal instead of ignoring them. It is
|
||||
impossible detect and resolve this problem from inside fish since fish
|
||||
has no way of knowing what the underlying terminal type is. For now,
|
||||
the only way to fix this is to unset the titlebar message, as
|
||||
suggested above.
|
||||
Fish is trying to set the titlebar message of your terminal. While screen itself supports this feature, your terminal does not. Unfortunately, when the underlying terminal doesn't support setting the titlebar, screen simply passes through the escape codes and text to the underlying terminal instead of ignoring them. It is impossible to detect and resolve this problem from inside fish since fish has no way of knowing what the underlying terminal type is. For now, the only way to fix this is to unset the titlebar message, as suggested above.
|
||||
|
||||
Note that fish has a default titlebar message, which will be used if
|
||||
the fish_title function is undefined. So simply unsetting the
|
||||
fish_title function will not work.
|
||||
Note that fish has a default titlebar message, which will be used if the fish_title function is undefined. So simply unsetting the fish_title function will not work.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-greeting How do I change the greeting message?
|
||||
|
||||
Change the value of the variable fish_greeting. For example, to remove
|
||||
the greeting use:
|
||||
Change the value of the variable `fish_greeting` or create a `fish_greeting` function. For example, to remove the greeting use:
|
||||
|
||||
<pre>
|
||||
\fish{cli-dark}
|
||||
set fish_greeting
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-history Why doesn't history substitution ("!$" etc.) work?
|
||||
|
||||
Because history substitution is an awkward interface that was invented before
|
||||
interactive line editing was even possible. Fish drops it in favor of
|
||||
perfecting the interactive history recall interface. Switching requires a
|
||||
small change of habits: if you want to modify an old line/word, first recall
|
||||
it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then
|
||||
type "sudo ".
|
||||
Because history substitution is an awkward interface that was invented before interactive line editing was even possible. Fish drops it in favor of perfecting the interactive history recall interface. Switching requires a small change of habits: if you want to modify an old line/word, first recall it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then type "sudo ".
|
||||
|
||||
Fish history recall is very simple yet effective:
|
||||
|
||||
- As in any modern shell, the Up arrow recalls whole lines, starting from the last line executed. A single press replaces "!!", later presses replace "!-3" and the like.
|
||||
- If the line you want is far back in the history, type any part of the line and then press Up one or more times. This will constrain the recall to lines that include this text, and you will get to the line you want much faster. This replaces "!vi", "!?bar.c" and the like.
|
||||
- Alt+Up recalls individual arguments, starting from the last argument in the last line executed. A single press replaces "!$", later presses replace "!!:4" and the like.
|
||||
- If the argument you want is far back in history (e.g. 2 lines back - that's a lot of words!), type any part of it and then press Alt+Up. This will show only arguments containing that part and you will get what you want much faster. Try it out, this is very convenient!
|
||||
- If you want to reuse several arguments from the same line ("!!:3*" and the like), consider recalling the whole line and removing what you don't need (Alt+D and Alt+Backspace are your friends).
|
||||
- As in any modern shell, the Up arrow, @cursor_key{↑,Up} recalls whole lines, starting from the last line executed. A single press replaces "!!", later presses replace "!-3" and the like.
|
||||
|
||||
- If the line you want is far back in the history, type any part of the line and then press Up one or more times. This will constrain the recall to lines that include this text, and you will get to the line you want much faster. This replaces "!vi", "!?bar.c" and the like.
|
||||
|
||||
- @key{Alt,↑,Up} recalls individual arguments, starting from the last argument in the last line executed. A single press replaces "!$", later presses replace "!!:4" and the like.
|
||||
|
||||
- If the argument you want is far back in history (e.g. 2 lines back - that's a lot of words!), type any part of it and then press @key{Alt,↑,Up}. This will show only arguments containing that part and you will get what you want much faster. Try it out, this is very convenient!
|
||||
|
||||
- If you want to reuse several arguments from the same line ("!!:3*" and the like), consider recalling the whole line and removing what you don't need (@key{Alt,D} and @key{Alt,Backspace} are your friends).
|
||||
|
||||
See <a href='index.html#editor'>documentation</a> for more details about line editing in fish.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-uninstalling Uninstalling fish
|
||||
|
||||
Should you wish to uninstall fish, first ensure fish is not set as your shell. Run <code>chsh -s /bin/bash</code> if you are not sure.
|
||||
Should you wish to uninstall fish, first ensure fish is not set as your shell. Run `chsh -s /bin/bash` if you are not sure.
|
||||
|
||||
Next, do the following (assuming fish was installed to /usr/local):
|
||||
|
||||
<pre>
|
||||
\fish{cli-dark}
|
||||
rm -Rf /usr/local/etc/fish /usr/local/share/fish ~/.config/fish
|
||||
rm /usr/local/share/man/man1/fish*.1
|
||||
cd /usr/local/bin
|
||||
rm -f fish mimedb fish_pager fishd fish_indent
|
||||
</pre>
|
||||
rm -f fish mimedb fishd fish_indent
|
||||
\endfish
|
||||
|
||||
*/
|
||||
|
||||
\htmlonly
|
||||
\htmlonly[block]
|
||||
</div>
|
||||
\endhtmlonly
|
||||
|
||||
*/
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
\section fg fg - bring job to foreground
|
||||
|
||||
\subsection fg-synopsis Synopsis
|
||||
<tt>fg [PID]</tt>
|
||||
\fish{synopsis}
|
||||
fg [PID]
|
||||
\endfish
|
||||
|
||||
\subsection fg-description Description
|
||||
\c fg brings the specified <a href="index.html#syntax-job-control">job</a> to the foreground, resuming it if it is stopped. While a foreground job is
|
||||
executed, fish is suspended. If no job is specified, the last job to be used is put in the foreground. If PID is specified, the job with the specified group ID is put in the foreground.
|
||||
|
||||
`fg` brings the specified <a href="index.html#syntax-job-control">job</a> to the foreground, resuming it if it is stopped. While a foreground job is executed, fish is suspended. If no job is specified, the last job to be used is put in the foreground. If PID is specified, the job with the specified group ID is put in the foreground.
|
||||
|
||||
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>.
|
||||
|
||||
|
||||
\subsection fg-example Example
|
||||
|
||||
<tt>fg \%1</tt> will put the job with job ID 1 in the foreground.
|
||||
`fg %1` will put the job with job ID 1 in the foreground.
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
\section fish fish - the friendly interactive shell
|
||||
|
||||
\subsection fish-synopsis Synopsis
|
||||
fish [-h] [-v] [-c command] [FILE [ARGUMENTS...]]
|
||||
\fish{synopsis}
|
||||
fish [OPTIONS] [-c command] [FILE [ARGUMENTS...]]
|
||||
\endfish
|
||||
|
||||
\subsection fish-description Description
|
||||
|
||||
\c fish is a command-line shell written mainly with interactive use in mind. The
|
||||
full manual is available <a href='index.html'>in HTML</a> by using the
|
||||
<a href='#help'>help</a> command from inside fish.
|
||||
`fish` is a command-line shell written mainly with interactive use in mind. The full manual is available <a href='index.html'>in HTML</a> by using the <a href='#help'>help</a> command from inside fish.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- <code>-c</code> or <code>--command=COMMANDS</code> evaluate the specified commands instead of reading from the commandline
|
||||
- <code>-d</code> or <code>--debug-level=DEBUG_LEVEL</code> specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1.
|
||||
- <code>-h</code> or <code>--help</code> display help and exit
|
||||
- <code>-i</code> or <code>--interactive</code> specify that fish is to run in interactive mode
|
||||
- <code>-l</code> or <code>--login</code> specify that fish is to run as a login shell
|
||||
- <code>-n</code> or <code>--no-execute</code> do not execute any commands, only perform syntax checking
|
||||
- <code>-p</code> or <code>--profile=PROFILE_FILE</code> when fish exits, output timing information on all executed commands to the specified file
|
||||
- <code>-v</code> or <code>--version</code> display version and exit
|
||||
- `-c` or `--command=COMMANDS` evaluate the specified commands instead of reading from the commandline
|
||||
|
||||
The fish exit status is generally the exit status of the last
|
||||
foreground command. If fish is exiting because of a parse error, the
|
||||
exit status is 127.
|
||||
- `-d` or `--debug-level=DEBUG_LEVEL` specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1.
|
||||
|
||||
- `-i` or `--interactive` specify that fish is to run in interactive mode
|
||||
|
||||
- `-l` or `--login` specify that fish is to run as a login shell
|
||||
|
||||
- `-n` or `--no-execute` do not execute any commands, only perform syntax checking
|
||||
|
||||
- `-p` or `--profile=PROFILE_FILE` when fish exits, output timing information on all executed commands to the specified file
|
||||
|
||||
- `-v` or `--version` display version and exit
|
||||
|
||||
The fish exit status is generally the exit status of the last foreground command. If fish is exiting because of a parse error, the exit status is 127.
|
||||
|
||||
@@ -2,21 +2,17 @@
|
||||
|
||||
\subsection fish_config-description Description
|
||||
|
||||
\c fish_config starts the web-based configuration interface.
|
||||
`fish_config` starts the web-based configuration interface.
|
||||
|
||||
The web interface allows you to view your functions, variables and history, and
|
||||
to make changes to your prompt and color configuration.
|
||||
The web interface allows you to view your functions, variables and history, and to make changes to your prompt and color configuration.
|
||||
|
||||
\c fish_config starts a local web server and then opens a web browser window; when
|
||||
you have finished, close the browser window and then press the Enter key to
|
||||
terminate the configuration session.
|
||||
`fish_config` starts a local web server and then opens a web browser window; when you have finished, close the browser window and then press the Enter key to terminate the configuration session.
|
||||
|
||||
<code>fish_config</code> optionally accepts name of the initial configuration tab. For e.g. <code>fish_config history</code> will start configuration interface with history tab.
|
||||
`fish_config` optionally accepts name of the initial configuration tab. For e.g. `fish_config history` will start configuration interface with history tab.
|
||||
|
||||
If the `BROWSER` environment variable is set, it will be used as the name of the web browser to open instead of the system default.
|
||||
|
||||
If the \c BROWSER environment variable is set, it will be used as the name
|
||||
of the web browser to open instead of the system default.
|
||||
|
||||
\subsection fish_config-example Example
|
||||
|
||||
\c fish_config opens a new web browser window and allows you to configure certain
|
||||
fish settings.
|
||||
`fish_config` opens a new web browser window and allows you to configure certain fish settings.
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
\section fish_indent fish_indent - indenter and prettifier
|
||||
|
||||
\subsection fish_indent-synopsis Synopsis
|
||||
<tt>fish_indent [options]</tt>
|
||||
\fish{synopsis}
|
||||
fish_indent [OPTIONS]
|
||||
\endfish
|
||||
|
||||
\subsection fish_indent-description Description
|
||||
|
||||
\c fish_indent is used to indent a piece of fish
|
||||
code. \c fish_indent reads commands from standard input and outputs
|
||||
them to standard output.
|
||||
`fish_indent` is used to indent a piece of fish code. `fish_indent` reads commands from standard input and outputs them to standard output.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- <tt>-h</tt> or <tt>--help</tt> displays this help message and then exits
|
||||
- <tt>-i</tt> or <tt>--no-indent</tt> do not indent commands
|
||||
- <tt>-v</tt> or <tt>--version</tt> displays the current fish version and then exits
|
||||
- `-i` or `--no-indent` do not indent commands; only reformat to one job per line
|
||||
|
||||
- `-v` or `--version` displays the current fish version and then exits
|
||||
|
||||
- `--ansi` colorizes the output using ANSI escape sequences, appropriate for the current $TERM, using the colors defined in the environment (such as `$fish_color_command`).
|
||||
|
||||
- `--html` outputs HTML, which supports syntax highlighting if the appropriate CSS is defined. The CSS class names are the same as the variable names, such as `fish_color_command`
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
\section fish_pager fish_pager - internal command used by fish
|
||||
|
||||
\subsection fish_pager-description Description
|
||||
|
||||
\c fish_pager is used internally by fish. It should not be used by other
|
||||
commands, as its interface is liable to change in the future.
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
\section fish_prompt fish_prompt - define the appearance of the command line prompt
|
||||
|
||||
\subsection fish_prompt-synopsis Synopsis
|
||||
<pre>function fish_prompt
|
||||
\fish{synopsis}
|
||||
function fish_prompt
|
||||
...
|
||||
end</pre>
|
||||
end
|
||||
\endfish
|
||||
|
||||
\subsection fish_prompt-description Description
|
||||
|
||||
By defining the \c fish_prompt function, the user can choose a custom
|
||||
prompt. The \c fish_prompt function is executed when the prompt is to
|
||||
be shown, and the output is used as a prompt.
|
||||
By defining the `fish_prompt` function, the user can choose a custom prompt. The `fish_prompt` function is executed when the prompt is to be shown, and the output is used as a prompt.
|
||||
|
||||
The exit status of commands within \c fish_prompt will not modify the value of <a href="index.html#variables-status">$status</a> outside of the \c fish_prompt function.
|
||||
The exit status of commands within `fish_prompt` will not modify the value of <a href="index.html#variables-status">$status</a> outside of the `fish_prompt` function.
|
||||
|
||||
`fish` ships with a number of example prompts that can be chosen with the `fish_config` command.
|
||||
|
||||
\c fish ships with a number of example prompts that can be chosen with the
|
||||
\c fish_config command.
|
||||
|
||||
\subsection fish_prompt-example Example
|
||||
|
||||
A simple prompt:
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
function fish_prompt -d "Write out the prompt"
|
||||
printf '\%s\@\%s\%s\%s\%s> ' (whoami) (hostname|cut -d . -f 1) (set_color \$fish_color_cwd) (prompt_pwd) (set_color normal)
|
||||
printf '%s@%s%s%s%s> ' (whoami) (hostname | cut -d . -f 1) \
|
||||
(set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
\section fish_right_prompt fish_right_prompt - define the appearance of the right-side command line prompt
|
||||
|
||||
\subsection fish_right_prompt-synopsis Synopsis
|
||||
<pre>function fish_right_prompt
|
||||
\fish{synopsis}
|
||||
function fish_right_prompt
|
||||
...
|
||||
end</pre>
|
||||
end
|
||||
\endfish
|
||||
|
||||
\subsection fish_right_prompt-description Description
|
||||
|
||||
\c fish_right_prompt is similar to \c fish_prompt, except that it appears on the right side of the terminal window.
|
||||
`fish_right_prompt` is similar to `fish_prompt`, except that it appears on the right side of the terminal window.
|
||||
|
||||
Multiple lines are not supported in \c fish_right_prompt.
|
||||
Multiple lines are not supported in `fish_right_prompt`.
|
||||
|
||||
\subsection fish_prompt-example Example
|
||||
|
||||
\subsection fish_right_prompt-example Example
|
||||
|
||||
A simple right prompt:
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
function fish_right_prompt -d "Write out the right prompt"
|
||||
date "+%m/%d/%y"
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
\subsection fish_update_completions-description Description
|
||||
|
||||
\c fish_update_completions parses manual pages installed on the system, and attempts to create completion files in the \c fish configuration directory.
|
||||
`fish_update_completions` parses manual pages installed on the system, and attempts to create completion files in the `fish` configuration directory.
|
||||
|
||||
This does not overwrite custom completions.
|
||||
|
||||
There are no parameters for <code>fish_update_completions</code>.
|
||||
There are no parameters for `fish_update_completions`.
|
||||
|
||||
10
doc_src/fish_vi_mode.txt
Normal file
10
doc_src/fish_vi_mode.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
408-600-6421\section fish_vi_mode fish_vi_mode - Enable vi mode
|
||||
|
||||
\subsection fish_vi_mode-synopsis Synopsis
|
||||
\fish{synopsis}
|
||||
fish_vi_mode
|
||||
\endfish
|
||||
|
||||
\subsection fish_vi_mode-description Description
|
||||
|
||||
`fish_vi_mode` enters a vi-like command editing mode. To always start in vi mode, add `fish_vi_mode` to your `config.fish` file.
|
||||
@@ -1,33 +0,0 @@
|
||||
\section fishd fishd - universal variable daemon
|
||||
|
||||
\subsection fishd-synopsis Synopsis
|
||||
<tt>fishd [(-h|--help|-v|--version)]</tt>
|
||||
|
||||
\subsection fishd-description Description
|
||||
|
||||
The \c fishd daemon is used to load, save and distribute universal
|
||||
variable information. \c fish automatically connects to \c fishd via a socket
|
||||
on startup.
|
||||
|
||||
\c fishd is started and stopped automatically.
|
||||
|
||||
The following options are available if starting \c fishd manually:
|
||||
|
||||
- <tt>-h</tt> or <tt>--help</tt> displays this help message and then exits
|
||||
- <tt>-v</tt> or <tt>--version</tt> displays the current fish version and then exits
|
||||
|
||||
\subsection fishd-files Files
|
||||
|
||||
- \c ~/.config/fish/fishd.MACHINE_ID - permanent storage location for universal
|
||||
variable data. \c MACHINE_ID is generally based on the machine's MAC address.
|
||||
|
||||
The data is stored as a set of \c set and \c set_export commands such as
|
||||
would be parsed by fishd. The file must always be stored in YAML format.
|
||||
If an instance of fishd is running (which is generally the case), manual
|
||||
modifications to \c ~/.fishd.MACHINE_ID will be lost. Do NOT edit this file manually!
|
||||
|
||||
- \c /tmp/fishd.socket.USERNAME - the socket which fishd uses to communicate
|
||||
with all clients.
|
||||
|
||||
- /tmp/fishd.log.USERNAME - the fishd log file
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
\section for for - perform a set of commands multiple times.
|
||||
|
||||
\subsection for-synopsis Synopsis
|
||||
<tt>for VARNAME in [VALUES...]; COMMANDS...; end</tt>
|
||||
\fish{synopsis}
|
||||
for VARNAME in [VALUES...]; COMMANDS...; end
|
||||
\endfish
|
||||
|
||||
\subsection for-description Description
|
||||
<tt>for</tt> is a loop construct. It will perform the commands specified by
|
||||
\c COMMANDS multiple times. On each iteration, the environment variable specified by
|
||||
\c VARNAME is assigned a new value from \c VALUES. If \c VALUES is empty, \c COMMANDS will
|
||||
not be executed at all.
|
||||
|
||||
`for` is a loop construct. It will perform the commands specified by `COMMANDS` multiple times. On each iteration, the local variable specified by `VARNAME` is assigned a new value from `VALUES`. If `VALUES` is empty, `COMMANDS` will not be executed at all.
|
||||
|
||||
\subsection for-example Example
|
||||
|
||||
The command
|
||||
\fish
|
||||
for i in foo bar baz; echo $i; end
|
||||
|
||||
<tt>for i in foo bar baz; echo $i; end</tt>
|
||||
|
||||
would output:
|
||||
|
||||
<pre>
|
||||
# would output:
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
</pre>
|
||||
|
||||
\endfish
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
\section funced funced - edit a function interactively
|
||||
|
||||
\subsection funced-synopsis Synopsis
|
||||
<code>funced [OPTIONS] NAME</code>
|
||||
\fish{synopsis}
|
||||
funced [OPTIONS] NAME
|
||||
\endfish
|
||||
|
||||
\subsection funced-description Description
|
||||
|
||||
\c funced provides an interface to edit the definition of the function
|
||||
<code>NAME</code>.
|
||||
`funced` provides an interface to edit the definition of the function `NAME`.
|
||||
|
||||
If the \c $EDITOR environment variable is set, it will be used as the program
|
||||
to edit the function. Otherwise, a built-in editor will be used.
|
||||
If the `$EDITOR` environment variable is set, it will be used as the program to edit the function. Otherwise, a built-in editor will be used.
|
||||
|
||||
If there is no function called \c NAME a new function will be created with
|
||||
the specified name
|
||||
If there is no function called `NAME` a new function will be created with the specified name
|
||||
|
||||
- <code>-e command</code> or <code>--editor command</code> Open the function
|
||||
body inside the text editor given by the command (for example, "vi"). The
|
||||
command 'fish' will use the built-in editor.
|
||||
- <code>-i</code> or <code>--interactive</code> Open function body in the
|
||||
built-in editor.
|
||||
- `-e command` or `--editor command` Open the function body inside the text editor given by the command (for example, "vi"). The command 'fish' will use the built-in editor.
|
||||
|
||||
- `-i` or `--interactive` Open function body in the built-in editor.
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
\section funcsave funcsave - save the definition of a function to the user's autoload directory
|
||||
|
||||
\subsection funcsave-synopsis Synopsis
|
||||
<tt>funcsave FUNCTION_NAME</tt>
|
||||
\fish{synopsis}
|
||||
funcsave FUNCTION_NAME
|
||||
\endfish
|
||||
|
||||
\subsection funcsave-description Description
|
||||
|
||||
\c funcsave saves the current definition of a function to
|
||||
a file in the fish configuration directory. This function will be automatically
|
||||
loaded by current and future fish
|
||||
sessions. This can be useful if you have interactively created a new
|
||||
function and wish to save it for later use.
|
||||
|
||||
`funcsave` saves the current definition of a function to a file in the fish configuration directory. This function will be automatically loaded by current and future fish sessions. This can be useful if you have interactively created a new function and wish to save it for later use.
|
||||
|
||||
@@ -1,61 +1,93 @@
|
||||
\section function function - create a function
|
||||
|
||||
\subsection function-synopsis Synopsis
|
||||
<code>function [OPTIONS] NAME; BODY; end </code>
|
||||
\fish{synopsis}
|
||||
function [OPTIONS] NAME; BODY; end
|
||||
\endfish
|
||||
|
||||
\subsection function-description Description
|
||||
|
||||
\c function creates a new function \c NAME with the body <code>BODY</code>.
|
||||
`function` creates a new function `NAME` with the body `BODY`.
|
||||
|
||||
A function is a list of commands that will be executed when the name of the
|
||||
function is given as a command.
|
||||
A function is a list of commands that will be executed when the name of the function is given as a command.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- <code>-a NAMES</code> or <code>--argument-names NAMES</code> assigns the value of successive command-line arguments to the names given in NAMES.
|
||||
- <code>-d DESCRIPTION</code> or \c --description=DESCRIPTION is a description of what the function does, suitable as a completion description.
|
||||
- <code>-e</code> or <code>--on-event EVENT_NAME</code> tells fish to run this function when the specified named event is emitted. Fish internally generates named events e.g. when showing the prompt.
|
||||
- <code>-j PID</code> or <code> --on-job-exit PID</code> tells fish to run this function when the job with group ID PID exits. Instead of PID, the string 'caller' can be specified. This is only legal when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.
|
||||
- <code>-p PID</code> or <code> --on-process-exit PID</code> tells fish to run this function when the fish child process with process ID PID exits.
|
||||
- <code>-s</code> or <code>--on-signal SIGSPEC</code> tells fish to run this function when the signal SIGSPEC is delivered. SIGSPEC can be a signal number, or the signal name, such as SIGHUP (or just HUP).
|
||||
- \c -S or \c --no-scope-shadowing allows the function to access the variables of calling functions. Normally, any variables inside the function that have the same name as variables from the calling function are "shadowed", and their contents is independent of the calling function.
|
||||
- <code>-v</code> or <code>--on-variable VARIABLE_NAME</code> tells fish to run this function when the variable VARIABLE_NAME changes value.
|
||||
- `-a NAMES` or `--argument-names NAMES` assigns the value of successive command-line arguments to the names given in NAMES.
|
||||
|
||||
If the user enters any additional arguments after the function, they
|
||||
are inserted into the environment <a href="index.html#variables-arrays">variable array</a>
|
||||
<code>$argv</code>. If the \c --argument-names option is provided, the arguments are
|
||||
also assigned to names specified in that option.
|
||||
- `-d DESCRIPTION` or `--description=DESCRIPTION` is a description of what the function does, suitable as a completion description.
|
||||
|
||||
- `-w WRAPPED_COMMAND` or `--wraps=WRAPPED_COMMAND` causes the function to inherit completions from the given wrapped command. See the documentation for <a href="#complete">`complete`</a> for more information.
|
||||
|
||||
- `-e` or `--on-event EVENT_NAME` tells fish to run this function when the specified named event is emitted. Fish internally generates named events e.g. when showing the prompt.
|
||||
|
||||
- `-v` or `--on-variable VARIABLE_NAME` tells fish to run this function when the variable VARIABLE_NAME changes value.
|
||||
|
||||
- `-j PGID` or `--on-job-exit PGID` tells fish to run this function when the job with group ID PGID exits. Instead of PGID, the string 'caller' can be specified. This is only legal when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.
|
||||
|
||||
- `-p PID` or `--on-process-exit PID` tells fish to run this function when the fish child process with process ID PID exits.
|
||||
|
||||
- `-s` or `--on-signal SIGSPEC` tells fish to run this function when the signal SIGSPEC is delivered. SIGSPEC can be a signal number, or the signal name, such as SIGHUP (or just HUP).
|
||||
|
||||
- `-S` or `--no-scope-shadowing` allows the function to access the variables of calling functions. Normally, any variables inside the function that have the same name as variables from the calling function are "shadowed", and their contents is independent of the calling function.
|
||||
|
||||
- `-V` or `--inherit-variable NAME` snapshots the value of the variable `NAME` and defines a local variable with that same name and value when the function is executed.
|
||||
|
||||
If the user enters any additional arguments after the function, they are inserted into the environment <a href="index.html#variables-arrays">variable array</a> `$argv`. If the `--argument-names` option is provided, the arguments are also assigned to names specified in that option.
|
||||
|
||||
By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the <a href="#emit">emit</a> builtin. Fish generates the following named events:
|
||||
|
||||
- \c fish_prompt, which is emitted whenever a new fish prompt is about to be displayed.
|
||||
- \c fish_command_not_found, which is emitted whenever a command lookup failed.
|
||||
- `fish_prompt`, which is emitted whenever a new fish prompt is about to be displayed.
|
||||
|
||||
- `fish_command_not_found`, which is emitted whenever a command lookup failed.
|
||||
|
||||
- `fish_preexec`, which is emitted right before executing an interactive command. The commandline is passed as the first parameter.
|
||||
|
||||
Note: This event will be emitted even if the command is invalid. The commandline parameter includes the entire commandline verbatim, and may potentially include newlines.
|
||||
|
||||
- `fish_postexec`, which is emitted right after executing an interactive command. The commandline is passed as the first parameter.
|
||||
|
||||
Note: This event will be emitted even if the command is invalid. The commandline parameter includes the entire commandline verbatim, and may potentially include newlines.
|
||||
|
||||
|
||||
\subsection function-example Example
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
function ll
|
||||
ls -l $argv
|
||||
ls -l $argv
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
will run the \c ls command, using the \c -l option, while passing on any additional files and switches to \c ls.
|
||||
will run the `ls` command, using the `-l` option, while passing on any additional files and switches to `ls`.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
function mkdir -d "Create a directory and set CWD"
|
||||
command mkdir $argv
|
||||
if test $status = 0
|
||||
switch $argv[(count $argv)]
|
||||
case '-*'
|
||||
command mkdir $argv
|
||||
if test $status = 0
|
||||
switch $argv[(count $argv)]
|
||||
case '-*'
|
||||
|
||||
case '*'
|
||||
cd $argv[(count $argv)]
|
||||
return
|
||||
end
|
||||
end
|
||||
case '*'
|
||||
cd $argv[(count $argv)]
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
will run the mkdir command, and if it is successful, change the
|
||||
current working directory to the one just created.
|
||||
This will run the `mkdir` command, and if it is successful, change the current working directory to the one just created.
|
||||
|
||||
\fish
|
||||
function notify
|
||||
set -l job (jobs -l -g)
|
||||
or begin; echo "There are no jobs" >&2; return 1; end
|
||||
|
||||
function _notify_job_$job --on-job-exit $job --inherit-variable job
|
||||
echo -n \a # beep
|
||||
functions -e _notify_job_$job
|
||||
end
|
||||
end
|
||||
\endfish
|
||||
|
||||
This will beep when the most recent job completes.
|
||||
|
||||
|
||||
@@ -1,51 +1,52 @@
|
||||
\section functions functions - print or erase functions
|
||||
|
||||
\subsection function-synopsis Synopsis
|
||||
<pre>functions [-n]
|
||||
\subsection functions-synopsis Synopsis
|
||||
\fish{synopsis}
|
||||
functions [ -a | --all ] [ -n | --names ]
|
||||
functions -c OLDNAME NEWNAME
|
||||
functions -d DESCRIPTION FUNCTION
|
||||
functions [-eq] FUNCTIONS...</pre>
|
||||
functions [ -e | -q ] FUNCTIONS...
|
||||
\endfish
|
||||
|
||||
\subsection functions-description Description
|
||||
|
||||
\c functions prints or erases functions.
|
||||
`functions` prints or erases functions.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- <code>-a</code> or <code>--all</code> lists all functions, even those whose name start with an underscore.
|
||||
- <code>-c OLDNAME NEWNAME</code> or <code>--copy OLDNAME NEWNAME</code> creates a new function named NEWNAME, using the definition of the OLDNAME function.
|
||||
- <code>-d DESCRIPTION</code> or <code>--description=DESCRIPTION</code> changes the description of this function.
|
||||
- <code>-e</code> or <code>--erase</code> causes the specified functions to be erased.
|
||||
- <code>-h</code> or <code>--help</code> displays a help message and exits.
|
||||
- <code>-n</code> or <code>--names</code> lists the names of all defined functions.
|
||||
- <code>-q</code> or <code>--query</code> tests if the specified functions exist.
|
||||
- `-a` or `--all` lists all functions, even those whose name start with an underscore.
|
||||
|
||||
The default behavior of <code>functions</code>, when called with no arguments,
|
||||
is to print the names of all defined functions. Unless the \c -a option is
|
||||
given, no functions starting with underscores are not included in the output.
|
||||
- `-c OLDNAME NEWNAME` or `--copy OLDNAME NEWNAME` creates a new function named NEWNAME, using the definition of the OLDNAME function.
|
||||
|
||||
If any non-option parameters are given, the definition of the specified
|
||||
functions are printed.
|
||||
- `-d DESCRIPTION` or `--description=DESCRIPTION` changes the description of this function.
|
||||
|
||||
Automatically loaded functions cannot be removed using <code>functions
|
||||
-e</code>. Either remove the definition file or change the
|
||||
$fish_function_path variable to remove autoloaded functions.
|
||||
- `-e` or `--erase` causes the specified functions to be erased.
|
||||
|
||||
Copying a function using \c -c copies only the body of the function, and
|
||||
does not attach any event notifications from the original function.
|
||||
- `-n` or `--names` lists the names of all defined functions.
|
||||
|
||||
Only one function's description can be changed in a single invocation
|
||||
of <code>functions -d</code>.
|
||||
- `-q` or `--query` tests if the specified functions exist.
|
||||
|
||||
The default behavior of `functions`, when called with no arguments, is to print the names of all defined functions. Unless the `-a` option is given, no functions starting with underscores are not included in the output.
|
||||
|
||||
If any non-option parameters are given, the definition of the specified functions are printed.
|
||||
|
||||
Automatically loaded functions cannot be removed using `functions -e`. Either remove the definition file or change the $fish_function_path variable to remove autoloaded functions.
|
||||
|
||||
Copying a function using `-c` copies only the body of the function, and does not attach any event notifications from the original function.
|
||||
|
||||
Only one function's description can be changed in a single invocation of `functions -d`.
|
||||
|
||||
The exit status of `functions` is the number of functions specified in the argument list that do not exist, which can be used in concert with the `-q` option.
|
||||
|
||||
The exit status of \c functions is the number of functions
|
||||
specified in the argument list that do not exist, which can be used in
|
||||
concert with the \c -q option.
|
||||
|
||||
\subsection functions-example Examples
|
||||
\fish
|
||||
functions -n
|
||||
# Displays a list of currently-defined functions
|
||||
|
||||
<code>functions -n</code> displays a list of currently-defined functions.
|
||||
functions -c foo bar
|
||||
# Copies the 'foo' function to a new function called 'bar'
|
||||
|
||||
<code>functions -c foo bar</code> copies the \c foo function to a new function called
|
||||
<code>bar</code>.
|
||||
|
||||
<code>functions -e bar</code> erases the function <code>bar</code>.
|
||||
functions -e bar
|
||||
# Erases the function `bar`
|
||||
\endfish
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
\section help help - display fish documentation
|
||||
|
||||
\subsection help-synopsis Synopsis
|
||||
<tt>help [SECTION]</tt>
|
||||
\fish{synopsis}
|
||||
help [SECTION]
|
||||
\endfish
|
||||
|
||||
\subsection help-description Description
|
||||
|
||||
\c help displays the fish help documentation.
|
||||
`help` displays the fish help documentation.
|
||||
|
||||
If a \c SECTION is specified, the help for that command is shown.
|
||||
If a `SECTION` is specified, the help for that command is shown.
|
||||
|
||||
If the BROWSER environment variable is set, it will be used to display the
|
||||
documentation. Otherwise, fish will search for a suitable browser.
|
||||
If the BROWSER environment variable is set, it will be used to display the documentation. Otherwise, fish will search for a suitable browser.
|
||||
|
||||
Note that most builtin commands display their help in the terminal when given the `--help` option.
|
||||
|
||||
Note that most builtin commands display their help in the terminal when
|
||||
given the <tt>--help</tt> option.
|
||||
|
||||
\subsection help-example Example
|
||||
|
||||
<tt>help fg</tt> shows the documentation for the \c fg builtin.
|
||||
`help fg` shows the documentation for the `fg` builtin.
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
\section history history - Show and manipulate command history
|
||||
|
||||
\subsection history-synopsis Synopsis
|
||||
<pre>
|
||||
history (--save | --clear)
|
||||
history (--search | --delete ) (--prefix "prefix string" | --contains "search string")
|
||||
</pre>
|
||||
\fish{synopsis}
|
||||
history ( --merge | --save | --clear )
|
||||
history ( --search | --delete ) [ --prefix "prefix string" | --contains "search string" ]
|
||||
\endfish
|
||||
|
||||
\subsection history-description Description
|
||||
|
||||
\c history is used to list, search and delete the history of commands used.
|
||||
`history` is used to list, search and delete the history of commands used.
|
||||
|
||||
The following options are available:
|
||||
- `--merge` immediately incorporates history changes from other sessions. Ordinarily `fish` ignores history changes from sessions started after the current one. This command applies those changes immediately.
|
||||
|
||||
- \c --save saves all changes in the history file. The shell automatically
|
||||
saves the history file; this option is provided for internal use.
|
||||
- \c --clear clears the history file. A prompt is displayed before the history
|
||||
is erased.
|
||||
- \c --search returns history items in keeping with the \c --prefix or
|
||||
\c --contains options.
|
||||
- \c --delete deletes history items.
|
||||
- \c --prefix searches or deletes items in the history that begin with the
|
||||
specified text string.
|
||||
- \c --contains searches or deletes items in the history that contain the
|
||||
specified text string.
|
||||
- `--save` saves all changes in the history file. The shell automatically saves the history file; this option is provided for internal use.
|
||||
|
||||
If \c --search is specified without \c --contains or <code>--prefix</code>,
|
||||
\c --contains will be assumed.
|
||||
- `--clear` clears the history file. A prompt is displayed before the history is erased.
|
||||
|
||||
- `--search` returns history items in keeping with the `--prefix` or `--contains` options.
|
||||
|
||||
- `--delete` deletes history items.
|
||||
|
||||
- `--prefix` searches or deletes items in the history that begin with the specified text string.
|
||||
|
||||
- `--contains` searches or deletes items in the history that contain the specified text string.
|
||||
|
||||
If `--search` is specified without `--contains` or `--prefix`, `--contains` will be assumed.
|
||||
|
||||
If `--delete` is specified without `--contains` or `--prefix`, only a history item which exactly matches the parameter will be erased. No prompt will be given. If `--delete` is specified with either of these parameters, an interactive prompt will be displayed before any items are deleted.
|
||||
|
||||
If \c --delete is specified without \c --contains or <code>--prefix</code>,
|
||||
only a history item which exactly matches the parameter will be erased. No
|
||||
prompt will be given. If \c --delete is specified with either of these
|
||||
parameters, an interactive prompt will be displayed before any items are
|
||||
deleted.
|
||||
|
||||
\subsection history-examples Example
|
||||
|
||||
<code>history --clear</code> deletes all history items
|
||||
\fish
|
||||
history --clear
|
||||
# Deletes all history items
|
||||
|
||||
<code>history --search --contains "foo"</code> outputs a list of all previous
|
||||
commands containing the string "foo".
|
||||
history --search --contains "foo"
|
||||
# Outputs a list of all previous commands containing the string "foo".
|
||||
|
||||
<code>history --delete --prefix "foo"</code> interactively deletes the record
|
||||
of previous commands which start with "foo".
|
||||
history --delete --prefix "foo"
|
||||
# Interactively deletes the record of previous commands which start with "foo".
|
||||
\endfish
|
||||
|
||||
@@ -1,36 +1,32 @@
|
||||
\section if if - conditionally execute a command
|
||||
|
||||
\subsection if-synopsis Synopsis
|
||||
<tt>if CONDITION; COMMANDS_TRUE...; [else if CONDITION2; COMMANDS_TRUE2...;] [else; COMMANDS_FALSE...;] end</tt>
|
||||
\fish{synopsis}
|
||||
if CONDITION; COMMANDS_TRUE...;
|
||||
[else if CONDITION2; COMMANDS_TRUE2...;]
|
||||
[else; COMMANDS_FALSE...;]
|
||||
end
|
||||
\endfish
|
||||
|
||||
\subsection if-description Description
|
||||
|
||||
<tt>if</tt> will execute the command \c CONDITION. If the condition's
|
||||
exit status is 0, the commands \c COMMANDS_TRUE will execute. If the
|
||||
exit status is not 0 and <tt>else</tt> is given, \c COMMANDS_FALSE will
|
||||
be executed.
|
||||
`if` will execute the command `CONDITION`. If the condition's exit status is 0, the commands `COMMANDS_TRUE` will execute. If the exit status is not 0 and `else` is given, `COMMANDS_FALSE` will be executed.
|
||||
|
||||
In order to use the exit status of multiple commands as the condition
|
||||
of an if block, use <a href="#begin"><tt>begin; ...; end</tt></a> and
|
||||
the short circuit commands <a href="commands.html#and"><tt>and</tt></a>
|
||||
and <a href="commands.html#or"><tt>or</tt></a>.
|
||||
In order to use the exit status of multiple commands as the condition of an if block, use <a href="#begin">`begin; ...; end`</a> and the short circuit commands <a href="commands.html#and">`and`</a> and <a href="commands.html#or">`or`</a>.
|
||||
|
||||
The exit status of the last foreground command to exit can always be accessed using the <a href="index.html#variables-status">$status</a> variable.
|
||||
|
||||
The exit status of the last foreground command to exit can always be
|
||||
accessed using the <a href="index.html#variables-status">$status</a>
|
||||
variable.
|
||||
|
||||
\subsection if-example Example
|
||||
|
||||
<pre>
|
||||
The following code will print `foo.txt exists` if the file foo.txt exists and is a regular file, otherwise it will print `bar.txt exists` if the file bar.txt exists and is a regular file, otherwise it will print `foo.txt and bar.txt do not exist`.
|
||||
|
||||
\fish
|
||||
if test -f foo.txt
|
||||
echo foo.txt exists
|
||||
echo foo.txt exists
|
||||
else if test -f bar.txt
|
||||
echo bar.txt exists
|
||||
echo bar.txt exists
|
||||
else
|
||||
echo foo.txt and bar.txt do not exist
|
||||
echo foo.txt and bar.txt do not exist
|
||||
end
|
||||
</pre>will print <tt>foo.txt exists</tt> if the file foo.txt
|
||||
exists and is a regular file, otherwise it will print
|
||||
<tt>bar.txt exists</tt> if the file bar.txt exists
|
||||
and is a regular file, otherwise it will print
|
||||
<tt>foo.txt and bar.txt do not exist</tt>.
|
||||
\endfish
|
||||
|
||||
1594
doc_src/index.hdr.in
1594
doc_src/index.hdr.in
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,35 @@
|
||||
\section isatty isatty - test if the specified file descriptor is a tty
|
||||
\section isatty isatty - test if a file descriptor is a tty.
|
||||
|
||||
\subsection isatty-synopsis Synopsis
|
||||
<tt>isatty [FILE DESCRIPTOR]</tt>
|
||||
\fish{synopsis}
|
||||
isatty [FILE DESCRIPTOR]
|
||||
\endfish
|
||||
|
||||
\subsection isatty-description Description
|
||||
<tt>isatty</tt> tests if a file descriptor is a tty.
|
||||
|
||||
<tt>FILE DESCRIPTOR</tt> may be either the number of a file descriptor, or one of the
|
||||
strings <tt>stdin</tt>, \c stdout and <tt>stderr</tt>.
|
||||
`isatty` tests if a file descriptor is a tty.
|
||||
|
||||
If the specified file descriptor is a tty, the exit status of the command is
|
||||
zero. Otherwise, it is non-zero.
|
||||
`FILE DESCRIPTOR` may be either the number of a file descriptor, or one of the strings `stdin`, `stdout`, or `stderr`.
|
||||
|
||||
If the specified file descriptor is a tty, the exit status of the command is zero. Otherwise, the exit status is non-zero. No messages are printed to standard error.
|
||||
|
||||
|
||||
\subsection isatty-examples Examples
|
||||
|
||||
From an interactive shell, the commands below exit with a return value of zero:
|
||||
|
||||
\fish
|
||||
isatty
|
||||
isatty stdout
|
||||
isatty 2
|
||||
echo | isatty 1
|
||||
\endfish
|
||||
|
||||
And these will exit non-zero:
|
||||
|
||||
\fish
|
||||
echo | isatty
|
||||
isatty 9
|
||||
isatty stdout > file
|
||||
isatty 2 2> file
|
||||
\endfish
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
\section jobs jobs - print currently running jobs
|
||||
|
||||
\subsection jobs-synopsis Synopsis
|
||||
<code>jobs [OPTIONS] [PID]</code>
|
||||
\fish{synopsis}
|
||||
jobs [OPTIONS] [PID]
|
||||
\endfish
|
||||
|
||||
\subsection jobs-description Description
|
||||
<code>jobs</code> prints a list of the currently
|
||||
running <a href="index.html#syntax-job-control">jobs</a> and their status.
|
||||
|
||||
`jobs` prints a list of the currently running <a href="index.html#syntax-job-control">jobs</a> and their status.
|
||||
|
||||
jobs accepts the following switches:
|
||||
|
||||
- <code>-c</code> or <code>--command</code> prints the command name for each process in jobs.
|
||||
- <code>-g</code> or <code>--group</code> only prints the group ID of each job.
|
||||
- <code>-h</code> or <code>--help</code> displays a help message and exits.
|
||||
- <code>-l</code> or <code>--last</code> prints only the last job to be started.
|
||||
- <code>-p</code> or <code>--pid</code> prints the process ID for each process in all jobs.
|
||||
- `-c` or `--command` prints the command name for each process in jobs.
|
||||
|
||||
- `-g` or `--group` only prints the group ID of each job.
|
||||
|
||||
- `-l` or `--last` prints only the last job to be started.
|
||||
|
||||
- `-p` or `--pid` prints the process ID for each process in all jobs.
|
||||
|
||||
On systems that supports this feature, jobs will print the CPU usage of each job since the last command was executed. The CPU usage is expressed as a percentage of full CPU activity. Note that on multiprocessor systems, the total activity may be more than 100\%.
|
||||
|
||||
On systems that supports this feature, jobs will print the CPU usage
|
||||
of each job since the last command was executed. The CPU usage is
|
||||
expressed as a percentage of full CPU activity. Note that on
|
||||
multiprocessor systems, the total activity may be more than 100\%.
|
||||
|
||||
\subsection jobs-example Example
|
||||
|
||||
<code>jobs</code> outputs a summary of the current jobs.
|
||||
`jobs` outputs a summary of the current jobs.
|
||||
|
||||
1653
doc_src/license.hdr
1653
doc_src/license.hdr
File diff suppressed because it is too large
Load Diff
@@ -2,25 +2,19 @@
|
||||
\section math math - Perform mathematics calculations
|
||||
|
||||
\subsection math-synopsis Synopsis
|
||||
<tt>math EXPRESSION</tt>
|
||||
\fish{synopsis}
|
||||
math EXPRESSION
|
||||
\endfish
|
||||
|
||||
\subsection math-description Description
|
||||
|
||||
\c math is used to perform mathematical calculations. It is a very
|
||||
thin wrapper for the bc program, which makes it possible to specify an
|
||||
expression from the command line without using non-standard extensions
|
||||
or a pipeline.
|
||||
`math` is used to perform mathematical calculations. It is a very thin wrapper for the bc program, which makes it possible to specify an expression from the command line without using non-standard extensions or a pipeline.
|
||||
|
||||
For a description of the syntax supported by math, see the manual for the bc program. Keep in mind that parameter expansion takes place on any expressions before they are evaluated. This can be very useful in order to perform calculations involving shell variables or the output of command substitutions, but it also means that parenthesis have to be escaped.
|
||||
|
||||
For a description of the syntax supported by math, see the manual for
|
||||
the bc program. Keep in mind that parameter expansion takes place on
|
||||
any expressions before they are evaluated. This can be very useful in
|
||||
order to perform calculations involving environment variables or the
|
||||
output of command substitutions, but it also means that parenthesis
|
||||
have to be escaped.
|
||||
|
||||
\subsection math-example Examples
|
||||
|
||||
<code>math 1+1</code> outputs 2.
|
||||
`math 1+1` outputs 2.
|
||||
|
||||
<code>math $status-128</code> outputs the numerical exit status of the
|
||||
last command minus 128.
|
||||
`math $status-128` outputs the numerical exit status of the last command minus 128.
|
||||
|
||||
@@ -1,26 +1,28 @@
|
||||
\section mimedb mimedb - lookup file information via the mime database
|
||||
|
||||
\subsection mimedb-synopsis Synopsis
|
||||
<tt>mimedb [OPTIONS] FILES...</tt>
|
||||
\fish{synopsis}
|
||||
mimedb [OPTIONS] FILES...
|
||||
\endfish
|
||||
|
||||
\subsection mimedb-description Description
|
||||
|
||||
\c mimedb queries the MIME type database and the \c .desktop files
|
||||
installed on the system in order to find information on
|
||||
the files listed in <code>FILES</code>. The information that \c mimedb
|
||||
can retrieve includes the MIME type for a file, a description of the type,
|
||||
and the default action that can be performed on the file. \c mimedb can also
|
||||
be used to launch the default action for this file.
|
||||
`mimedb` queries the MIME type database and the `.desktop` files installed on the system in order to find information on the files listed in `FILES`. The information that `mimedb` can retrieve includes the MIME type for a file, a description of the type, and the default action that can be performed on the file. `mimedb` can also be used to launch the default action for this file.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- \c -t, \c --input-file-data determines the files' type both by their filename and by their contents (default behaviour).
|
||||
- \c -f, \c --input-filename determines the files' type by their filename.
|
||||
- \c -i, \c --input-mime specifies that the arguments are not files, but MIME types.
|
||||
- \c -m, \c --output-mime outputs the MIME type of each file (default behaviour).
|
||||
- \c -f, \c --output-description outputs the description of each MIME type.
|
||||
- \c -a, \c --output-action outputs the default action of each MIME type.
|
||||
- \c -l, \c --launch launches the default action for the specified files.
|
||||
- \c -h, \c --help displays a help message and exit.
|
||||
- \c -v, \c --version displays the version number and exits.
|
||||
- `-t`, `--input-file-data` determines the files' type both by their filename and by their contents (default behaviour).
|
||||
|
||||
- `-f`, `--input-filename` determines the files' type by their filename.
|
||||
|
||||
- `-i`, `--input-mime` specifies that the arguments are not files, but MIME types.
|
||||
|
||||
- `-m`, `--output-mime` outputs the MIME type of each file (default behaviour).
|
||||
|
||||
- `-f`, `--output-description` outputs the description of each MIME type.
|
||||
|
||||
- `-a`, `--output-action` outputs the default action of each MIME type.
|
||||
|
||||
- `-l`, `--launch` launches the default action for the specified files.
|
||||
|
||||
- `-v`, `--version` displays the version number and exits.
|
||||
|
||||
@@ -1,24 +1,29 @@
|
||||
\section nextd nextd - move forward through directory history
|
||||
|
||||
\subsection nextd-synopsis Synopsis
|
||||
<tt>nextd [-l | --list] [POS]</tt>
|
||||
\fish{synopsis}
|
||||
nextd [ -l | --list ] [POS]
|
||||
\endfish
|
||||
|
||||
\subsection nextd-description Description
|
||||
<tt>nextd</tt> moves forwards <tt>POS</tt> positions in the history of visited
|
||||
directories; if the end of the history has been hit, a warning is printed.
|
||||
|
||||
If the <code>-l></code> or <code>--list</code> flag is specified, the current
|
||||
directory history is also displayed.
|
||||
`nextd` moves forwards `POS` positions in the history of visited directories; if the end of the history has been hit, a warning is printed.
|
||||
|
||||
If the `-l` or `--list` flag is specified, the current directory history is also displayed.
|
||||
|
||||
|
||||
\subsection nextd-example Example
|
||||
|
||||
\code
|
||||
\fish
|
||||
cd /usr/src
|
||||
# Working directory is now /usr/src
|
||||
|
||||
cd /usr/src/fish-shell
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
|
||||
prevd
|
||||
# Working directory is now /usr/src
|
||||
|
||||
nextd
|
||||
# Working directory is now /usr/src/fish-shell</pre>
|
||||
\endcode
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
\endfish
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
\section not not - negate the exit status of a job
|
||||
|
||||
\subsection not-synopsis Synopsis
|
||||
<tt>not COMMAND [OPTIONS...]</tt>
|
||||
\fish{synopsis}
|
||||
not COMMAND [OPTIONS...]
|
||||
\endfish
|
||||
|
||||
\subsection not-description Description
|
||||
|
||||
\c not negates the exit status of another command. If the exit status
|
||||
is zero, \c not returns 1. Otherwise, \c not returns 0.
|
||||
`not` negates the exit status of another command. If the exit status is zero, `not` returns 1. Otherwise, `not` returns 0.
|
||||
|
||||
|
||||
\subsection not-example Example
|
||||
|
||||
The following code reports an error and exits if no file named spoon can be found.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
if not test -f spoon
|
||||
echo There is no spoon
|
||||
exit 1
|
||||
echo There is no spoon
|
||||
exit 1
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
\section open open - open file in its default application
|
||||
|
||||
\subsection open-synopsis Synopsis
|
||||
<tt>open FILES...</tt>
|
||||
\fish{synopsis}
|
||||
open FILES...
|
||||
\endfish
|
||||
|
||||
\subsection open-description Description
|
||||
|
||||
\c open opens a file in its default application, using the \c xdg-open command if it exists, or else the <a href="commands.html#mimedb">mimedb</a> command.
|
||||
`open` opens a file in its default application, using the `xdg-open` command if it exists, or else the <a href="commands.html#mimedb">mimedb</a> command.
|
||||
|
||||
|
||||
\subsection open-example Example
|
||||
|
||||
<tt>open *.txt</tt> opens all the text files in the current directory using your system's default text editor.
|
||||
`open *.txt` opens all the text files in the current directory using your system's default text editor.
|
||||
|
||||
@@ -1,27 +1,23 @@
|
||||
\section or or - conditionally execute a command
|
||||
|
||||
\subsection or-synopsis Synopsis
|
||||
<tt>COMMAND1; or COMMAND2</tt>
|
||||
\fish{synopsis}
|
||||
COMMAND1; or COMMAND2
|
||||
\endfish
|
||||
|
||||
\subsection or-description Description
|
||||
|
||||
\c or is used to execute a command if the current exit
|
||||
status (as set by the last previous command) is not 0.
|
||||
`or` is used to execute a command if the current exit status (as set by the last previous command) is not 0.
|
||||
|
||||
\c or does not change the current exit status.
|
||||
`or` does not change the current exit status.
|
||||
|
||||
The exit status of the last foreground command to exit can always be accessed using the <a href="index.html#variables-status">$status</a> variable.
|
||||
|
||||
The exit status of the last foreground command to exit can always be
|
||||
accessed using the <a href="index.html#variables-status">$status</a>
|
||||
variable.
|
||||
|
||||
\subsection or-example Example
|
||||
|
||||
The following code runs the \c make command to build a program. If the
|
||||
build succeeds, the program is installed. If either step fails,
|
||||
<tt>make clean</tt> is run, which removes the files created by the
|
||||
build process.
|
||||
The following code runs the `make` command to build a program. If the build succeeds, the program is installed. If either step fails, `make clean` is run, which removes the files created by the build process.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
make; and make install; or make clean
|
||||
</pre>
|
||||
|
||||
\endfish
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
\section popd popd - move through directory stack
|
||||
|
||||
\subsection popd-synopsis Synopsis
|
||||
<tt>popd</tt>
|
||||
\fish{synopsis}
|
||||
popd
|
||||
\endfish
|
||||
|
||||
\subsection popd-description Description
|
||||
|
||||
<tt>popd</tt> removes the top directory from the directory stack and
|
||||
changes the working directory to the new top directory. Use <a
|
||||
href="#pushd"><tt>pushd</tt></a> to add directories to the stack.
|
||||
`popd` removes the top directory from the directory stack and changes the working directory to the new top directory. Use <a href="#pushd">`pushd`</a> to add directories to the stack.
|
||||
|
||||
|
||||
\subsection popd-example Example
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
pushd /usr/src
|
||||
# Working directory is now /usr/src
|
||||
# Directory stack contains /usr/src
|
||||
|
||||
pushd /usr/src/fish-shell
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
# Directory stack contains /usr/src /usr/src/fish-shell
|
||||
|
||||
popd
|
||||
# Working directory is now /usr/src
|
||||
# Directory stack contains /usr/src
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
\section prevd prevd - move backward through directory history
|
||||
|
||||
\subsection prevd-synopsis Synopsis
|
||||
<tt>prevd [-l | --list] [POS]</tt>
|
||||
\fish{synopsis}
|
||||
prevd [ -l | --list ] [POS]
|
||||
\endfish
|
||||
|
||||
\subsection prevd-description Description
|
||||
|
||||
<tt>prevd</tt> moves backwards <tt>POS</tt> positions in the history
|
||||
of visited directories; if the beginning of the history has been hit,
|
||||
a warning is printed.
|
||||
`prevd` moves backwards `POS` positions in the history of visited directories; if the beginning of the history has been hit, a warning is printed.
|
||||
|
||||
If the `-l` or `--list` flag is specified, the current history is also displayed.
|
||||
|
||||
If the <code>-l</code> or <code>--list</code> flag is specified, the current
|
||||
history is also displayed.
|
||||
|
||||
\subsection prevd-example Example
|
||||
|
||||
\code
|
||||
\fish
|
||||
cd /usr/src
|
||||
# Working directory is now /usr/src
|
||||
|
||||
cd /usr/src/fish-shell
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
|
||||
prevd
|
||||
# Working directory is now /usr/src
|
||||
|
||||
nextd
|
||||
# Working directory is now /usr/src/fish-shell</pre>
|
||||
\endcode
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
\endfish
|
||||
|
||||
@@ -1,26 +1,20 @@
|
||||
\section psub psub - perform process substitution
|
||||
|
||||
\subsection psub-synopsis Synopsis
|
||||
<tt>COMMAND1 (COMMAND2|psub [-f]) </tt>
|
||||
\fish{synopsis}
|
||||
COMMAND1 ( COMMAND2 | psub [-f] )
|
||||
\endfish
|
||||
|
||||
\subsection psub-description Description
|
||||
|
||||
Posix shells feature a syntax that is a mix between command
|
||||
substitution and piping, called process substitution. It is used to
|
||||
send the output of a command into the calling command, much like
|
||||
command substitution, but with the difference that the output is not
|
||||
sent through commandline arguments but through a named pipe, with the
|
||||
filename of the named pipe sent as an argument to the calling
|
||||
program. \c psub combined with a
|
||||
regular command substitution provides the same functionality.
|
||||
Posix shells feature a syntax that is a mix between command substitution and piping, called process substitution. It is used to send the output of a command into the calling command, much like command substitution, but with the difference that the output is not sent through commandline arguments but through a named pipe, with the filename of the named pipe sent as an argument to the calling program. `psub` combined with a regular command substitution provides the same functionality.
|
||||
|
||||
If the `-f` or `--file` switch is given to `psub`, `psub` will use a regular file instead of a named pipe to communicate with the calling process. This will cause `psub` to be significantly slower when large amounts of data are involved, but has the advantage that the reading process can seek in the stream.
|
||||
|
||||
If the \c -f or \c --file switch is given to <tt>psub</tt>, \c psub will use a
|
||||
regular file instead of a named pipe to communicate with the calling
|
||||
process. This will cause \c psub to be significantly slower when large
|
||||
amounts of data are involved, but has the advantage that the reading
|
||||
process can seek in the stream.
|
||||
|
||||
\subsection psub-example Example
|
||||
|
||||
<tt>diff (sort a.txt|psub) (sort b.txt|psub)</tt> shows the difference
|
||||
between the sorted versions of files a.txt and b.txt.
|
||||
\fish
|
||||
diff (sort a.txt | psub) (sort b.txt | psub)
|
||||
# shows the difference between the sorted versions of files `a.txt` and `b.txt`.
|
||||
\endfish
|
||||
@@ -1,23 +1,27 @@
|
||||
\section pushd pushd - push directory to directory stack
|
||||
|
||||
\subsection pushd-synopsis Synopsis
|
||||
<tt>pushd [DIRECTORY]</tt>
|
||||
\fish{synopsis}
|
||||
pushd [DIRECTORY]
|
||||
\endfish
|
||||
|
||||
\subsection pushd-description Description
|
||||
The <tt>pushd</tt> function adds \c DIRECTORY to the top of the directory stack
|
||||
and makes it the current working directory. <a href="#popd"><tt>popd</tt></a> will pop it off and
|
||||
return to the original directory.
|
||||
|
||||
The `pushd` function adds `DIRECTORY` to the top of the directory stack and makes it the current working directory. <a href="#popd">`popd`</a> will pop it off and return to the original directory.
|
||||
|
||||
|
||||
\subsection pushd-example Example
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
pushd /usr/src
|
||||
# Working directory is now /usr/src
|
||||
# Directory stack contains /usr/src
|
||||
|
||||
pushd /usr/src/fish-shell
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
# Directory stack contains /usr/src /usr/src/fish-shell
|
||||
|
||||
popd
|
||||
# Working directory is now /usr/src
|
||||
# Directory stack contains /usr/src
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
\section pwd pwd - output the current working directory
|
||||
|
||||
\subsection pwd-synopsis Synopsis
|
||||
<tt>pwd</tt>
|
||||
\fish{synopsis}
|
||||
pwd
|
||||
\endfish
|
||||
|
||||
\subsection pwd-description Description
|
||||
|
||||
\c pwd outputs (prints) the current working directory.
|
||||
`pwd` outputs (prints) the current working directory.
|
||||
|
||||
Note that \c fish always resolves symbolic links in the current directory path.
|
||||
Note that `fish` always resolves symbolic links in the current directory path.
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
\section random random - generate random number
|
||||
|
||||
\subsection random-synopsis Synopsis
|
||||
<tt>random [SEED]</tt>
|
||||
\fish{synopsis}
|
||||
random [SEED]
|
||||
\endfish
|
||||
|
||||
\subsection random-description Description
|
||||
|
||||
\c random outputs a random number from 0 to 32766, inclusive.
|
||||
`random` outputs a random number from 0 to 32766, inclusive.
|
||||
|
||||
If a `SEED` value is provided, it is used to seed the random number generator, and no output will be produced. This can be useful for debugging purposes, where it can be desirable to get the same random number sequence multiple times. If the random number generator is called without first seeding it, the current time will be used as the seed.
|
||||
|
||||
If a \c SEED value is provided, it is used to seed the random number
|
||||
generator, and no output will be produced. This can be useful for debugging
|
||||
purposes, where it can be desirable to get the same random number sequence
|
||||
multiple times. If the random number generator is called without first
|
||||
seeding it, the current time will be used as the seed.
|
||||
|
||||
\subsection random-example Example
|
||||
|
||||
The following code will count down from a random number to 1:
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
for i in (seq (random) -1 1)
|
||||
echo $i
|
||||
sleep
|
||||
echo $i
|
||||
sleep
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user