mirror of
https://github.com/sharkdp/bat
synced 2026-08-03 18:51:44 +00:00
Compare commits
704 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d981498d8 | |||
| bd2e9917da | |||
| a6810e3353 | |||
| 591eba66a3 | |||
| a5a9ac83e5 | |||
| 15b122a448 | |||
| 44a905d135 | |||
| 8884104e82 | |||
| 277cc5fa21 | |||
| 0cbd7d583c | |||
| 3c3fc92863 | |||
| e69d650598 | |||
| 9385c81882 | |||
| 1b84f9f1ae | |||
| d879fbd8a1 | |||
| 1fbdef06aa | |||
| f5531cc7fa | |||
| 2ccff145ed | |||
| 43b2ee5e71 | |||
| 51463a4b41 | |||
| 4f0116bee7 | |||
| 31793cfa62 | |||
| 6d75540d4e | |||
| ba5cbe208f | |||
| 2b82203041 | |||
| 35da065445 | |||
| 12a1fe3ad4 | |||
| 91057f2a09 | |||
| 15060f00a5 | |||
| 1a82a03d5d | |||
| 4674105698 | |||
| ca3e9a385f | |||
| f05c222221 | |||
| 3dc5fc54df | |||
| bac84b4c8b | |||
| a5b9a80216 | |||
| 142d5e60ec | |||
| 61f947a580 | |||
| c4bbf28862 | |||
| 9befa81e36 | |||
| 414c7ac83d | |||
| 3a612f063e | |||
| 9daea73bba | |||
| 8e8131590c | |||
| 3acfe790b9 | |||
| 877d9120c9 | |||
| c15b88f250 | |||
| 2889e017cd | |||
| 47ea99090f | |||
| 1c1ba04c41 | |||
| 456216ab37 | |||
| 49d7bf8c39 | |||
| dade4cc6f3 | |||
| c747ac181d | |||
| 9837948c3a | |||
| 072fb380d8 | |||
| 85594956cf | |||
| 88eba56607 | |||
| cc6cf48256 | |||
| e571cb553b | |||
| bf9f6e872d | |||
| 8348c1b746 | |||
| 0a9744ac95 | |||
| 95954b7c57 | |||
| a707f81726 | |||
| dae6664555 | |||
| 9dd807344c | |||
| 2ecebf8ff2 | |||
| 6d3cb5f99f | |||
| ec8072d51f | |||
| 7a7bb80e23 | |||
| 99ac5c3045 | |||
| efab00a9de | |||
| 9ab0801ee1 | |||
| cfdb853ea6 | |||
| 41e857ea16 | |||
| 5b2da2b08d | |||
| 5e0a608ea6 | |||
| 3729aefb6f | |||
| 8a2122b4a4 | |||
| cc6f6fdb1d | |||
| 5ec4936a4f | |||
| be84682bcb | |||
| b07f3b4e74 | |||
| fc1f37d3df | |||
| a3f037773a | |||
| c71c8980cf | |||
| 6bf7b79f13 | |||
| 5d9adc14e7 | |||
| 575888d81b | |||
| 3539d3e72d | |||
| bb25111ca9 | |||
| 3c756a65a6 | |||
| 8d574826c9 | |||
| 7c7eebbe83 | |||
| 57ad85814b | |||
| 4b2b419400 | |||
| b83716f0eb | |||
| 6872a4dd7f | |||
| 4d6b2fec13 | |||
| 57c1a7fd69 | |||
| bf78b74db4 | |||
| f80fba4d24 | |||
| d075d2b453 | |||
| 5650624822 | |||
| bf07b0be58 | |||
| eeea53759b | |||
| a39f1e0f9b | |||
| 1614f80366 | |||
| e293c58bb0 | |||
| 3015ebfba1 | |||
| d7da4f5f2b | |||
| c1af6ff2e6 | |||
| aa4000cb0d | |||
| 33128d75f2 | |||
| bf87f37039 | |||
| 62e715ff5b | |||
| b3903175c8 | |||
| de47bd2323 | |||
| 19b55706ee | |||
| 6c68198d19 | |||
| f3c760c25f | |||
| 24fe946c06 | |||
| de6680bdf2 | |||
| 0a28da0cd0 | |||
| a838ff47b5 | |||
| 8bd078caeb | |||
| bce304a800 | |||
| 206d3e7b91 | |||
| 4be32cf746 | |||
| 4ec6075f81 | |||
| aa00e0a6b0 | |||
| bb7fae72c9 | |||
| 7bd19640a2 | |||
| b7271a2a6d | |||
| ecde418abb | |||
| 51036ced9d | |||
| b6c1ec3a24 | |||
| 46004001cb | |||
| f10c8ce25e | |||
| acc370d345 | |||
| 457ab84065 | |||
| 3bcb5452aa | |||
| 1f0e53a44d | |||
| 2d5cf1d3cf | |||
| a81254ed2a | |||
| fdef133d3d | |||
| fd01f0a0ee | |||
| 5b095ed6f3 | |||
| e7a3f34959 | |||
| 06d0c8f056 | |||
| 4064b8ff14 | |||
| 83ecc3d3ac | |||
| 6615eceb18 | |||
| 53f5a37f01 | |||
| bbef2f41ec | |||
| b6e729abeb | |||
| 5fe98689d4 | |||
| 8832a96e82 | |||
| 09631ed119 | |||
| 9257c7ce20 | |||
| b30f9a1677 | |||
| e6c3f96931 | |||
| 85ff81f238 | |||
| 5e0b7f013a | |||
| aa205c6a9f | |||
| 44bfad24a1 | |||
| 13e01841ca | |||
| a999975bc9 | |||
| edf30e1fa1 | |||
| f41bf2082a | |||
| 894d3f1722 | |||
| 83d96e2bbb | |||
| 7a180e22ff | |||
| 3609700b5e | |||
| 389f64df57 | |||
| e85064e4cf | |||
| dd95f8b5cb | |||
| 975487f630 | |||
| 4ba7546c65 | |||
| c97aa55163 | |||
| 2e1e30705a | |||
| c92ac809a5 | |||
| ec842e8d51 | |||
| 6d6e3900c3 | |||
| 0516a0d7a6 | |||
| adbbe158db | |||
| 6d2be4a305 | |||
| 78c9a5d45b | |||
| 5fa1645165 | |||
| bbf6ec0458 | |||
| e58b20f68d | |||
| 0ce697daba | |||
| a2dfadc6c8 | |||
| 6df8b3fe72 | |||
| b623adc6df | |||
| 2f77da7813 | |||
| 9897c99190 | |||
| aebc30447f | |||
| d2bae54ed0 | |||
| 501c369f39 | |||
| db3468a815 | |||
| 3aabed44ce | |||
| 3af7a6b082 | |||
| 2e985198c6 | |||
| 74a2ef8138 | |||
| 88ea21b276 | |||
| 62397dbd0b | |||
| 317b086f66 | |||
| 12340c1d10 | |||
| e747199711 | |||
| df7ce883c7 | |||
| eb3e2dca24 | |||
| 2d9b936b0a | |||
| 66c7aca2f6 | |||
| 0c3344d0c4 | |||
| 0ac211140a | |||
| 5d490664ca | |||
| d170dd305d | |||
| b50bd58795 | |||
| 1da279a290 | |||
| 100b9a470b | |||
| 43c2b36eaa | |||
| 203d0bd8ae | |||
| 14092fbadb | |||
| 35ad76771d | |||
| 96151c44aa | |||
| 02dcb01120 | |||
| 51d25e5859 | |||
| b8535689d3 | |||
| 8ff890635f | |||
| 29b6ba0758 | |||
| ca5793dbea | |||
| 0fdaa8e745 | |||
| 5a71044d5a | |||
| 8d091051af | |||
| 34da1ef9d6 | |||
| e31e35c46b | |||
| 6258dda0f8 | |||
| e6565b2134 | |||
| 2f9ecf9044 | |||
| a74d35582e | |||
| 8886faa019 | |||
| 4bd1b157ae | |||
| 1ecb70e082 | |||
| 9eed16beb4 | |||
| c432a064a4 | |||
| 2d1a92b7cc | |||
| cb31127b32 | |||
| 2beec1f3ea | |||
| 8d531b6436 | |||
| 30993a8bfc | |||
| 2258fb2713 | |||
| a46191b8bf | |||
| 9c4c3e965b | |||
| 31acbe20d3 | |||
| fd52c01e78 | |||
| 6ca5543648 | |||
| 83afcdcf49 | |||
| 59ca0069a6 | |||
| 6d6184500e | |||
| 1c24ec16e2 | |||
| 5efc0033a1 | |||
| c9237cccab | |||
| 02cd68db37 | |||
| e4df5643dc | |||
| 89b62d579f | |||
| 436a16aba6 | |||
| 32d22f464d | |||
| 71b2089384 | |||
| 57aa88a13a | |||
| 5ef35a10cf | |||
| f84aceec3d | |||
| f18009e5d5 | |||
| 83c7750656 | |||
| c477e23fe9 | |||
| 31fb7087f1 | |||
| 6bc477e88f | |||
| 52d6701f8f | |||
| f97634011e | |||
| a4ffc9d5ed | |||
| a86f3e5b81 | |||
| d9e8bbcb10 | |||
| 8b0886ac32 | |||
| aa182dad76 | |||
| 41a1952928 | |||
| 9885d4ebf0 | |||
| 222e080ce7 | |||
| 046409d7c9 | |||
| 5df449bcf3 | |||
| 6017989c4c | |||
| d349974089 | |||
| ccdea6a429 | |||
| fdf11326ef | |||
| 565a80305c | |||
| 57a8122a6b | |||
| bc5517da78 | |||
| ad18f070ae | |||
| e305402212 | |||
| d62b99f543 | |||
| 4d8133eb34 | |||
| 5cba5b9989 | |||
| 31f23123ef | |||
| b9dac6ca5d | |||
| c3f85c8372 | |||
| 7f5d6d9791 | |||
| 96d4cdb7cb | |||
| 9f1f3ab5e3 | |||
| 6e90f17a15 | |||
| 5b654480f4 | |||
| 803447e2a1 | |||
| 99c04a8740 | |||
| e4370d8d3f | |||
| 883cc964ae | |||
| 1d4cee11b7 | |||
| 9f91a7d797 | |||
| 4a6b4fb632 | |||
| 7c730d11c3 | |||
| 21de52ebea | |||
| cab5ddf6ae | |||
| b3657aef2b | |||
| b0f8841217 | |||
| febe335831 | |||
| cbe68ba84c | |||
| 9110b00e2e | |||
| 4b012de7db | |||
| 49370e2175 | |||
| 02a89d8ee8 | |||
| a70efae79b | |||
| 78a681f027 | |||
| 3a85fd767b | |||
| 2ffbe08eb1 | |||
| f9d5e81f0e | |||
| 00d1267bdd | |||
| 001ee34d01 | |||
| db157567fd | |||
| 9e0fab16ff | |||
| a9af4f4ca1 | |||
| 96d682ca49 | |||
| 7056bea9e0 | |||
| 63e13d8e54 | |||
| 81587b3578 | |||
| 663c7cf1d7 | |||
| 8705d018fd | |||
| 8c33a32256 | |||
| 37a720be06 | |||
| aacbdcfc44 | |||
| 794f3d08f4 | |||
| 3147f0536a | |||
| 42de486e94 | |||
| 54c9d7cdb2 | |||
| c8e394f3f0 | |||
| 4b65e6e443 | |||
| 5a6c65c589 | |||
| 75246fb25b | |||
| 0cc1084819 | |||
| 21eedaf76e | |||
| 2656c503a4 | |||
| 2b3457e8d6 | |||
| f5d606c4fc | |||
| 0e38c1728e | |||
| 6faf61552e | |||
| fcf5ec2f77 | |||
| 99819087f1 | |||
| 3956e96e74 | |||
| a0b89a68d9 | |||
| 62014c1094 | |||
| 58dcabffe6 | |||
| c264f74771 | |||
| f53ea60ed4 | |||
| 05027b7c74 | |||
| 3a62e3d188 | |||
| 963d9ee584 | |||
| 12e4fd138b | |||
| 3c5ce9f86c | |||
| 2461d22212 | |||
| 611c6e9c74 | |||
| 38efdb5148 | |||
| 5fdeeabb44 | |||
| b0d19752c6 | |||
| a95a577622 | |||
| ca44a80a42 | |||
| bf841e63bd | |||
| d357227e57 | |||
| 993d703ba0 | |||
| b449b82191 | |||
| bfac6fd85c | |||
| 2575aae945 | |||
| b0191cdf2c | |||
| fc121f0c87 | |||
| fa10b48c71 | |||
| d4db1c6af3 | |||
| f651e2cfca | |||
| 9d9f99c2d1 | |||
| 9c8dda1f9d | |||
| 89521a5134 | |||
| d11355f985 | |||
| 7ccda6e6e9 | |||
| 1de423c78b | |||
| 3943857087 | |||
| 27bb5c5976 | |||
| 3f614cb274 | |||
| 1e407d972f | |||
| 52b3c5fce4 | |||
| 5d53273ef4 | |||
| bf9faa9c28 | |||
| 0356b7f2c3 | |||
| 19c8558152 | |||
| a137db86a4 | |||
| 2a28f04e09 | |||
| 8dfa69fde4 | |||
| 541f014d50 | |||
| 233d375983 | |||
| b09d245dea | |||
| 44deddbbfe | |||
| aa8a2b1769 | |||
| 4cdac180d8 | |||
| d079bf86b1 | |||
| 62b4452057 | |||
| c3ec92a13f | |||
| c3230a68bb | |||
| d9f163f466 | |||
| d0da5af810 | |||
| a2b2ec467a | |||
| 83b3009f0f | |||
| 4ea70f8409 | |||
| 0d2ef02c9e | |||
| 2d7796284b | |||
| 19aa878a08 | |||
| 9f52012443 | |||
| e57e9b6dbb | |||
| 74e8373e34 | |||
| ec2722d465 | |||
| 9e2ea5fdd4 | |||
| 48b4a6a906 | |||
| 92e93682c6 | |||
| 99226b745f | |||
| 4840c7cd78 | |||
| 71ab4a2058 | |||
| a2c09b41bc | |||
| 0ef792ac1e | |||
| 01af28b781 | |||
| 3a7743ffc5 | |||
| 9cc8e52512 | |||
| 698a6b5acf | |||
| 7a51c7fd30 | |||
| 7c3e9f81cb | |||
| 6e3e7dafca | |||
| fca83bf79a | |||
| b8ffb8d463 | |||
| 1dae5bbc95 | |||
| 1a1932b67a | |||
| 8be375e75b | |||
| e63e4232db | |||
| cef04665eb | |||
| 76569b9527 | |||
| 1d46eb8ea3 | |||
| 6b79ac995e | |||
| ee928b034e | |||
| fc5790eb4a | |||
| 5213ffee0e | |||
| 5ebf0215c5 | |||
| 9957da6b93 | |||
| 342cae2dc6 | |||
| d2b26a5f1f | |||
| 9d08c0102e | |||
| a3357547ea | |||
| 7a9decad70 | |||
| c4d0d068e4 | |||
| c03a027240 | |||
| a8d7141c4c | |||
| 3eb704e016 | |||
| 0f06d3b90d | |||
| 589c94aa93 | |||
| 798b742617 | |||
| 11a72ab765 | |||
| 0319149b4d | |||
| 2f823d59b0 | |||
| 981352992b | |||
| 384ea38bd9 | |||
| 268c0963b4 | |||
| 8b481dd41f | |||
| 6f88ba0e6f | |||
| 9e65ecd03e | |||
| 9cb43ef64d | |||
| bb18ece8a4 | |||
| 2ab6474761 | |||
| fe20328ab7 | |||
| d84ac09abd | |||
| 69e6cae0a7 | |||
| 302707f3ce | |||
| 2e2043971b | |||
| e54e218e3b | |||
| bd17fd571f | |||
| 3f6e88b4be | |||
| 28af18ba27 | |||
| 8f1babf346 | |||
| fa25695b74 | |||
| 943b1f82b6 | |||
| b7a09516e7 | |||
| c4031ad65c | |||
| 2eaced4d30 | |||
| bdea2fe94c | |||
| c96ff30876 | |||
| 4c100cffdb | |||
| d6abad908a | |||
| f1129189ea | |||
| 7e84477408 | |||
| 6b86ab5cd0 | |||
| 5074b96cd5 | |||
| 3094ac90b7 | |||
| 35b6067496 | |||
| 5aa20c090b | |||
| 9c371ed8a2 | |||
| f03ab11623 | |||
| 887e61a99d | |||
| 0aca8cab0b | |||
| d08d1f8c45 | |||
| 403ab6e443 | |||
| b8687bc969 | |||
| 9166c9dd35 | |||
| cc52f79e42 | |||
| 59140b458c | |||
| 82981c9663 | |||
| 157b8dd848 | |||
| 1fb669ae1a | |||
| 7d07aa395a | |||
| c2c7070712 | |||
| daf06bb026 | |||
| 5b11b1ba47 | |||
| ee287447c5 | |||
| 257f978ceb | |||
| 8e803bdb02 | |||
| a265242e6e | |||
| 3aa9b31bda | |||
| c692c4770a | |||
| 6ceba56288 | |||
| 4be66f8b88 | |||
| 54a85d98f1 | |||
| 491a5a17f3 | |||
| b3373398e8 | |||
| 0040fef215 | |||
| 1a6e8d297f | |||
| f39487fca9 | |||
| 2596bfe7a7 | |||
| 406bffa8c8 | |||
| 48441b99ef | |||
| ce4717144a | |||
| f59d00d4c7 | |||
| dcfdbf82dd | |||
| 0cb884d501 | |||
| 7bc4020a92 | |||
| 0792195156 | |||
| 83f24ffcfb | |||
| 74ec390770 | |||
| 9014ffcfd8 | |||
| 81af375289 | |||
| d707eab95c | |||
| d64c55ef11 | |||
| 2b1d53fb27 | |||
| bf696f58c8 | |||
| 296bad8ffd | |||
| 94310af30c | |||
| 38c096bf79 | |||
| 696d1b3ed3 | |||
| 17d98724a5 | |||
| 7d7ee1b594 | |||
| 682b4209f2 | |||
| 41ddcbd240 | |||
| 48a7ce3bf2 | |||
| 3bcc4d0d55 | |||
| 8821bca656 | |||
| 56111aa20d | |||
| 5fe8a8342b | |||
| 989109145a | |||
| 23afc8e90c | |||
| 8e18786556 | |||
| 81488adf8b | |||
| e37e9c1214 | |||
| a4828387c1 | |||
| abeac8b12e | |||
| 82e7786e74 | |||
| 0064321323 | |||
| 9e622a1a5f | |||
| 59ca933aee | |||
| 793af6b911 | |||
| c8abe3f235 | |||
| 5d71056209 | |||
| eb7d4d002a | |||
| 62b32bd848 | |||
| 8961f7aef8 | |||
| 17f3a3b95d | |||
| 261a7ea154 | |||
| 53a973e9dd | |||
| cba9df746e | |||
| 12eee0c590 | |||
| b76f5e72d4 | |||
| 702cb198da | |||
| 5f826419d1 | |||
| 13f671b499 | |||
| 49f4322054 | |||
| 0c9e044e41 | |||
| 74d4377ed2 | |||
| 6a124591df | |||
| 7a87315b94 | |||
| 0cde4e9121 | |||
| 36dde9275a | |||
| a8f759c080 | |||
| f034be71e7 | |||
| eee35e54e9 | |||
| ec0ce05455 | |||
| 13e6b3fac7 | |||
| 26c951fec4 | |||
| 590960f7f5 | |||
| b4d54106fe | |||
| f3b90ddb38 | |||
| 3bacfc5184 | |||
| f8d0956893 | |||
| 1dc328ad49 | |||
| 5e5cb89da6 | |||
| 057e4eced1 | |||
| 27974616bf | |||
| 319ab779ee | |||
| 37831cdcb3 | |||
| 70480ee9d4 | |||
| 371c929ede | |||
| 864656bd11 | |||
| 2e9cf63a5f | |||
| 886b22e0ee | |||
| 72618db179 | |||
| c8273369cc | |||
| 95a56a2795 | |||
| 859ff50766 | |||
| ce583eb9bf | |||
| 3a195be14e | |||
| 5f6e310152 | |||
| 5449472f15 | |||
| 82e20bfe14 | |||
| 47abb192bc | |||
| 03a7d6be92 | |||
| a927815292 | |||
| 3447a03433 | |||
| 03c2281828 | |||
| c386cb35fb | |||
| 97ea3dd4dc | |||
| a6d9d1551f | |||
| 34619a2e89 | |||
| 83d408bab3 | |||
| 8067fd9eda | |||
| 98ba9e0101 | |||
| 1b8ce60054 | |||
| d5a31dc2ec | |||
| 051dd4ba87 | |||
| 2ad1848859 | |||
| 90e7d2fe33 | |||
| 04fa84aea7 | |||
| a3f8140fbe | |||
| 96aedf6240 | |||
| 4cc2989fe9 | |||
| 0ecc94956b | |||
| 61e47e0c13 | |||
| f5145ef130 | |||
| edd27645d0 | |||
| fc6f4f31dd | |||
| f2cef702a0 | |||
| 8b3d54ce29 | |||
| 47a3721890 | |||
| 495fab24a5 | |||
| fccbe4f4f2 | |||
| 9793bb3938 | |||
| 496dd29cb9 | |||
| 116d76a00f | |||
| dd336e6fb2 | |||
| c33af3581a | |||
| 2f4ecf8fc5 | |||
| e037afeaca | |||
| 7b87af1748 | |||
| 0eee26fb09 | |||
| 3355aeba22 | |||
| 42e3825daf | |||
| 014d754588 | |||
| 4e11abdf9b | |||
| 570805bc98 | |||
| e7e1967bb0 | |||
| 9a050cd87f | |||
| d39507889a | |||
| 3e8d444c78 | |||
| 522ab7a83c | |||
| 0c5b4fcd4a | |||
| 37b3b8730d | |||
| 7c50fe5fec | |||
| 40a827ebcb | |||
| 376c556862 | |||
| 83772bd2cf | |||
| 4aef8c180a | |||
| 131d113ff5 | |||
| 38178fedf4 | |||
| 59f2e2d58d | |||
| 8d3136eb6f | |||
| 136a745c5d | |||
| fb3c775c8b | |||
| 8adce9fae8 | |||
| cfa2cb6ec7 | |||
| 517be5c7bc |
@@ -0,0 +1 @@
|
|||||||
|
comment: false
|
||||||
@@ -28,11 +28,11 @@ If you're on Windows:
|
|||||||
**Describe the bug you encountered:**
|
**Describe the bug you encountered:**
|
||||||
...
|
...
|
||||||
|
|
||||||
**Describe what you expected to happen?**
|
**What did you expect to happen instead?**
|
||||||
...
|
...
|
||||||
|
|
||||||
**How did you install `bat`?**
|
**How did you install `bat`?**
|
||||||
apt-get, homebrew, GitHub release, etc.
|
<!-- apt-get, homebrew, GitHub release, etc. -->
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,443 @@
|
|||||||
|
name: CICD
|
||||||
|
|
||||||
|
env:
|
||||||
|
PROJECT_NAME: bat
|
||||||
|
PROJECT_DESC: "A `cat` clone with wings"
|
||||||
|
PROJECT_MAINTAINER: "David Peter <mail@david-peter.de>"
|
||||||
|
PROJECT_HOMEPAGE: "https://github.com/sharkdp/bat"
|
||||||
|
MIN_SUPPORTED_RUST_VERSION: "1.40.0"
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
min_version:
|
||||||
|
name: Minimum supported rust version
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Git checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}
|
||||||
|
default: true
|
||||||
|
profile: minimal # minimal component installation (ie, no documentation)
|
||||||
|
- name: Test
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
|
||||||
|
test_with_new_syntaxes_and_themes:
|
||||||
|
name: Test with new syntaxes and themes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Git checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: true # we need all syntax and theme submodules
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
default: true
|
||||||
|
profile: minimal
|
||||||
|
- name: Build and install bat
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: install
|
||||||
|
args: --locked --path .
|
||||||
|
- name: Rebuild binary assets (syntaxes and themes)
|
||||||
|
run: bash assets/create.sh
|
||||||
|
- name: Build and install bat with updated assets
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: install
|
||||||
|
args: --locked --path .
|
||||||
|
- name: Run unit tests with new syntaxes and themes
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --release
|
||||||
|
- name: Run ignored-by-default unit tests with new syntaxes and themes
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --release -- --ignored
|
||||||
|
- name: Syntax highlighting regression test
|
||||||
|
run: tests/syntax-tests/regression_test.sh
|
||||||
|
- name: List of languages
|
||||||
|
run: bat --list-languages
|
||||||
|
- name: List of themes
|
||||||
|
run: bat --list-themes
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ${{ matrix.job.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
job:
|
||||||
|
# { os, target, cargo-options, features, use-cross, toolchain }
|
||||||
|
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , use-cross: use-cross }
|
||||||
|
- { os: ubuntu-18.04 , target: aarch64-unknown-linux-gnu , use-cross: use-cross }
|
||||||
|
- { os: ubuntu-18.04 , target: i686-unknown-linux-gnu , use-cross: use-cross }
|
||||||
|
- { os: ubuntu-18.04 , target: i686-unknown-linux-musl , use-cross: use-cross }
|
||||||
|
- { os: ubuntu-18.04 , target: x86_64-unknown-linux-gnu , use-cross: use-cross }
|
||||||
|
- { os: ubuntu-18.04 , target: x86_64-unknown-linux-musl , use-cross: use-cross }
|
||||||
|
- { os: ubuntu-16.04 , target: x86_64-unknown-linux-gnu , use-cross: use-cross }
|
||||||
|
- { os: macos-latest , target: x86_64-apple-darwin }
|
||||||
|
# - { os: windows-latest , target: i686-pc-windows-gnu } ## disabled; linker errors (missing '_imp____acrt_iob_func')
|
||||||
|
- { os: windows-latest , target: i686-pc-windows-msvc }
|
||||||
|
# - { os: windows-latest , target: x86_64-pc-windows-gnu } ## disabled; linker errors (missing '_imp____acrt_iob_func')
|
||||||
|
- { os: windows-latest , target: x86_64-pc-windows-msvc }
|
||||||
|
steps:
|
||||||
|
- name: Git checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install prerequisites
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
case ${{ matrix.job.target }} in
|
||||||
|
arm-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
|
||||||
|
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
|
||||||
|
esac
|
||||||
|
- name: Initialize workflow variables
|
||||||
|
id: vars
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# toolchain
|
||||||
|
TOOLCHAIN="stable" ## default to "stable" toolchain
|
||||||
|
# * specify alternate TOOLCHAIN for *-pc-windows-gnu targets; gnu targets on Windows are broken for the standard *-pc-windows-msvc toolchain (refs: <https://github.com/rust-lang/rust/issues/47048>, <https://github.com/rust-lang/rust/issues/53454>, <https://github.com/rust-lang/cargo/issues/6754>)
|
||||||
|
case ${{ matrix.job.target }} in *-pc-windows-gnu) TOOLCHAIN="stable-${{ matrix.job.target }}" ;; esac;
|
||||||
|
# * use requested TOOLCHAIN if specified
|
||||||
|
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi
|
||||||
|
echo set-output name=TOOLCHAIN::${TOOLCHAIN}
|
||||||
|
echo ::set-output name=TOOLCHAIN::${TOOLCHAIN}
|
||||||
|
# staging directory
|
||||||
|
STAGING='_staging'
|
||||||
|
echo set-output name=STAGING::${STAGING}
|
||||||
|
echo ::set-output name=STAGING::${STAGING}
|
||||||
|
# determine EXE suffix
|
||||||
|
EXE_suffix="" ; case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac;
|
||||||
|
echo set-output name=EXE_suffix::${EXE_suffix}
|
||||||
|
echo ::set-output name=EXE_suffix::${EXE_suffix}
|
||||||
|
# parse commit reference info
|
||||||
|
REF_NAME=${GITHUB_REF#refs/*/}
|
||||||
|
unset REF_BRANCH ; case ${GITHUB_REF} in refs/heads/*) REF_BRANCH=${GITHUB_REF#refs/heads/} ;; esac;
|
||||||
|
unset REF_TAG ; case ${GITHUB_REF} in refs/tags/*) REF_TAG=${GITHUB_REF#refs/tags/} ;; esac;
|
||||||
|
REF_SHAS=${GITHUB_SHA:0:8}
|
||||||
|
echo set-output name=REF_NAME::${REF_NAME}
|
||||||
|
echo set-output name=REF_BRANCH::${REF_BRANCH}
|
||||||
|
echo set-output name=REF_TAG::${REF_TAG}
|
||||||
|
echo set-output name=REF_SHAS::${REF_SHAS}
|
||||||
|
echo ::set-output name=REF_NAME::${REF_NAME}
|
||||||
|
echo ::set-output name=REF_BRANCH::${REF_BRANCH}
|
||||||
|
echo ::set-output name=REF_TAG::${REF_TAG}
|
||||||
|
echo ::set-output name=REF_SHAS::${REF_SHAS}
|
||||||
|
# parse target
|
||||||
|
unset TARGET_ARCH ; case ${{ matrix.job.target }} in arm-unknown-linux-gnueabihf) TARGET_ARCH=arm ;; i686-*) TARGET_ARCH=i686 ;; x86_64-*) TARGET_ARCH=x86_64 ;; esac;
|
||||||
|
echo set-output name=TARGET_ARCH::${TARGET_ARCH}
|
||||||
|
echo ::set-output name=TARGET_ARCH::${TARGET_ARCH}
|
||||||
|
unset TARGET_OS ; case ${{ matrix.job.target }} in *-linux-*) TARGET_OS=linux ;; *-apple-*) TARGET_OS=macos ;; *-windows-*) TARGET_OS=windows ;; esac;
|
||||||
|
echo set-output name=TARGET_OS::${TARGET_OS}
|
||||||
|
echo ::set-output name=TARGET_OS::${TARGET_OS}
|
||||||
|
# package name
|
||||||
|
PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac;
|
||||||
|
PKG_BASENAME=${PROJECT_NAME}-${REF_TAG:-$REF_SHAS}-${{ matrix.job.target }}
|
||||||
|
PKG_NAME=${PKG_BASENAME}${PKG_suffix}
|
||||||
|
echo set-output name=PKG_suffix::${PKG_suffix}
|
||||||
|
echo set-output name=PKG_BASENAME::${PKG_BASENAME}
|
||||||
|
echo set-output name=PKG_NAME::${PKG_NAME}
|
||||||
|
echo ::set-output name=PKG_suffix::${PKG_suffix}
|
||||||
|
echo ::set-output name=PKG_BASENAME::${PKG_BASENAME}
|
||||||
|
echo ::set-output name=PKG_NAME::${PKG_NAME}
|
||||||
|
# deployable tag? (ie, leading "vM" or "M"; M == version number)
|
||||||
|
unset DEPLOY ; if [[ $REF_TAG =~ ^[vV]?[0-9].* ]]; then DEPLOY='true' ; fi
|
||||||
|
echo set-output name=DEPLOY::${DEPLOY:-<empty>/false}
|
||||||
|
echo ::set-output name=DEPLOY::${DEPLOY}
|
||||||
|
# DPKG architecture?
|
||||||
|
unset DPKG_ARCH
|
||||||
|
case ${{ matrix.job.target }} in
|
||||||
|
aarch64-*-linux-*) DPKG_ARCH=arm64 ;;
|
||||||
|
arm-*-linux-*hf) DPKG_ARCH=armhf ;;
|
||||||
|
i686-*-linux-*) DPKG_ARCH=i686 ;;
|
||||||
|
x86_64-*-linux-*) DPKG_ARCH=amd64 ;;
|
||||||
|
esac;
|
||||||
|
echo set-output name=DPKG_ARCH::${DPKG_ARCH}
|
||||||
|
echo ::set-output name=DPKG_ARCH::${DPKG_ARCH}
|
||||||
|
# DPKG version?
|
||||||
|
unset DPKG_VERSION ; if [[ $REF_TAG =~ ^[vV]?[0-9].* ]]; then DPKG_VERSION=${REF_TAG/#[vV]/} ; fi
|
||||||
|
echo set-output name=DPKG_VERSION::${DPKG_VERSION}
|
||||||
|
echo ::set-output name=DPKG_VERSION::${DPKG_VERSION}
|
||||||
|
# DPKG base name/conflicts?
|
||||||
|
DPKG_BASENAME=${PROJECT_NAME}
|
||||||
|
DPKG_CONFLICTS=${PROJECT_NAME}-musl
|
||||||
|
case ${{ matrix.job.target }} in *-musl) DPKG_BASENAME=${PROJECT_NAME}-musl ; DPKG_CONFLICTS=${PROJECT_NAME} ;; esac;
|
||||||
|
echo set-output name=DPKG_BASENAME::${DPKG_BASENAME}
|
||||||
|
echo set-output name=DPKG_CONFLICTS::${DPKG_CONFLICTS}
|
||||||
|
echo ::set-output name=DPKG_BASENAME::${DPKG_BASENAME}
|
||||||
|
echo ::set-output name=DPKG_CONFLICTS::${DPKG_CONFLICTS}
|
||||||
|
# DPKG name
|
||||||
|
unset DPKG_NAME;
|
||||||
|
if [[ -n $DPKG_ARCH && -n $DPKG_VERSION ]]; then DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb" ; fi
|
||||||
|
echo set-output name=DPKG_NAME::${DPKG_NAME}
|
||||||
|
echo ::set-output name=DPKG_NAME::${DPKG_NAME}
|
||||||
|
# target-specific options
|
||||||
|
# * CARGO_USE_CROSS (truthy)
|
||||||
|
CARGO_USE_CROSS='true' ; case '${{ matrix.job.use-cross }}' in ''|0|f|false|n|no) unset CARGO_USE_CROSS ;; esac;
|
||||||
|
echo set-output name=CARGO_USE_CROSS::${CARGO_USE_CROSS:-<empty>/false}
|
||||||
|
echo ::set-output name=CARGO_USE_CROSS::${CARGO_USE_CROSS}
|
||||||
|
# # * `arm` cannot be tested on ubuntu-* hosts (b/c testing is currently primarily done via comparison of target outputs with built-in outputs and the `arm` target is not executable on the host)
|
||||||
|
JOB_DO_TESTING="true"
|
||||||
|
case ${{ matrix.job.target }} in arm-*) unset JOB_DO_TESTING ;; esac;
|
||||||
|
echo set-output name=JOB_DO_TESTING::${JOB_DO_TESTING:-<empty>/false}
|
||||||
|
echo ::set-output name=JOB_DO_TESTING::${JOB_DO_TESTING}
|
||||||
|
# # * test only library unit tests and binary for arm-type targets
|
||||||
|
unset CARGO_TEST_OPTIONS
|
||||||
|
unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac;
|
||||||
|
echo set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS}
|
||||||
|
echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS}
|
||||||
|
# * executable for `strip`?
|
||||||
|
STRIP="strip" ; case ${{ matrix.job.target }} in arm-unknown-linux-gnueabihf) STRIP="arm-linux-gnueabihf-strip" ;; aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;; *-pc-windows-msvc) STRIP="" ;; esac;
|
||||||
|
echo set-output name=STRIP::${STRIP}
|
||||||
|
echo ::set-output name=STRIP::${STRIP}
|
||||||
|
- name: Create all needed build/work directories
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p '${{ steps.vars.outputs.STAGING }}'
|
||||||
|
mkdir -p '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}'
|
||||||
|
mkdir -p '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/autocomplete'
|
||||||
|
mkdir -p '${{ steps.vars.outputs.STAGING }}/dpkg'
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ steps.vars.outputs.TOOLCHAIN }}
|
||||||
|
target: ${{ matrix.job.target }}
|
||||||
|
override: true
|
||||||
|
profile: minimal # minimal component installation (ie, no documentation)
|
||||||
|
- name: Info
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
gcc --version || true
|
||||||
|
rustup -V
|
||||||
|
rustup toolchain list
|
||||||
|
rustup default
|
||||||
|
cargo -V
|
||||||
|
rustc -V
|
||||||
|
- name: Build
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||||
|
command: build
|
||||||
|
args: --release --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }}
|
||||||
|
- name: Test
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||||
|
command: test
|
||||||
|
args: --target=${{ matrix.job.target }} ${{ steps.vars.outputs.CARGO_TEST_OPTIONS}} ${{ matrix.job.cargo-options }}
|
||||||
|
- name: bat test run
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||||
|
command: run
|
||||||
|
args: --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} -- --paging=never --color=always --theme=ansi-dark Cargo.toml src/config.rs
|
||||||
|
- name: Check features regex-onig
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||||
|
command: check
|
||||||
|
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig
|
||||||
|
- name: Check features regex-onig,git
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||||
|
command: check
|
||||||
|
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git
|
||||||
|
- name: Check features regex-onig,paging
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||||
|
command: check
|
||||||
|
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,paging
|
||||||
|
- name: Check features regex-onig,git,paging
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||||
|
command: check
|
||||||
|
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git,paging
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@master
|
||||||
|
with:
|
||||||
|
name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}
|
||||||
|
path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
|
||||||
|
- name: Package
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
ARCHIVE_DIR='${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/'
|
||||||
|
# Binary
|
||||||
|
cp 'target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' "$ARCHIVE_DIR"
|
||||||
|
|
||||||
|
# `strip` binary (if needed)
|
||||||
|
if [ -n "${{ steps.vars.outputs.STRIP }}" ]; then "${{ steps.vars.outputs.STRIP }}" "$ARCHIVE_DIR/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}" ; fi
|
||||||
|
|
||||||
|
# Man page
|
||||||
|
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/bat.1 "$ARCHIVE_DIR"
|
||||||
|
|
||||||
|
# README and LICENSE files
|
||||||
|
cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "$ARCHIVE_DIR"
|
||||||
|
|
||||||
|
# Autocompletion files
|
||||||
|
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.fish"
|
||||||
|
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.zsh"
|
||||||
|
|
||||||
|
# base compressed package
|
||||||
|
pushd '${{ steps.vars.outputs.STAGING }}/' >/dev/null
|
||||||
|
case ${{ matrix.job.target }} in
|
||||||
|
*-pc-windows-*) 7z -y a '${{ steps.vars.outputs.PKG_NAME }}' '${{ steps.vars.outputs.PKG_BASENAME }}'/* | tail -2 ;;
|
||||||
|
*) tar czf '${{ steps.vars.outputs.PKG_NAME }}' '${{ steps.vars.outputs.PKG_BASENAME }}'/* ;;
|
||||||
|
esac;
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
# Debian package
|
||||||
|
if [ -n "${{ steps.vars.outputs.DPKG_NAME }}" ]; then
|
||||||
|
DPKG_DIR="${{ steps.vars.outputs.STAGING }}/dpkg"
|
||||||
|
|
||||||
|
# Binary
|
||||||
|
install -Dm755 'target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}"
|
||||||
|
if [ -n "${{ steps.vars.outputs.STRIP }}" ]; then "${{ steps.vars.outputs.STRIP }}" "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}" ; fi
|
||||||
|
|
||||||
|
# Man page
|
||||||
|
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/bat.1 "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
|
||||||
|
gzip --best "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
|
||||||
|
|
||||||
|
# Autocompletion files
|
||||||
|
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "${DPKG_DIR}/usr/share/fish/vendor_completions.d/${{ env.PROJECT_NAME }}.fish"
|
||||||
|
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ env.PROJECT_NAME }}"
|
||||||
|
|
||||||
|
# README and LICENSE
|
||||||
|
install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/README.md"
|
||||||
|
install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/LICENSE-MIT"
|
||||||
|
install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/LICENSE-APACHE"
|
||||||
|
|
||||||
|
cat > "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/copyright" <<EOF
|
||||||
|
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: ${{ env.PROJECT_NAME }}
|
||||||
|
Source: ${{ env.PROJECT_HOMEPAGE }}
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: ${{ env.PROJECT_MAINTAINER }}
|
||||||
|
License: Apache-2.0 or MIT
|
||||||
|
|
||||||
|
License: Apache-2.0
|
||||||
|
On Debian systems, the complete text of the Apache-2.0 can be found in the
|
||||||
|
file /usr/share/common-licenses/Apache-2.0.
|
||||||
|
|
||||||
|
License: MIT
|
||||||
|
Permission is hereby granted, free of charge, to any
|
||||||
|
person obtaining a copy of this software and associated
|
||||||
|
documentation files (the "Software"), to deal in the
|
||||||
|
Software without restriction, including without
|
||||||
|
limitation the rights to use, copy, modify, merge,
|
||||||
|
publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software
|
||||||
|
is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
.
|
||||||
|
The above copyright notice and this permission notice
|
||||||
|
shall be included in all copies or substantial portions
|
||||||
|
of the Software.
|
||||||
|
.
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||||
|
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||||
|
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||||
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# control file
|
||||||
|
mkdir -p "${DPKG_DIR}/DEBIAN"
|
||||||
|
cat > "${DPKG_DIR}/DEBIAN/control" <<EOF
|
||||||
|
Package: ${{ steps.vars.outputs.DPKG_BASENAME }}
|
||||||
|
Version: ${{ steps.vars.outputs.DPKG_VERSION }}
|
||||||
|
Section: utils
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: ${{ env.PROJECT_MAINTAINER }}
|
||||||
|
Homepage: ${{ env.PROJECT_HOMEPAGE }}
|
||||||
|
Architecture: ${{ steps.vars.outputs.DPKG_ARCH }}
|
||||||
|
Provides: ${{ env.PROJECT_NAME }}
|
||||||
|
Conflicts: ${{ steps.vars.outputs.DPKG_CONFLICTS }}
|
||||||
|
Description: A cat(1) clone with wings.
|
||||||
|
A cat(1) clone with syntax highlighting and Git integration.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# build dpkg
|
||||||
|
fakeroot dpkg-deb --build "${DPKG_DIR}" "${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}"
|
||||||
|
fi
|
||||||
|
- name: Publish archives and packages
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
if: steps.vars.outputs.DEPLOY
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
|
||||||
|
${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
name: Code Coverage
|
||||||
|
runs-on: ${{ matrix.job.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
# job: [ { os: ubuntu-latest }, { os: macos-latest }, { os: windows-latest } ]
|
||||||
|
job:
|
||||||
|
- { os: ubuntu-latest , toolchain: nightly-2020-04-29 }
|
||||||
|
- { os: macos-latest , toolchain: nightly-2020-04-29 }
|
||||||
|
- { os: windows-latest , toolchain: nightly-2020-04-29-x86_64-pc-windows-gnu }
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Initialize workflow variables
|
||||||
|
id: vars
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# toolchain
|
||||||
|
TOOLCHAIN="nightly" ## default to "nightly" toolchain
|
||||||
|
# * use requested TOOLCHAIN if specified
|
||||||
|
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi
|
||||||
|
# * use requested TOOLCHAIN if specified
|
||||||
|
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi
|
||||||
|
echo set-output name=TOOLCHAIN::${TOOLCHAIN}
|
||||||
|
echo ::set-output name=TOOLCHAIN::${TOOLCHAIN}
|
||||||
|
# target-specific options
|
||||||
|
# * CODECOV_FLAGS
|
||||||
|
CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' )
|
||||||
|
echo set-output name=CODECOV_FLAGS::${CODECOV_FLAGS}
|
||||||
|
echo ::set-output name=CODECOV_FLAGS::${CODECOV_FLAGS}
|
||||||
|
- name: rust toolchain ~ install
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ steps.vars.outputs.TOOLCHAIN }}
|
||||||
|
override: true
|
||||||
|
profile: minimal # minimal component installation (ie, no documentation)
|
||||||
|
- name: Test
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --no-fail-fast
|
||||||
|
env:
|
||||||
|
CARGO_INCREMENTAL: '0'
|
||||||
|
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads'
|
||||||
|
- name: Generate coverage data
|
||||||
|
id: coverage
|
||||||
|
uses: actions-rs/grcov@v0.1
|
||||||
|
- name: Upload coverage results (to Codecov.io)
|
||||||
|
uses: codecov/codecov-action@v1
|
||||||
|
with:
|
||||||
|
file: ${{ steps.coverage.outputs.report }}
|
||||||
|
flags: ${{ steps.vars.outputs.CODECOV_FLAGS }}
|
||||||
|
name: codecov-umbrella
|
||||||
|
fail_ci_if_error: false
|
||||||
@@ -3,4 +3,6 @@
|
|||||||
|
|
||||||
# Generated files
|
# Generated files
|
||||||
/assets/completions/bat.fish
|
/assets/completions/bat.fish
|
||||||
|
/assets/completions/bat.zsh
|
||||||
/assets/manual/bat.1
|
/assets/manual/bat.1
|
||||||
|
/assets/metadata.yaml
|
||||||
|
|||||||
+39
-9
@@ -70,9 +70,6 @@
|
|||||||
[submodule "assets/syntaxes/JavaScript (Babel)"]
|
[submodule "assets/syntaxes/JavaScript (Babel)"]
|
||||||
path = assets/syntaxes/02_Extra/JavaScript (Babel)
|
path = assets/syntaxes/02_Extra/JavaScript (Babel)
|
||||||
url = https://github.com/babel/babel-sublime
|
url = https://github.com/babel/babel-sublime
|
||||||
[submodule "assets/syntaxes/Cabal"]
|
|
||||||
path = assets/syntaxes/02_Extra/Cabal
|
|
||||||
url = https://github.com/SublimeHaskell/SublimeHaskell
|
|
||||||
[submodule "assets/syntaxes/Dart"]
|
[submodule "assets/syntaxes/Dart"]
|
||||||
path = assets/syntaxes/02_Extra/Dart
|
path = assets/syntaxes/02_Extra/Dart
|
||||||
url = https://github.com/guillermooo/dart-sublime-bundle
|
url = https://github.com/guillermooo/dart-sublime-bundle
|
||||||
@@ -97,9 +94,6 @@
|
|||||||
[submodule "assets/themes/sublime-snazzy"]
|
[submodule "assets/themes/sublime-snazzy"]
|
||||||
path = assets/themes/sublime-snazzy
|
path = assets/themes/sublime-snazzy
|
||||||
url = https://github.com/greggb/sublime-snazzy
|
url = https://github.com/greggb/sublime-snazzy
|
||||||
[submodule "assets/syntaxes/AsciiDoc"]
|
|
||||||
path = assets/syntaxes/02_Extra/AsciiDoc
|
|
||||||
url = https://github.com/SublimeText/AsciiDoc.git
|
|
||||||
[submodule "assets/syntaxes/Assembly (ARM)"]
|
[submodule "assets/syntaxes/Assembly (ARM)"]
|
||||||
path = assets/syntaxes/02_Extra/Assembly (ARM)
|
path = assets/syntaxes/02_Extra/Assembly (ARM)
|
||||||
url = https://github.com/tvi/Sublime-ARM-Assembly
|
url = https://github.com/tvi/Sublime-ARM-Assembly
|
||||||
@@ -166,9 +160,6 @@
|
|||||||
[submodule "assets/themes/Nord-sublime"]
|
[submodule "assets/themes/Nord-sublime"]
|
||||||
path = assets/themes/Nord-sublime
|
path = assets/themes/Nord-sublime
|
||||||
url = https://github.com/crabique/Nord-plist.git
|
url = https://github.com/crabique/Nord-plist.git
|
||||||
[submodule "assets/themes/solarized-sublime"]
|
|
||||||
path = assets/themes/solarized-sublime
|
|
||||||
url = https://github.com/paulcpederson/solarized-sublime.git
|
|
||||||
[submodule "assets/syntaxes/Vue"]
|
[submodule "assets/syntaxes/Vue"]
|
||||||
path = assets/syntaxes/02_Extra/Vue
|
path = assets/syntaxes/02_Extra/Vue
|
||||||
url = https://github.com/vuejs/vue-syntax-highlight.git
|
url = https://github.com/vuejs/vue-syntax-highlight.git
|
||||||
@@ -176,3 +167,42 @@
|
|||||||
[submodule "assets/syntaxes/CoffeeScript"]
|
[submodule "assets/syntaxes/CoffeeScript"]
|
||||||
path = assets/syntaxes/02_Extra/CoffeeScript
|
path = assets/syntaxes/02_Extra/CoffeeScript
|
||||||
url = https://github.com/sustained/CoffeeScript-Sublime-Plugin
|
url = https://github.com/sustained/CoffeeScript-Sublime-Plugin
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Stylus"]
|
||||||
|
path = assets/syntaxes/02_Extra/Stylus
|
||||||
|
url = https://github.com/billymoon/Stylus
|
||||||
|
[submodule "assets/themes/Solarized"]
|
||||||
|
path = assets/themes/Solarized
|
||||||
|
url = https://github.com/braver/Solarized
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Fortran"]
|
||||||
|
path = assets/syntaxes/02_Extra/Fortran
|
||||||
|
url = https://github.com/315234/SublimeFortran
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Email"]
|
||||||
|
path = assets/syntaxes/02_Extra/Email
|
||||||
|
url = https://github.com/mariozaizar/email.sublime-syntax.git
|
||||||
|
[submodule "assets/syntaxes/02_Extra/QML"]
|
||||||
|
path = assets/syntaxes/02_Extra/QML
|
||||||
|
url = https://github.com/skozlovf/Sublime-QML
|
||||||
|
[submodule "assets/syntaxes/02_Extra/AsciiDoc"]
|
||||||
|
path = assets/syntaxes/02_Extra/AsciiDoc
|
||||||
|
url = https://github.com/asciidoctor/sublimetext-asciidoc.git
|
||||||
|
[submodule "assets/themes/gruvbox"]
|
||||||
|
path = assets/themes/gruvbox
|
||||||
|
url = https://github.com/peaceant/gruvbox.git
|
||||||
|
[submodule "assets/syntaxes/02_Extra/GLSL"]
|
||||||
|
path = assets/syntaxes/02_Extra/GLSL
|
||||||
|
url = https://github.com/euler0/sublime-glsl
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Nginx"]
|
||||||
|
path = assets/syntaxes/02_Extra/Nginx
|
||||||
|
url = https://github.com/brandonwamboldt/sublime-nginx
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Apache"]
|
||||||
|
path = assets/syntaxes/02_Extra/Apache
|
||||||
|
url = https://github.com/colinta/ApacheConf.tmLanguage
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Ninja"]
|
||||||
|
path = assets/syntaxes/02_Extra/Ninja
|
||||||
|
url = https://github.com/pope/SublimeNinja.git
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Svelte"]
|
||||||
|
path = assets/syntaxes/02_Extra/Svelte
|
||||||
|
url = https://github.com/corneliusio/svelte-sublime
|
||||||
|
[submodule "assets/themes/Coldark"]
|
||||||
|
path = assets/themes/Coldark
|
||||||
|
url = https://github.com/ArmandPhilippot/coldark-bat.git
|
||||||
|
|||||||
-107
@@ -1,107 +0,0 @@
|
|||||||
language: rust
|
|
||||||
cache: cargo
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
# Stable channel.
|
|
||||||
- os: linux
|
|
||||||
rust: stable
|
|
||||||
env: TARGET=x86_64-unknown-linux-gnu
|
|
||||||
- os: linux
|
|
||||||
rust: stable
|
|
||||||
env:
|
|
||||||
- TARGET=x86_64-unknown-linux-musl
|
|
||||||
- CC_x86_64_unknown_linux_musl=/usr/bin/musl-gcc
|
|
||||||
- os: linux
|
|
||||||
rust: stable
|
|
||||||
env: TARGET=i686-unknown-linux-gnu
|
|
||||||
- os: osx
|
|
||||||
rust: stable
|
|
||||||
env: TARGET=x86_64-apple-darwin
|
|
||||||
- os: linux
|
|
||||||
rust: stable
|
|
||||||
env:
|
|
||||||
- TARGET=arm-unknown-linux-gnueabihf
|
|
||||||
- CC_arm_unknown_linux_gnueabihf=/usr/bin/arm-linux-gnueabihf-gcc-4.8
|
|
||||||
- CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8
|
|
||||||
- os: linux
|
|
||||||
rust: stable
|
|
||||||
env:
|
|
||||||
- TARGET=aarch64-unknown-linux-gnu
|
|
||||||
- CC_aarch64-unknown-linux-gnu=/usr/bin/aarch64-linux-gnu-gcc-4.8
|
|
||||||
- CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc-4.8
|
|
||||||
|
|
||||||
# Minimum Rust supported channel.
|
|
||||||
- os: linux
|
|
||||||
rust: 1.36.0
|
|
||||||
env: TARGET=x86_64-unknown-linux-gnu
|
|
||||||
- os: linux
|
|
||||||
rust: 1.36.0
|
|
||||||
env:
|
|
||||||
- TARGET=x86_64-unknown-linux-musl
|
|
||||||
- CC_x86_64_unknown_linux_musl=/usr/bin/musl-gcc
|
|
||||||
- os: osx
|
|
||||||
rust: 1.36.0
|
|
||||||
env: TARGET=x86_64-apple-darwin
|
|
||||||
|
|
||||||
# Disable nightly for now
|
|
||||||
# # Code formatting check
|
|
||||||
# - os: linux
|
|
||||||
# rust: nightly
|
|
||||||
# # skip the global install step
|
|
||||||
# install:
|
|
||||||
# - cargo install --debug --force rustfmt-nightly
|
|
||||||
# script: cargo fmt -- --check
|
|
||||||
|
|
||||||
sudo: required
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- ci/before_install.bash
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
# Default target on travis-ci.
|
|
||||||
# Used as conditional check in the install stage
|
|
||||||
- HOST=x86_64-unknown-linux-gnu
|
|
||||||
# Used on the deployment script
|
|
||||||
- PROJECT_NAME=bat
|
|
||||||
|
|
||||||
install:
|
|
||||||
# prevent target re-add error from rustup
|
|
||||||
- if [[ $TRAVIS_OS_NAME = linux && $HOST != $TARGET ]]; then rustup target add $TARGET; fi
|
|
||||||
|
|
||||||
script:
|
|
||||||
- ci/script.bash
|
|
||||||
|
|
||||||
before_deploy:
|
|
||||||
- bash ci/before_deploy.bash
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
provider: releases
|
|
||||||
# NOTE updating the `api_key.secure`
|
|
||||||
# - go to: https://github.com/settings/tokens/new
|
|
||||||
# - generate new token using `public_repo` scope
|
|
||||||
# - encrypt it using: `travis encrypt API_KEY_HERE`
|
|
||||||
# - paste the output below
|
|
||||||
api_key:
|
|
||||||
secure: "GZL8nYk+/MZGEqejpP0UMMGVmwUEdxiF9CflFIGccu+/tznDyHnHOpyJmbH3M5IKWIxa7xFgqOE8pHuD4oQXt4mzyJGB0KMKKEFLW7ckbTYKya5bw0heKznaqGnS0Yz+vpfqYR25eiPFYCz7mDsGsCzH5QZqt3cdn9MDQGu1D0IaxPjuBNH3T9kBblR0ifBd3Diy0JYhiVcMSI3V1rkel18F1yBHO2GQ95hkWxVgjANQnefq5+zdzbx4ki539ewYENShA8N0w6ULJVY9LmWRWJIp90ggOD3JCH6Nz/fBpYBqwfABO6Dr7Csw7IRm7pM4IVkFZS1taiDYFX9thxZh3UTmI4YYtSTPxH9NGV47kxPipbf4vAXFwW+1VcHKMpBzz+5IVsHnk1Pfx9/GZsXbqXM3PUWCStec36Xtqh5vQapDKEg9khkEs4b1X7/E73gvpRuQl9gbnyufSVWgDsXIWqM+0aDbqQz1FpLmVxz6eij0cB9vR+8kbNoe/CEPHPO9ZllvAHseukOeHPzSBd8rILORXaaGmQausXz2wWgSsffUSYz4705P8joI0zFCfmkHjL+kA1ZUx5SxLCc1ID7CFFZChhAxHoPL7xc21snswwr8QeheERdwvuzKNaerBGZEw8dmMMx98YkjftIj65DDySr2mRZuufBQeQpmMhFyIT4="
|
|
||||||
# for uploading multiple files
|
|
||||||
file_glob: true
|
|
||||||
# NOTE explanation on each env variable
|
|
||||||
# - PROJECT_NAME: name of the project, set on the `env.global` above
|
|
||||||
# - TRAVIS_TAG: tag name that the build is being deployed for, usually the version number
|
|
||||||
# - TARGET: target triple of the build
|
|
||||||
file:
|
|
||||||
- $PROJECT_NAME-$TRAVIS_TAG-$TARGET.*
|
|
||||||
- $PROJECT_NAME*.deb
|
|
||||||
# don't delete artifacts from previous stage
|
|
||||||
skip_cleanup: true
|
|
||||||
on:
|
|
||||||
# deploy only if we push a tag
|
|
||||||
tags: true
|
|
||||||
# deploy only on stable channel that has TARGET env variable sets
|
|
||||||
condition: $TRAVIS_RUST_VERSION = stable && $TARGET != ""
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email:
|
|
||||||
on_success: never
|
|
||||||
+791
@@ -0,0 +1,791 @@
|
|||||||
|
# unreleased
|
||||||
|
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
## Syntaxes
|
||||||
|
|
||||||
|
## New themes
|
||||||
|
|
||||||
|
## `bat` as a library
|
||||||
|
|
||||||
|
## Packaging
|
||||||
|
|
||||||
|
# v0.17.1
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Running `bat` without arguments fails ("output file is also an input"), see #1396
|
||||||
|
|
||||||
|
# v0.17.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Added a new `--style` value, `rule`, which adds a simple horizontal ruled line between files, see #1276 (@tommilligan)
|
||||||
|
- Pass `-S` ("chop long lines") to `less` if `--wrap=never` is set in `bat`, see #1255 (@gahag)
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Detect infinite loop when input and output are the same, see #1193 and #1197 (@niklasmohrin)
|
||||||
|
- Throw an error when `bat` is being used as `pager`, see #1343 (@adrian-rivera)
|
||||||
|
- Bash syntax highlighting not selected for `*.ebuild` and `*.eclass` files, see #1292 (@sharkdp)
|
||||||
|
- Fix `zsh` completion when using `-p`, see #1320 (@xzfc)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Add note to refer to see detailed help with `--help` (and vice versa with `-h`), see #1215 (@henil)
|
||||||
|
- Add a `Contributors` section to `README`, see #1348 (@adrian-rivera)
|
||||||
|
|
||||||
|
## Syntaxes
|
||||||
|
|
||||||
|
- Manpage syntax highlighting has been improved, see #1315 (@keith-hall)
|
||||||
|
- Add Svelte file syntax, see #1285 (@kjmph)
|
||||||
|
|
||||||
|
## New themes
|
||||||
|
|
||||||
|
- Coldark, see #1329 (@armandphilippot)
|
||||||
|
|
||||||
|
|
||||||
|
# v0.16.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Added support for the `NO_COLOR` environment variable, see #1021 and #1031 (@eth-p)
|
||||||
|
- Added `-P` short flag to disable paging, see #1075 and #1082 (@LordFlashmeow)
|
||||||
|
- Added `--force-colorization`/`-f` flag to provide an alias for forced color and decoration output, see #1141 (@alexanderkarlis)
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Fixed non-printable characters display for redirected output, see #1061 (@gsomix)
|
||||||
|
- Handle file extension conflicts in `--list-languages`, see #1076 and #1135 (@Kienyew)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Switched to "·" (U+00B7) Middle Dot from "•" (U+2022) Bullet for non-printing spaces, see #1056 and #1100 (@LordFlashmeow)
|
||||||
|
- Added zsh shell completion script, see #1136 (@Kienyew)
|
||||||
|
- Improved `--help` text (@sharkdp)
|
||||||
|
- Added custom languages/themes sections to manpage (@eth-p)
|
||||||
|
|
||||||
|
## Syntaxes
|
||||||
|
|
||||||
|
- Update AsciiDoc syntax, see #1034 (@rxt1077)
|
||||||
|
- GLSL (@caioalonso)
|
||||||
|
- Add Nginx and Apache config file syntax, see #1137 (@kjmph, @niklasmohrin)
|
||||||
|
- Use `fstab` syntax for `crypttab` files, see #1073 (@sharkdp)
|
||||||
|
- Support syntax highlighting for files in `$XDG_CONFIG_HOME/git/`, see #1191 (@ahmedelgabri)
|
||||||
|
|
||||||
|
## New themes
|
||||||
|
|
||||||
|
- Gruvbox, see #1069 (@kyleondy)
|
||||||
|
- base16-256 for [base16-shell](https://github.com/chriskempson/base16-shell) users, see #1111 (@mk12)
|
||||||
|
|
||||||
|
## `bat` as a library
|
||||||
|
|
||||||
|
- Add APIs to provide `Input` descriptions with `InputDescription` (@eth-p)
|
||||||
|
- Add function to directly provide `Input`s to `PrettyPrinter` (@eth-p)
|
||||||
|
- **Breaking:** `Input::theme_preview_file` is no longer available. (@eth-p)
|
||||||
|
|
||||||
|
## Packaging
|
||||||
|
|
||||||
|
- Removed build dependency on `liquid` (@sharkdp).
|
||||||
|
|
||||||
|
# v0.15.4
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Added missing Solarized themes, see #1027
|
||||||
|
- Fixed highlighting bug in Haskell source files, see #1026
|
||||||
|
|
||||||
|
# v0.15.3
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Cannot run `bat` with relative paths, see #1022
|
||||||
|
- bat mishighlights Users that start with digits in SSH config, see #984
|
||||||
|
|
||||||
|
## New syntaxes
|
||||||
|
|
||||||
|
- SML, see #1005 (@kopecs)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Some syntaxes and themes have been updated to the latest version
|
||||||
|
|
||||||
|
# v0.15.2
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Fix syntax detection for files called 'rails', see #1008
|
||||||
|
- Fix potential errors with syntax detection for symlinked files, see #1001
|
||||||
|
- `--map-syntax` doesn't work with names provided through `--file-name` (@eth-p)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Add padding above headers when not using a grid, see #968 and #981 (@pt2121)
|
||||||
|
- bat now prints an error if an invalid syntax is specified via `-l` or `--map-syntax`, see #1004 (@eth-p)
|
||||||
|
|
||||||
|
## `bat` as a library
|
||||||
|
|
||||||
|
- `PrettyPrinter::vcs_modification_markers` has been marked deprecated when building without the `git` feature, see #997 and #1020 (@eth-p, @sharkdp)
|
||||||
|
|
||||||
|
## Packaging
|
||||||
|
|
||||||
|
- Compilation problems with `onig_sys` on various platforms have been resolved by upgrading to `syntect 4.2`, which includes a new `onig` version that allows to build `onig_sys` without the `bindgen` dependency. This removes the need for `libclang(-dev)` to be installed to compile `bat`. Package maintainers might want to remove `clang` as a build dependency. See #650 for more details.
|
||||||
|
|
||||||
|
# v0.15.1
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Fix highlighting of Markdown files, see #963 and #977
|
||||||
|
- Fix `base16` theme (was broken since in v0.14), see #972, #934 and #979 (@mk12).
|
||||||
|
Users suffering from #865 ("no color for bat in ssh from a Windows client") can use the `ansi-dark` and `ansi-light` themes from now on.
|
||||||
|
|
||||||
|
## New syntaxes
|
||||||
|
|
||||||
|
- Fortran, see #957
|
||||||
|
- Email (@mariozaizar)
|
||||||
|
- QML, see #962 (@pylipp)
|
||||||
|
|
||||||
|
# v0.15.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Add a new `--diff`/`-d` option that can be used to only show lines surrounding
|
||||||
|
Git changes, i.e. added, removed or modified lines. The amount of additional
|
||||||
|
context can be controlled with `--diff-context=N`. See #23 and #940
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Error message printed in the middle of the output for another file, see #946
|
||||||
|
- Performance improvements when using custom caches (via `bat cache --build`): the `bat` startup time should now be twice as fast (@lzutao).
|
||||||
|
|
||||||
|
## Themes
|
||||||
|
|
||||||
|
- Updated version of the Solarized dark/light themes, see #941
|
||||||
|
|
||||||
|
## `bat` as a library
|
||||||
|
|
||||||
|
- There are a few changes in the "low level" API (the `Config` struct has changed and
|
||||||
|
the error handler needs a new `&mut dyn Write` argument). The high-level API is not
|
||||||
|
affected.
|
||||||
|
|
||||||
|
# v0.14.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Added a new `--file-name <name>…` option to overwrite the displayed filename(s)
|
||||||
|
in the header. This is useful when piping input into `bat`. See #654 and #892 (@neuronull).
|
||||||
|
- Added a new `--generate-config-file` option to create an initial configuration file
|
||||||
|
at the right place. See #870 (@jmick414)
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Performance problems with C# source code have been fixed, see #677 (@keith-hall)
|
||||||
|
- Performance problems with Makefiles have been fixed, see #750 (@keith-hall)
|
||||||
|
- Fix bug when highlighting Ruby files with unindented heredocs, see #914 (@keith-hall)
|
||||||
|
- A highlighting problem with Rust source code has been fixed, see #924 (@keith-hall)
|
||||||
|
- Windows: short files that do not require paging are displayed and then lost, see #887
|
||||||
|
- `--highlight-line` did not work correctly in combination with `--tabs=0` and `--wrap=never`,
|
||||||
|
see #937
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- When saving/reading user-provided syntaxes or themes, `bat` will now maintain a
|
||||||
|
`metadata.yaml` file which includes information about the `bat` version which was
|
||||||
|
used to create the cached files. When loading cached files, we now print an error
|
||||||
|
if they have been created with an incompatible version. See #882
|
||||||
|
- Updated `liquid` dependency to 0.20, see #880 (@ignatenkobrain)
|
||||||
|
|
||||||
|
## `bat` as a library
|
||||||
|
|
||||||
|
- A completely new "high level" API has been added that is much more convenient
|
||||||
|
to use. See the `examples` folder for the updated code. The older "low level"
|
||||||
|
API is still available (basically everything that is not in the root `bat`
|
||||||
|
module), but has been refactored quite a bit. It is recommended to only use
|
||||||
|
the new "high level" API, if possible. This will be much easier to keep stable.
|
||||||
|
Note that this should still be considered a "beta" release of `bat`-as-a-library.
|
||||||
|
For more details and some screenshots of the example programs, see #936.
|
||||||
|
- Stripped out a lot of binary-only dependencies, see #895 and #899 (@dtolnay)
|
||||||
|
|
||||||
|
This introduces a `features = ["application"]` which is enabled by default and pulls in
|
||||||
|
everything required by `bat` the application. When depending on bat as a library, downstream
|
||||||
|
`Cargo.toml` should disable this feature to cut out inapplicable heavy dependencies:
|
||||||
|
``` toml
|
||||||
|
[dependencies]
|
||||||
|
bat = { version = "0.14", default-features = false }
|
||||||
|
```
|
||||||
|
Other optional functionality has also been put behind features: `paging` and `git` support.
|
||||||
|
- Allow using the library with older syntect, see #896 and #898 (@dtolnay)
|
||||||
|
|
||||||
|
## New syntaxes
|
||||||
|
|
||||||
|
- Rego, see #872 (@patrick-east)
|
||||||
|
- Stylo, see #917
|
||||||
|
|
||||||
|
|
||||||
|
# v0.13.0
|
||||||
|
|
||||||
|
## `bat` as a library
|
||||||
|
|
||||||
|
Beginning with this release, `bat` can be used as a library (#423).
|
||||||
|
|
||||||
|
This was a huge effort and I want to thank all people who made this possible: @DrSensor, @mitsuhiko, @mre, @eth-p!
|
||||||
|
|
||||||
|
- Initial attempt in #469 (@mitsuhiko)
|
||||||
|
- Second attempt, complete restructuring of the `bat` crate, see #679 (@DrSensor)
|
||||||
|
- Updates to example, public API, error handling, further refactoring: #693 #873 #875 (@sharkdp)
|
||||||
|
|
||||||
|
I want to stress that this is the very first release of the library. Things are very likely to change. A lot of things are still missing (including the documentation).
|
||||||
|
|
||||||
|
That being said, you can start using it! See the example programs in [`examples/`](https://github.com/sharkdp/bat/tree/master/examples).
|
||||||
|
|
||||||
|
You can see the API documentation here: https://docs.rs/bat/
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- (**Breaking change**) Glob-based syntax mapping, see #877 and #592. With this change,
|
||||||
|
users need to update their bat config files (`bat --config-file`), if they have any `--map-syntax` settings
|
||||||
|
present.
|
||||||
|
|
||||||
|
The option now works like this:
|
||||||
|
```bash
|
||||||
|
--map-syntax <glob-pattern>:<syntax-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, see the `--help` text, the man page or the README.
|
||||||
|
|
||||||
|
This new feature allows us to properly highlight files like:
|
||||||
|
* `/etc/profile`
|
||||||
|
* `~/.ssh/config`
|
||||||
|
|
||||||
|
- `--highlight-line` now accepts line ranges, see #809 (@lkalir)
|
||||||
|
- Proper wrapping support for output with wide Unicode characters, see #811 #787 and #815 (@Kogia-sima)
|
||||||
|
- A lot of updates to existing syntaxes via #644 (@benwaffle, @keith-hall)
|
||||||
|
- `BAT_CACHE_PATH` can be used to place cached `bat` assets in a non-standard path, see #829 (@neuronull)
|
||||||
|
- Support combination of multiple styles at the same time, see #857 (@aslpavel)
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Do not pass '--no-init' on newer less versions, see #749 and #786 (@sharkdp)
|
||||||
|
- 'bat cache' still takes precedence over existing files, see #666 (@sharkdp)
|
||||||
|
- `.sc` files should be treated as scala files, see #443 (@benwaffle)
|
||||||
|
- Allow underscores and dashes in page names, see #670 (@LunarLambda)
|
||||||
|
- Keep empty lines empty, see #601 (@mbarbar)
|
||||||
|
- Wrapping does not work when piping, see #758 (@fusillicode, @allevo, @gildo)
|
||||||
|
- Allow for non-unicode filenames, see #225 (@sharkdp)
|
||||||
|
- Empty file without header produces incomplete grid, see #798 (@eth-p)
|
||||||
|
- Files named `build` don't respect shebang lines, see #685 (@sharkdp)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Parametrizable names for man page and shell completion files, see #659 #673 #656 (@eth-p)
|
||||||
|
- Enabled LTO, making `bat` about 10% faster, see #719 (@bolinfest, @sharkdp)
|
||||||
|
- Suggestions non how to configure `bat` for MacOS dark mode, see README (@jerguslejko)
|
||||||
|
- Extended ["Integration with other tools"](https://github.com/sharkdp/bat#integration-with-other-tools) section (@eth-p)
|
||||||
|
- Updated [instrutions on how to use `bat` as a `man`-pager](https://github.com/sharkdp/bat#man), see #652, see #667 (@sharkdp)
|
||||||
|
- Add section concerning file encodings, see #688 and #568 (@sharkdp)
|
||||||
|
- Updated sort order of command-line options in `--help` text and manpage, see #653 and #700 (@hrlmartins)
|
||||||
|
- Updates to the man page syntax, see #718 (@sharkdp)
|
||||||
|
- Japanese documentation updates, see #863 (@k-ta-yamada, @sorairolake and @wt-l00)
|
||||||
|
- Accept "default" as a theme, see #757 (@fvictorio)
|
||||||
|
- Updated Windows installation instructions, see #852 (@sorenbug)
|
||||||
|
- Updated man page, see #573 (@sharkdp)
|
||||||
|
|
||||||
|
## New syntaxes
|
||||||
|
|
||||||
|
- Jinja2, see #648 (@Martin819)
|
||||||
|
- SaltStack SLS, see #658 (@Martin819)
|
||||||
|
- `/etc/fstab`, see #696 (@flopp and @eth-p)
|
||||||
|
- `/etc/group` and `/etc/passwd`, see #698 (@argentite)
|
||||||
|
- `/proc/cpuinfo` and `/proc/meminfo`, see #593 (@sharkdp)
|
||||||
|
- Nim, see #542 (@sharkdp)
|
||||||
|
- Vue, see #826 (@chaaaaarlotte)
|
||||||
|
- CoffeScript, see #833 (@sharkdp)
|
||||||
|
|
||||||
|
## New themes
|
||||||
|
|
||||||
|
- Dracula, see #687 (@clarfon)
|
||||||
|
- Nord, see #760 (@crabique)
|
||||||
|
- Solarized light and dark, see #768 (@hakamadare)
|
||||||
|
|
||||||
|
## Packaging
|
||||||
|
|
||||||
|
- `bat` is now in the official Ubuntu and Debian repositories, see #323 and #705 (@MarcoFalke)
|
||||||
|
- `bat` can now be installed via MacPorts, see #675 (@bn3t)
|
||||||
|
- Install fish completions into 'vendor_completions.d', see #651 (@sharkdp)
|
||||||
|
|
||||||
|
## Thanks
|
||||||
|
|
||||||
|
- To @eth-p for joining me as a maintainer! I'm very grateful for all the work you put into
|
||||||
|
managing and responding to issues, improving our deployment, adding PR/issue templates (#837) as
|
||||||
|
well as fixing bugs and implementing new features.
|
||||||
|
|
||||||
|
# v0.12.1
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Fixes a bug for older Windows versions (*"The procedure entry point `CreateFile2` could not be located"*), see #643 (@rivy)
|
||||||
|
|
||||||
|
# v0.12.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Binary file content can now be viewed with `bat -A`, see #623, #640 (@pjsier and @sharkdp)
|
||||||
|
- `bat` can now be used as a man pager. Take a look at the README and #523 for more details.
|
||||||
|
- Add new style component to separate multiple `--line-range`s, see #570 (@eth-p)
|
||||||
|
- Added `-L` as an alias for `--list-languages`
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Output looks unbalanced when using '--style=grid,numbers' without 'header', see #571 (@eth-p)
|
||||||
|
- issues with filenames starting with "cache", see #584
|
||||||
|
- Can't build cache with new theme without creating cache dir, see #576 (@frm)
|
||||||
|
- `--terminal-width -10` is parsed incorrectly, see #611
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Added fish completions to DEB package, see #554
|
||||||
|
|
||||||
|
## New syntaxes
|
||||||
|
|
||||||
|
- Emacs Org mode, see #36 (@bricewge)
|
||||||
|
- `requirements.txt`
|
||||||
|
- DotENV `.env`
|
||||||
|
- SSH config syntax (`-l ssh_config`), see #582 (@issmirnov)
|
||||||
|
- `/etc/hosts`, see #583 (@issmirnov)
|
||||||
|
- GraphQL, see #625 (@dandavison)
|
||||||
|
- Verilog, see #616
|
||||||
|
- SCSS and Sass, see #637
|
||||||
|
- `strace` syntax, see #599
|
||||||
|
|
||||||
|
## Packaging
|
||||||
|
|
||||||
|
- `bat` is now in the official Gentoo repositories, see #588 (@toku-sa-n)
|
||||||
|
- `bat` is now in the official Alpine Linux repositories, see #586 (@5paceToast)
|
||||||
|
- `bat` is in the official Fedora repositories, see #610 (@ignatenkobrain)
|
||||||
|
|
||||||
|
# v0.11.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Three new special color themes are available: `ansi-light`, `ansi-dark` and `base16`. These
|
||||||
|
are useful for people that often switch from dark to light themes in their terminal emulator
|
||||||
|
or for people that want the colors to match their terminal theme colors. For more details,
|
||||||
|
see #543 and #490 (@mk12, implementation idea by @trishume)
|
||||||
|
- Hand-written auto completion script for Fish shell, see #524 and #555 (@ev-dev and @eth-p)
|
||||||
|
- The `-p`/`--plain` option can now be used twice (typically `-pp`). The first `-p` switches the
|
||||||
|
`--style` to "plain". The second `-p` disables the pager. See #560 and #552 (@eth-p)
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Do not replace arguments to `less` when using `--pager`, see #509
|
||||||
|
- Binary files will now be indicated by a warning in interactive mode, see #530 #466 #550 (@maxfilov)
|
||||||
|
- Empty files are (once again) printed with a single header line, see #504 and #566 (@reidwagner
|
||||||
|
and @sharkdp)
|
||||||
|
- `--terminal-width=0` is now disallowed, see #559 (@eth-p)
|
||||||
|
- Accidental printing of files named `cache`, see #557
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- New integration tests, see #500 and #502 (@reidwagner and @sharkdp)
|
||||||
|
- New ["Integration with other tools"](https://github.com/sharkdp/bat#integration-with-other-tools) section in the README.
|
||||||
|
- Migrated to Rust 2018 (@expobrain)
|
||||||
|
|
||||||
|
## New syntaxes
|
||||||
|
|
||||||
|
- F# syntax has been updated, see #531 (@stroborobo)
|
||||||
|
- Fish shell, see #548 (@sanga)
|
||||||
|
|
||||||
|
## Packaging
|
||||||
|
|
||||||
|
- `bat` is now available on Chocolatey, see #541 (@rasmuskriest)
|
||||||
|
|
||||||
|
# v0.10.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Added new `--highlight-line <N>` option, see #453, #346 and #175 (@tskinn and @sharkdp)
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- **Change the default configuration directory on macOS** to `~/.config/bat`, see #442 (@lavifb). If you are on macOS, you need to copy your configuration directory from the previous place (`~/Library/Preferences/bat`) to the new place (`~/.config/bat`).
|
||||||
|
- Completely disabled the generation of shell completion files, see #372
|
||||||
|
- Properly set arguments to `less` if `PAGER` environment variable contains something like `less -F` (which is missing the `-R` option), see #430 (@majecty)
|
||||||
|
- Report the name of missing files, see #444 (@ufuji1984)
|
||||||
|
- Don't start pager if file doesn't exist, see #387
|
||||||
|
- Rename `bat cache --init` to `bat cache --build`, see #498
|
||||||
|
- Move the `--config-dir` and `--cache-dir` options from `bat cache` to `bat` and hide them from the help text.
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Blank line at the end of output when using `--style=plain`, see #379
|
||||||
|
- EOF must be sent twice on stdin if no other input is sent, see #477 (@reidwagner)
|
||||||
|
|
||||||
|
## New syntaxes
|
||||||
|
|
||||||
|
- Twig (@ahmedelgabri)
|
||||||
|
- `.desktop` files (@jleclanche)
|
||||||
|
- AsciiDoc (@markusthoemmes)
|
||||||
|
- Assembly (x86_64 and ARM)
|
||||||
|
- Log files (@caos21)
|
||||||
|
- Protobuf and ProtobufText (@caos21)
|
||||||
|
- Terraform (@caos21)
|
||||||
|
- Jsonnet (@hfm)
|
||||||
|
- Varlink (@haraldh)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Added Japanese version of README (@sh-tech and @object1037)
|
||||||
|
- Code improvements (@barskern)
|
||||||
|
|
||||||
|
# v0.9.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- A new `-A`/`--show-all` option has been added to show and highlight non-printable characters (in analogy to GNU `cat`s option):
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
see #395 and #381 for more details.
|
||||||
|
|
||||||
|
- Added `--pager` option (to configure the pager from the configuration file), see #362 (@majecty)
|
||||||
|
|
||||||
|
- Added `BAT_CONFIG_PATH` environment variable to set a non-default path for `bat`s configuration file, see #375 (@deg4uss3r)
|
||||||
|
|
||||||
|
- Allow for multiple occurences of `--style` to allow for the configuration
|
||||||
|
of styles from the config file, see #367 (@sindreij)
|
||||||
|
|
||||||
|
- Allow for multiple `--line-range` arguments, see #23
|
||||||
|
|
||||||
|
- The `--terminal-width` option can now also accept offsets, see #376
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- Use of italics is now *disabled by default* (see #389 for details). They can be
|
||||||
|
re-enabled by adding `--italic-text=always` to your configuration file.
|
||||||
|
|
||||||
|
- The default tab-width has been set to 4.
|
||||||
|
|
||||||
|
- Added new "Sublime Snazzy" theme.
|
||||||
|
|
||||||
|
- Shell completions are currently *not* shipped anymore, see #372 for details.
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Avoid endless recursion when `PAGER="bat"`, see #383 (@rodorgas)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- `bat` is now available on openSUSE, see #405 (@dmarcoux)
|
||||||
|
|
||||||
|
- Added section about the new configuration file in the README (@deg4uss3r)
|
||||||
|
|
||||||
|
- Chinese translation of README (@chinanf-boy)
|
||||||
|
|
||||||
|
- Re-written tests for `--tabs` (@choznerol)
|
||||||
|
|
||||||
|
- Speed up integration tests, see #394
|
||||||
|
|
||||||
|
# v0.8.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Support for a configuration file with the following simple format:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--tabs=4
|
||||||
|
--theme="Sublime Snazzy"
|
||||||
|
|
||||||
|
# A line-comment
|
||||||
|
--map-syntax .ignore:.gitignore
|
||||||
|
--map-syntax PKGBUILD:bash
|
||||||
|
--map-syntax Podfile:ruby
|
||||||
|
|
||||||
|
# Flags and options can also be on a single line:
|
||||||
|
--wrap=never --paging=never
|
||||||
|
```
|
||||||
|
|
||||||
|
The configuration file path can be accessed via `bat --config-file`. On Linux,
|
||||||
|
it is stored in `~/.config/bat/config`.
|
||||||
|
|
||||||
|
- Support for the `BAT_OPTS` environment variable with the same format as specified
|
||||||
|
above (in a single line). This takes precedence over the configuration file.
|
||||||
|
|
||||||
|
See also #310.
|
||||||
|
|
||||||
|
- Support for custom syntax mappings via the `-m`/`--max-syntax` option.
|
||||||
|
|
||||||
|
This allows users to (re)map certain file extensions or file names to an existing syntax:
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
bat --map-syntax .config:json ...
|
||||||
|
```
|
||||||
|
|
||||||
|
The option can be use multiple times. Note that you can easily make these mappings permanent by using bats new configuration file.
|
||||||
|
|
||||||
|
See #169
|
||||||
|
|
||||||
|
- Support pager command-line arguments in `PAGER` and `BAT_PAGER`, see #352 (@Foxboron)
|
||||||
|
|
||||||
|
- Add support for wildcards in Windows CMD, see #309 (@zxey)
|
||||||
|
|
||||||
|
- First-line syntax detection for all input types, see #205
|
||||||
|
|
||||||
|
- Encoding support for UTF-16LE and UTF-16BE, see #285
|
||||||
|
|
||||||
|
- New syntaxes: Robot framework (@sanga)
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- Binary files are now detected and not displayed when the output goes to an interactive terminal, see #205
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- JavaDoc comments break syntax highlighting in .java files, see #81
|
||||||
|
|
||||||
|
- Bat Panics on Haskell Source Code, see #314
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Better `-h` and `--help` texts.
|
||||||
|
|
||||||
|
- Updated documentation on how to configure `bat`s pager
|
||||||
|
|
||||||
|
- Updated documentation for light backgrounds, see #328 (@russtaylor)
|
||||||
|
|
||||||
|
- Generate shell completions during build, see #115 (@davideGiovannini)
|
||||||
|
|
||||||
|
- A lot of new tests have been written
|
||||||
|
|
||||||
|
- `bat` is now available via [Termux](https://termux.com/), see #341 (@fornwall)
|
||||||
|
|
||||||
|
- `bat` is now available via [nix](https://nixos.org/nix), see #344 (@mgttlinger)
|
||||||
|
|
||||||
|
- `bat` is now available via [Docker](https://hub.docker.com/r/danlynn/bat/), see #331 (@danlynn)
|
||||||
|
|
||||||
|
# v0.7.1
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Use the `ansi_colours` package by @mina86 for better true-color approximation on 8 bit color terminals, see #319 and #202.
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Bat Panics on Haskell Source Code, see #314
|
||||||
|
- Disable wrapping when `--style=plain`/`-p` is used, see #289
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Added Ansible install instructions (@aeimer)
|
||||||
|
- Added section about Cygwin to the README (@eth-p)
|
||||||
|
|
||||||
|
# v0.7.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Tabs are now (optionally) expanded to spaces. This can be controlled with the new
|
||||||
|
`--tabs` command-line option or the `BAT_TABS` environment variable. The
|
||||||
|
new feature also closes two bugs #166 and #184. For more information, see #302 (@eth-p).
|
||||||
|
|
||||||
|
- Added support for the `BAT_STYLE` environment variable, see #208 (@ms2300)
|
||||||
|
|
||||||
|
- Added `OneHalf` theme for terminals with a light-gray background, see #256
|
||||||
|
|
||||||
|
- Added new syntaxes for CSV, JSX in JavaScript and TypeScript, Cabal, Dart,
|
||||||
|
F#, PureScript, Swift, Crystal, PowerShell (Many Thanks to @tobenna and @mimadrid)
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- Query `git diff` only when needed, see #303 (@ShikChen)
|
||||||
|
|
||||||
|
- Disable wrapping when `--plain` is used, see #289 (@eth-p)
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Can read files named `cache`, see #275 (@BK1603)
|
||||||
|
|
||||||
|
- A lot of bugfixes for Windows, see #252, #264
|
||||||
|
|
||||||
|
- Detect `less` reliably and in a portable way, see #271 and #290 (@Aankhen)
|
||||||
|
|
||||||
|
- last decoration line is not formatted properly with `--wrap never`, see #299 (@Rogach)
|
||||||
|
|
||||||
|
- Do not show file header for directories, see #292
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Enabled a new `aarch64` build target, see #258 (@rachitchokshi)
|
||||||
|
|
||||||
|
- Provide Debian packages for `armhf`, see #280 (@rachitchokshi)
|
||||||
|
|
||||||
|
- Added README section about "`bat` on Windows" (@Aankhen)
|
||||||
|
|
||||||
|
- Windows installation via scoop (@meltinglava)
|
||||||
|
|
||||||
|
# v0.6.1
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Fixed panic when running `bat --list-languages | head`, see #232 (@mchlrhw)
|
||||||
|
- Respect `--color` settings for `--list-themes` and `--list-languages`, see #233
|
||||||
|
- Git modifications now work on Windows
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- There will be auto-generated Windows releases, starting with this version (@anykao)
|
||||||
|
|
||||||
|
# v0.6.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- The `--list-themes` option now shows a preview for each highlighting theme (@ms2300)
|
||||||
|
- Added `-p`/`--plain` as an alias for `--style=plain`, see #212 (@ms2300)
|
||||||
|
- Major refactorings, enabling some progress on #150. In non-interactive mode, `bat` will now copy input bytes 1:1.
|
||||||
|
- New languages: Elm, Kotlin, Puppet, TypeScript, see #215 #216 #217 #218
|
||||||
|
- New syntax highlighting theme: zenburn (@colindean)
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- New themes in `$BAT_CONFIG_DIR/themes` are now loaded *in addition* to
|
||||||
|
the default themes (they may also override), see #172
|
||||||
|
- The `Default.tmTheme` symlink is not necessary anymore.
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
* Using `bat cache --init` leads to duplicated syntaxes, see #206
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
* Extended and cleaned-up `--help` text.
|
||||||
|
* Added initial version of a man page, see #52
|
||||||
|
* New README sections: *Development* and *Troubleshooting*, see #220
|
||||||
|
|
||||||
|
# v0.5.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Added `--line-range n:m` option to print a range of lines, see #159 (@tskinn)
|
||||||
|
- The syntax highlighting theme can now be controlled by the `BAT_THEME` environment variable, see [README](https://github.com/sharkdp/bat#highlighting-theme) and #177 (@mandx)
|
||||||
|
- The `PAGER` and `BAT_PAGER` environment variables can be used to control the pager that `bat` uses, see #158 and the [new README section](https://github.com/sharkdp/bat#using-a-different-pager)
|
||||||
|
- Added syntax highlighting for Nix, see #180
|
||||||
|
- Added syntax highlighting for AWK (Gert Hulselmans)
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- The customization of syntax sets and theme sets is now separated. Syntax definitions are now loaded *in addition* to the ones that are stored in the `bat` binary by default. Please refer to these new sections in the README: [Adding new syntaxes](https://github.com/sharkdp/bat#adding-new-syntaxes--language-definitions), [Adding new themes](https://github.com/sharkdp/bat#adding-new-themes), also see #172
|
||||||
|
- The color for the filename is now the default foreground color. The colors for the grid and the line numbers is now determined from the syntax highlighting theme, which now also works for light backgrounds, see #178.
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Escape Sequences get partially stripped, see #182 (@eth-p)
|
||||||
|
- Use separate Git repository for snapshot testing, see #165 and #161
|
||||||
|
- Markdown breaking on JavaScript, see #183
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Binaries for armv7 are now provided, see #196
|
||||||
|
- `bat` is now in the official [Arch package repositories](https://www.archlinux.org/packages/community/x86_64/bat/).
|
||||||
|
- Optimizations in the RGB => 8-bit conversion (@mina86)
|
||||||
|
|
||||||
|
# v0.4.1
|
||||||
|
|
||||||
|
(this is just a small bugfix release, see 0.4.0 for all features and changes)
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Fix problem with `cargo test` when `bat` is not checked out in a Git repository, see #161
|
||||||
|
|
||||||
|
# v0.4.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* Support for line-wrapping, see #54 and #102 (@eth-p)
|
||||||
|
* New and updated `--style` parameter, see #74 and README (@pitkley)
|
||||||
|
* Added `--theme` and `--list-themes` options, see #89 (@rleungx)
|
||||||
|
* Added syntax highlighting for: Julia (@iamed2), Dockerfiles, VimL, CMake, INI, Less
|
||||||
|
* Added a few popular Sublime Text highlighting themes, see #133
|
||||||
|
* Support for bold, italic and underline font styles, see #96
|
||||||
|
* Support for 32bit systems is now available, see #84
|
||||||
|
* Added `-u` and `-n` options, see #134
|
||||||
|
* ANSI color support on Windows 10
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
* The customization folder for own syntaxes has been renamed from `syntax` to `syntaxes`, see README.
|
||||||
|
* Changed Markdown syntax to the default Sublime Text syntax, see #157
|
||||||
|
* Sorted language listing (@rleungx)
|
||||||
|
* Command line arguments like `--theme` or `--color` can now override themselves.
|
||||||
|
* Improved `--help` text.
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Fixed crash for (really) small terminal sizes, see #117 (@eth-p)
|
||||||
|
- Syntax detection for `.bashrc`, `CMakeLists.txt` etc., see #100
|
||||||
|
- Properly handle lines with invalid UTF-8, see #7 (@BrainMaestro)
|
||||||
|
- Better error handling, see #17 (@rleungx and @sharkdp)
|
||||||
|
- Proper handling of UTF-8 characters in `less`, see #98 (@ghuls)
|
||||||
|
- Build fix on nightly, see #148 (@tathanhdinh)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- [Comparison with alternative projects](https://github.com/sharkdp/bat/blob/master/doc/alternatives.md).
|
||||||
|
- New "bat" logo in the README, see #119 (@jraulhernandezi)
|
||||||
|
- Output test cases (@BrainMaestro)
|
||||||
|
- Lots of great refactoring work (@BrainMaestro)
|
||||||
|
|
||||||
|
# v0.3.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* Automatic paging by integrating with `less`, see #29 (@BrainMaestro)
|
||||||
|
* Added support for reading from standard input, see #2
|
||||||
|
* Added support for writing to non-interactive terminals (pipes, files, ..); new
|
||||||
|
`--color=auto/always/never` option, see #26 (@BrainMaestro)
|
||||||
|
* Added `--list-languages` option to print all available syntaxes, see #69 (@connorkuehl)
|
||||||
|
* New option to specify the syntax via `-l`/`--language`, see #19 (@BrainMaestro)
|
||||||
|
* New option to control the output style (`--style`), see #5 (@nakulcg)
|
||||||
|
* Added syntax highlighting support for TOML files, see #37
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
* The `init-cache` sub-command has been removed. The cache can now be controlled via
|
||||||
|
`bat cache`. See `bat cache -h` for all available commands.
|
||||||
|
|
||||||
|
## Bug fixes
|
||||||
|
|
||||||
|
* Get git repository from file path instead of current directory, see #22 (@nakulcg)
|
||||||
|
* Process substitution can now be used with bat (`bat <(echo a) <(echo b)`), see #80
|
||||||
|
|
||||||
|
## Thanks
|
||||||
|
|
||||||
|
I'd like to say a big THANK YOU to all contributors and everyone that has given us
|
||||||
|
some form of feedback.
|
||||||
|
|
||||||
|
Special thanks go to @BrainMaestro for his huge support with new features, bug reports
|
||||||
|
and code reviews!
|
||||||
|
|
||||||
|
# v0.2.3
|
||||||
|
|
||||||
|
- Added a new statically linked version of bat (`..-musl-..`)
|
||||||
|
|
||||||
|
# v0.2.2
|
||||||
|
|
||||||
|
- Remove openssl dependency completely, see #30.
|
||||||
|
|
||||||
|
# v0.2.1
|
||||||
|
|
||||||
|
- Added Elixir syntax, see #25.
|
||||||
|
- Use libcurl-openssl instead of libcurl-gnutls, see #30.
|
||||||
|
|
||||||
|
# v0.2.0
|
||||||
|
|
||||||
|
- Support for custom syntaxes, add 'Markdown extended' theme
|
||||||
|
- Bugfix: Git modifications not shown from child folder
|
||||||
|
|
||||||
|
# v0.1.0
|
||||||
|
|
||||||
|
Initial release
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
Thank you for considering to contribute to `bat`!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Add an entry to the changelog
|
||||||
|
|
||||||
|
If your contribution changes the behavior of `bat` (as opposed to a typo-fix
|
||||||
|
in the documentation), please update the [`CHANGELOG.md`](CHANGELOG.md) file
|
||||||
|
and describe your changes. This makes the release proess much easier and
|
||||||
|
therefore helps to get your changes into a new `bat` release faster.
|
||||||
|
|
||||||
|
The top of the `CHANGELOG` contains a *"unreleased"* section with a few
|
||||||
|
subsections (Features, Bugfixes, …). Please add your entry to the subsection
|
||||||
|
that best describes your change
|
||||||
|
|
||||||
|
Entries follow this format:
|
||||||
|
```
|
||||||
|
- Short description of what has been changed, see #123 (@user)
|
||||||
|
```
|
||||||
|
Here, `#123` is the number of the original issue and/or your pull request.
|
||||||
|
Please replace `@user` by your GitHub username.
|
||||||
|
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
Please check out the [Development](https://github.com/sharkdp/bat#development)
|
||||||
|
section in the README.
|
||||||
|
|
||||||
|
|
||||||
|
## Adding a new feature
|
||||||
|
|
||||||
|
Please consider opening a
|
||||||
|
[feature request ticket](https://github.com/sharkdp/bat/issues/new?assignees=&labels=feature-request&template=feature_request.md)
|
||||||
|
first in order to give us a chance to discuss the feature first.
|
||||||
|
|
||||||
|
|
||||||
|
## Adding new syntaxes/languages or themes
|
||||||
|
|
||||||
|
Before you make a pull request that adds a new syntax or theme, please read
|
||||||
|
the [Customization](https://github.com/sharkdp/bat#customization) section
|
||||||
|
in the README first.
|
||||||
|
|
||||||
|
If you really think that a particular syntax or theme should be added for all
|
||||||
|
users, please read the corresponding
|
||||||
|
[documentation](https://github.com/sharkdp/bat/blob/master/doc/assets.md)
|
||||||
|
first.
|
||||||
Generated
+519
-847
File diff suppressed because it is too large
Load Diff
+38
-15
@@ -7,7 +7,7 @@ license = "MIT/Apache-2.0"
|
|||||||
name = "bat"
|
name = "bat"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/sharkdp/bat"
|
repository = "https://github.com/sharkdp/bat"
|
||||||
version = "0.13.0"
|
version = "0.17.1"
|
||||||
exclude = [
|
exclude = [
|
||||||
"assets/syntaxes/*",
|
"assets/syntaxes/*",
|
||||||
"assets/themes/*",
|
"assets/themes/*",
|
||||||
@@ -15,48 +15,71 @@ exclude = [
|
|||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
edition = '2018'
|
edition = '2018'
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["application"]
|
||||||
|
# Feature required for bat the application. Should be disabled when depending on
|
||||||
|
# bat as a library.
|
||||||
|
application = [
|
||||||
|
"atty",
|
||||||
|
"clap",
|
||||||
|
"dirs",
|
||||||
|
"git",
|
||||||
|
"lazy_static",
|
||||||
|
"paging",
|
||||||
|
"wild",
|
||||||
|
"regex-onig",
|
||||||
|
]
|
||||||
|
git = ["git2"] # Support indicating git modifications
|
||||||
|
paging = ["shell-words"] # Support applying a pager on the output
|
||||||
|
regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
|
||||||
|
regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
atty = "0.2.14"
|
atty = { version = "0.2.14", optional = true }
|
||||||
ansi_term = "^0.12.1"
|
ansi_term = "^0.12.1"
|
||||||
ansi_colours = "^1.0"
|
ansi_colours = "^1.0"
|
||||||
console = "0.10"
|
console = "0.13.0"
|
||||||
dirs = "2.0"
|
dirs = { version = "3.0", optional = true }
|
||||||
lazy_static = "1.4"
|
lazy_static = { version = "1.4", optional = true }
|
||||||
wild = "2.0"
|
wild = { version = "2.0", optional = true }
|
||||||
content_inspector = "0.2.4"
|
content_inspector = "0.2.4"
|
||||||
encoding = "0.2"
|
encoding = "0.2"
|
||||||
shell-words = "0.1.0"
|
shell-words = { version = "1.0.0", optional = true }
|
||||||
unicode-width = "0.1.7"
|
unicode-width = "0.1.8"
|
||||||
globset = "0.4"
|
globset = "0.4"
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
serde_yaml = "0.8"
|
||||||
|
semver = "0.11"
|
||||||
|
path_abs = { version = "0.5", default-features = false }
|
||||||
|
|
||||||
[dependencies.git2]
|
[dependencies.git2]
|
||||||
version = "0.13"
|
version = "0.13"
|
||||||
|
optional = true
|
||||||
default-features = false
|
default-features = false
|
||||||
features = []
|
|
||||||
|
|
||||||
[dependencies.syntect]
|
[dependencies.syntect]
|
||||||
version = "3.3.0"
|
version = "4.4.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["parsing", "yaml-load", "dump-load", "dump-create"]
|
features = ["parsing", "yaml-load", "dump-load", "dump-create"]
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
version = "2.33"
|
version = "2.33"
|
||||||
|
optional = true
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["suggestions", "color", "wrap_help"]
|
features = ["suggestions", "color", "wrap_help"]
|
||||||
|
|
||||||
[dependencies.error-chain]
|
[dependencies.error-chain]
|
||||||
version = "0.12"
|
version = "0.12"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = []
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempdir = "0.3"
|
tempdir = "0.3"
|
||||||
assert_cmd = "0.12.0"
|
assert_cmd = "1.0.1"
|
||||||
|
predicates = "1.0.5"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
clap = "2.33"
|
clap = { version = "2.33", optional = true }
|
||||||
liquid = "0.19"
|
|
||||||
lazy_static = "1.4"
|
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
|
codegen-units = 1
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="doc/logo-header.svg" alt="bat - a cat clone with wings"><br>
|
<img src="doc/logo-header.svg" alt="bat - a cat clone with wings"><br>
|
||||||
<a href="https://travis-ci.org/sharkdp/bat"><img src="https://travis-ci.org/sharkdp/bat.svg?branch=master" alt="Build Status"></a>
|
<a href="https://github.com/sharkdp/bat/actions?query=workflow%3ACICD"><img src="https://github.com/sharkdp/bat/workflows/CICD/badge.svg" alt="Build Status"></a>
|
||||||
<a href="https://ci.appveyor.com/project/sharkdp/bat"><img src="https://ci.appveyor.com/api/projects/status/cptsmtbiwbnr2vhf/branch/master?svg=true"></a>
|
|
||||||
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
||||||
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
||||||
A <i>cat(1)</i> clone with syntax highlighting and Git integration.
|
A <i>cat(1)</i> clone with syntax highlighting and Git integration.
|
||||||
@@ -12,8 +11,8 @@
|
|||||||
<a href="#how-to-use">How To Use</a> •
|
<a href="#how-to-use">How To Use</a> •
|
||||||
<a href="#installation">Installation</a> •
|
<a href="#installation">Installation</a> •
|
||||||
<a href="#customization">Customization</a> •
|
<a href="#customization">Customization</a> •
|
||||||
<a href="#project-goals-and-alternatives">Project goals, alternatives</a> •
|
<a href="#project-goals-and-alternatives">Project goals, alternatives</a><br>
|
||||||
Translation [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>][<a href="doc/README-ja.md">日本語</a>][<a href="doc/README-ko.md">한국어</a>]
|
[<a href="https://github.com/chinanf-boy/bat-zh">中文</a>] [<a href="doc/README-ja.md">日本語</a>] [<a href="doc/README-ko.md">한국어</a>] [<a href="doc/README-ru.md">Русский</a>]
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
### Syntax highlighting
|
### Syntax highlighting
|
||||||
@@ -39,14 +38,14 @@ characters:
|
|||||||
|
|
||||||
### Automatic paging
|
### Automatic paging
|
||||||
|
|
||||||
`bat` can pipe its own output to `less` if the output is too large for one screen.
|
By default, `bat` pipes its own output to a pager (e.g `less`) if the output is too large for one screen.
|
||||||
|
If you would rather `bat` work like `cat` all the time (never page output), you can set `--paging=never` as an option, either on the command line or in your configuration file.
|
||||||
|
If you intend to alias `cat` to `bat` in your shell configuration, you can use `alias cat='bat --paging=never'` to preserve the default behavior.
|
||||||
|
|
||||||
### File concatenation
|
#### File concatenation
|
||||||
|
|
||||||
Oh.. you can also use it to concatenate files :wink:. Whenever
|
Even with a pager set, you can still use `bat` to concatenate files :wink:.
|
||||||
`bat` detects a non-interactive terminal (i.e. when you pipe into another process
|
Whenever `bat` detects a non-interactive terminal (i.e. when you pipe into another process or into a file), `bat` will act as a drop-in replacement for `cat` and fall back to printing the plain file contents, regardless of the `--pager` option's value.
|
||||||
or into a file), `bat` will act as a drop-in replacement for `cat` and
|
|
||||||
fall back to printing the plain file contents.
|
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
@@ -62,7 +61,9 @@ Display multiple files at once
|
|||||||
> bat src/*.rs
|
> bat src/*.rs
|
||||||
```
|
```
|
||||||
|
|
||||||
Read from stdin, determine the syntax automatically
|
Read from stdin, determine the syntax automatically (note, highlighting will
|
||||||
|
only work if the syntax can be determined from the first line of the file,
|
||||||
|
usually through a shebang such as `#!/bin/sh`)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
> curl -s https://sh.rustup.rs | bat
|
> curl -s https://sh.rustup.rs | bat
|
||||||
@@ -130,7 +131,18 @@ highlighting:
|
|||||||
git show v0.6.0:src/main.rs | bat -l rs
|
git show v0.6.0:src/main.rs | bat -l rs
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that syntax highlighting within diffs is currently not supported. If you are looking for this, check out [`delta`](https://github.com/dandavison/delta).
|
#### `git diff`
|
||||||
|
|
||||||
|
You can combine `bat` with `git diff` to view lines around code changes with proper syntax
|
||||||
|
highlighting:
|
||||||
|
```bash
|
||||||
|
batdiff() {
|
||||||
|
git diff --name-only --diff-filter=d | xargs bat --diff
|
||||||
|
}
|
||||||
|
```
|
||||||
|
If you prefer to use this as a separate tool, check out `batdiff` in [`bat-extras`](https://github.com/eth-p/bat-extras).
|
||||||
|
|
||||||
|
If you are looking for more support for git and diff operations, check out [`delta`](https://github.com/dandavison/delta).
|
||||||
|
|
||||||
#### `xclip`
|
#### `xclip`
|
||||||
|
|
||||||
@@ -157,7 +169,9 @@ formatting problems.
|
|||||||
|
|
||||||
If you prefer to have this bundled in a new command, you can also use [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md).
|
If you prefer to have this bundled in a new command, you can also use [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md).
|
||||||
|
|
||||||
Note that the [Manpage syntax](assets/syntaxes/Manpage.sublime-syntax) is developed in this repository and still needs some work.
|
Note that the [Manpage syntax](assets/syntaxes/02_Extra/Manpage.sublime-syntax) is developed in this repository and still needs some work.
|
||||||
|
|
||||||
|
Also, note that this will [not work](https://github.com/sharkdp/bat/issues/1145) with Mandocs `man` implementation.
|
||||||
|
|
||||||
#### `prettier` / `shfmt` / `rustfmt`
|
#### `prettier` / `shfmt` / `rustfmt`
|
||||||
|
|
||||||
@@ -168,19 +182,36 @@ The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.
|
|||||||
|
|
||||||
[](https://repology.org/project/bat/versions)
|
[](https://repology.org/project/bat/versions)
|
||||||
|
|
||||||
### On Ubuntu
|
### On Ubuntu (using `apt`)
|
||||||
*... and other Debian-based Linux distributions.*
|
*... and other Debian-based Linux distributions.*
|
||||||
|
|
||||||
You can install [the Ubuntu `bat` package](https://packages.ubuntu.com/eoan/bat) or [the Debian `bat` package](https://packages.debian.org/sid/bat) since Ubuntu Eoan 19.10 or Debian unstable sid.
|
`bat` is making its way through the [Ubuntu](https://packages.ubuntu.com/eoan/bat) and
|
||||||
|
[Debian](https://packages.debian.org/sid/bat) package release process, and is available
|
||||||
|
for Ubuntu as of Eoan 19.10. On Debian `bat` is currently only available on the unstable
|
||||||
|
"Sid" branch.
|
||||||
|
|
||||||
|
If your Ubuntu/Debian installation is new enough you can simply run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
apt install bat
|
apt install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to run the latest release of bat or if you are on older versions of Ubuntu/Debian, download the latest `.deb` package from the [release page](https://github.com/sharkdp/bat/releases)
|
If you install `bat` this way, please note that the executable may be installed as `batcat` instead of `bat` (due to [a name
|
||||||
and install it via:
|
clash with another package](https://github.com/sharkdp/bat/issues/982)). You can set up a `bat -> batcat` symlink or alias to prevent any issues that may come up because of this and to be consistent with other distributions:
|
||||||
|
``` bash
|
||||||
|
mkdir -p ~/.local/bin
|
||||||
|
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### On Ubuntu (using most recent `.deb` packages)
|
||||||
|
*... and other Debian-based Linux distributions.*
|
||||||
|
|
||||||
|
If the package has not yet been promoted to your Ubuntu/Debian installation, or you want
|
||||||
|
the most recent release of `bat`, download the latest `.deb` package from the
|
||||||
|
[release page](https://github.com/sharkdp/bat/releases) and install it via:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo dpkg -i bat_0.13.0_amd64.deb # adapt version number and architecture
|
sudo dpkg -i bat_0.17.1_amd64.deb # adapt version number and architecture
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Alpine Linux
|
### On Alpine Linux
|
||||||
@@ -256,14 +287,16 @@ You can install `bat` with zypper:
|
|||||||
zypper install bat
|
zypper install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
### On macOS
|
### On macOS (or Linux) via Homebrew
|
||||||
|
|
||||||
You can install `bat` with [Homebrew](http://braumeister.org/formula/bat):
|
You can install `bat` with [Homebrew on MacOS](https://formulae.brew.sh/formula/bat) or [Homebrew on Linux](https://formulae.brew.sh/formula-linux/bat):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew install bat
|
brew install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### On macOS via MacPorts
|
||||||
|
|
||||||
Or install `bat` with [MacPorts](https://ports.macports.org/port/bat/summary):
|
Or install `bat` with [MacPorts](https://ports.macports.org/port/bat/summary):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -275,6 +308,10 @@ port install bat
|
|||||||
There are a few options to install `bat` on Windows. Once you have installed `bat`,
|
There are a few options to install `bat` on Windows. Once you have installed `bat`,
|
||||||
take a look at the ["Using `bat` on Windows"](#using-bat-on-windows) section.
|
take a look at the ["Using `bat` on Windows"](#using-bat-on-windows) section.
|
||||||
|
|
||||||
|
#### Prerequisites
|
||||||
|
|
||||||
|
You will need to install the [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) package.
|
||||||
|
|
||||||
#### With Chocolatey
|
#### With Chocolatey
|
||||||
|
|
||||||
You can install `bat` via [Chocolatey](https://chocolatey.org/packages/Bat):
|
You can install `bat` via [Chocolatey](https://chocolatey.org/packages/Bat):
|
||||||
@@ -289,50 +326,12 @@ You can install `bat` via [scoop](https://scoop.sh/):
|
|||||||
scoop install bat
|
scoop install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
You will need to install the [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) package.
|
|
||||||
|
|
||||||
#### From prebuilt binaries:
|
#### From prebuilt binaries:
|
||||||
|
|
||||||
You can download prebuilt binaries from the [Release page](https://github.com/sharkdp/bat/releases),
|
You can download prebuilt binaries from the [Release page](https://github.com/sharkdp/bat/releases),
|
||||||
|
|
||||||
You will need to install the [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) package.
|
You will need to install the [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) package.
|
||||||
|
|
||||||
### Via Docker
|
|
||||||
|
|
||||||
There is a [Docker image](https://hub.docker.com/r/danlynn/bat/) that you can use to run `bat` in a container:
|
|
||||||
```bash
|
|
||||||
docker pull danlynn/bat
|
|
||||||
alias bat='docker run -it --rm -e BAT_THEME -e BAT_STYLE -e BAT_TABS -v "$(pwd):/myapp" danlynn/bat'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Ansible
|
|
||||||
|
|
||||||
You can install `bat` with [Ansible](https://www.ansible.com/):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install role on local machine
|
|
||||||
ansible-galaxy install aeimer.install_bat
|
|
||||||
```
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
---
|
|
||||||
# Playbook to install bat
|
|
||||||
- host: all
|
|
||||||
roles:
|
|
||||||
- aeimer.install_bat
|
|
||||||
```
|
|
||||||
|
|
||||||
- [Ansible Galaxy](https://galaxy.ansible.com/aeimer/install_bat)
|
|
||||||
- [GitHub](https://github.com/aeimer/ansible-install-bat)
|
|
||||||
|
|
||||||
This should work with the following distributions:
|
|
||||||
- Debian/Ubuntu
|
|
||||||
- ARM (eg. Raspberry PI)
|
|
||||||
- Arch Linux
|
|
||||||
- Void Linux
|
|
||||||
- FreeBSD
|
|
||||||
- MacOS
|
|
||||||
|
|
||||||
### From binaries
|
### From binaries
|
||||||
|
|
||||||
Check out the [Release page](https://github.com/sharkdp/bat/releases) for
|
Check out the [Release page](https://github.com/sharkdp/bat/releases) for
|
||||||
@@ -341,14 +340,15 @@ binaries are also available: look for archives with `musl` in the file name.
|
|||||||
|
|
||||||
### From source
|
### From source
|
||||||
|
|
||||||
If you want to build `bat` from source, you need Rust 1.36 or
|
If you want to build `bat` from source, you need Rust 1.40 or
|
||||||
higher. You can then use `cargo` to build everything:
|
higher. You can then use `cargo` to build everything:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install bat
|
cargo install --locked bat
|
||||||
```
|
```
|
||||||
|
|
||||||
On some platforms, you might need to install `llvm` and/or `libclang-dev`.
|
Note that additional files like the man page or shell completion
|
||||||
|
files can not be installed in this way. They will be generated by `cargo` and should be available in the cargo target folder (under `build`).
|
||||||
|
|
||||||
## Customization
|
## Customization
|
||||||
|
|
||||||
@@ -372,6 +372,26 @@ light background, some themes like `GitHub` or `OneHalfLight` will work better f
|
|||||||
You can also use a custom theme by following the
|
You can also use a custom theme by following the
|
||||||
['Adding new themes' section below](https://github.com/sharkdp/bat#adding-new-themes).
|
['Adding new themes' section below](https://github.com/sharkdp/bat#adding-new-themes).
|
||||||
|
|
||||||
|
### 8-bit themes
|
||||||
|
|
||||||
|
`bat` has four themes that always use [8-bit colors](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors),
|
||||||
|
even when truecolor support is available:
|
||||||
|
|
||||||
|
- `ansi-dark` looks decent on any terminal with a dark background. It uses 3-bit colors: black, red,
|
||||||
|
green, yellow, blue, magenta, cyan, and white.
|
||||||
|
- `ansi-light` is like `ansi-dark`, but for terminals with a light background.
|
||||||
|
- `base16` is designed for [base16](https://github.com/chriskempson/base16) terminal themes. It uses
|
||||||
|
4-bit colors (3-bit colors plus bright variants) in accordance with the
|
||||||
|
[base16 styling guidelines](https://github.com/chriskempson/base16/blob/master/styling.md).
|
||||||
|
- `base16-256` is designed for [base16-shell](https://github.com/chriskempson/base16-shell).
|
||||||
|
It replaces certain bright colors with 8-bit colors from 16 to 21. **Do not** use this simply
|
||||||
|
because you have a 256-color terminal but are not using base16-shell.
|
||||||
|
|
||||||
|
Although these themes are more restricted, they have two advantages over truecolor themes:
|
||||||
|
|
||||||
|
- They harmonize better with other terminal software using 3-bit or 4-bit colors.
|
||||||
|
- When you change your terminal theme, `bat` output already on the screen will update to match.
|
||||||
|
|
||||||
### Output style
|
### Output style
|
||||||
|
|
||||||
You can use the `--style` option to control the appearance of `bat`s output.
|
You can use the `--style` option to control the appearance of `bat`s output.
|
||||||
@@ -382,35 +402,45 @@ variable to make these changes permanent or use `bat`s
|
|||||||
|
|
||||||
### Adding new syntaxes / language definitions
|
### Adding new syntaxes / language definitions
|
||||||
|
|
||||||
|
Should you find that a particular syntax is not available within `bat`, you can follow these
|
||||||
|
instructions to easily add new syntaxes to your current `bat` installation.
|
||||||
|
|
||||||
`bat` uses the excellent [`syntect`](https://github.com/trishume/syntect/)
|
`bat` uses the excellent [`syntect`](https://github.com/trishume/syntect/)
|
||||||
library for syntax highlighting. `syntect` can read any
|
library for syntax highlighting. `syntect` can read any
|
||||||
[Sublime Text `.sublime-syntax` file](https://www.sublimetext.com/docs/3/syntax.html)
|
[Sublime Text `.sublime-syntax` file](https://www.sublimetext.com/docs/3/syntax.html)
|
||||||
and theme. To add new syntax definitions, do the following.
|
and theme.
|
||||||
|
|
||||||
Create a folder with syntax definition files:
|
A good resource for finding Sublime Syntax packages is [Package Control](https://packagecontrol.io/). Once you found a
|
||||||
|
syntax:
|
||||||
|
|
||||||
```bash
|
1. Create a folder with syntax definition files:
|
||||||
mkdir -p "$(bat --config-dir)/syntaxes"
|
|
||||||
cd "$(bat --config-dir)/syntaxes"
|
|
||||||
|
|
||||||
# Put new '.sublime-syntax' language definition files
|
```bash
|
||||||
# in this folder (or its subdirectories), for example:
|
mkdir -p "$(bat --config-dir)/syntaxes"
|
||||||
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
cd "$(bat --config-dir)/syntaxes"
|
||||||
```
|
|
||||||
|
|
||||||
Now use the following command to parse these files into a binary cache:
|
# Put new '.sublime-syntax' language definition files
|
||||||
|
# in this folder (or its subdirectories), for example:
|
||||||
|
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
2. Now use the following command to parse these files into a binary cache:
|
||||||
bat cache --build
|
|
||||||
```
|
|
||||||
|
|
||||||
Finally, use `bat --list-languages` to check if the new languages are available.
|
```bash
|
||||||
|
bat cache --build
|
||||||
|
```
|
||||||
|
|
||||||
If you ever want to go back to the default settings, call:
|
3. Finally, use `bat --list-languages` to check if the new languages are available.
|
||||||
|
|
||||||
```bash
|
If you ever want to go back to the default settings, call:
|
||||||
bat cache --clear
|
|
||||||
```
|
```bash
|
||||||
|
bat cache --clear
|
||||||
|
```
|
||||||
|
|
||||||
|
4. If you think that a specific syntax should be included in `bat` by default, please
|
||||||
|
consider opening a "syntax request" ticket after reading the policies and
|
||||||
|
instructions [here](doc/assets.md): [Open Syntax Request](https://github.com/sharkdp/bat/issues/new?labels=syntax-request&template=syntax_request.md).
|
||||||
|
|
||||||
### Adding new themes
|
### Adding new themes
|
||||||
|
|
||||||
@@ -430,6 +460,33 @@ bat cache --build
|
|||||||
|
|
||||||
Finally, use `bat --list-themes` to check if the new themes are available.
|
Finally, use `bat --list-themes` to check if the new themes are available.
|
||||||
|
|
||||||
|
### Adding or changing file type associations
|
||||||
|
|
||||||
|
You can add new (or change existing) file name patterns using the `--map-syntax`
|
||||||
|
command line option. The option takes an argument of the form `pattern:syntax` where
|
||||||
|
`pattern` is a glob pattern that is matched against the file name and
|
||||||
|
the absolute file path. The `syntax` part is the full name of a supported language
|
||||||
|
(use `bat --list-languages` for an overview)full .
|
||||||
|
|
||||||
|
Note: You probably want to use this option as an entry in `bat`s configuration file instead
|
||||||
|
of passing it on the command line (see below).
|
||||||
|
|
||||||
|
Example: To use "INI" syntax highlighting for all files with a `.conf` file extension, use
|
||||||
|
```bash
|
||||||
|
--map-syntax='*.conf:INI'
|
||||||
|
```
|
||||||
|
|
||||||
|
Example: To open all files called `.ignore` (exact match) with the "Git Ignore" syntax, use:
|
||||||
|
```bash
|
||||||
|
--map-syntax='.ignore:Git Ignore'
|
||||||
|
```
|
||||||
|
|
||||||
|
Example: To open all `.conf` files in subfolders of `/etc/apache2` with the "Apache Conf"
|
||||||
|
syntax, use (this mapping is already built in):
|
||||||
|
```bash
|
||||||
|
-map-syntax='/etc/apache2/**/*.conf:Apache Conf'
|
||||||
|
```
|
||||||
|
|
||||||
### Using a different pager
|
### Using a different pager
|
||||||
|
|
||||||
`bat` uses the pager that is specified in the `PAGER` environment variable. If this variable is not
|
`bat` uses the pager that is specified in the `PAGER` environment variable. If this variable is not
|
||||||
@@ -461,16 +518,27 @@ If you want to enable mouse-wheel scrolling on older versions of `less`, you can
|
|||||||
in the example above, this will disable the quit-if-one-screen feature). For less 530 or newer,
|
in the example above, this will disable the quit-if-one-screen feature). For less 530 or newer,
|
||||||
it should work out of the box.
|
it should work out of the box.
|
||||||
|
|
||||||
|
### Indentation
|
||||||
|
|
||||||
|
`bat` expands tabs to 4 spaces by itself, not relying on the pager. To change this, simply add the
|
||||||
|
`--tabs` argument with the number of spaces you want to be displayed.
|
||||||
|
|
||||||
|
**Note**: Defining tab stops for the pager (via the `--pager` argument by `bat`, or via the `LESS`
|
||||||
|
environment variable for `less`) won't be taken into account because the pager will already get
|
||||||
|
expanded spaces instead of tabs. This behaviour is added to avoid indentation issues caused by the
|
||||||
|
sidebar. Calling `bat` with `--tabs=0` will override it and let tabs be consumed by the pager.
|
||||||
|
|
||||||
### Dark mode
|
### Dark mode
|
||||||
|
|
||||||
If you make use of the dark mode feature in macOS, you might want to configure `bat` to use a different
|
If you make use of the dark mode feature in macOS, you might want to configure `bat` to use a different
|
||||||
theme based on the OS theme. The following snippet uses the `default` theme when in the light mode
|
theme based on the OS theme. The following snippet uses the `default` theme when in the _dark mode_
|
||||||
and the `GitHub` theme when in the dark mode.
|
and the `GitHub` theme when in the _light mode_.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
|
alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Configuration file
|
## Configuration file
|
||||||
|
|
||||||
`bat` can also be customized with a configuration file. The location of the file is dependent
|
`bat` can also be customized with a configuration file. The location of the file is dependent
|
||||||
@@ -485,6 +553,11 @@ non-default location of the configuration file:
|
|||||||
export BAT_CONFIG_PATH="/path/to/bat.conf"
|
export BAT_CONFIG_PATH="/path/to/bat.conf"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
A default configuration file can be created with the `--generate-config-file` option.
|
||||||
|
```bash
|
||||||
|
bat --generate-config-file
|
||||||
|
```
|
||||||
|
|
||||||
### Format
|
### Format
|
||||||
|
|
||||||
The configuration file is a simple list of command line arguments. Use `bat --help` to see a full list of possible options and values. In addition, you can add comments by prepending a line with the `#` character.
|
The configuration file is a simple list of command line arguments. Use `bat --help` to see a full list of possible options and values. In addition, you can add comments by prepending a line with the `#` character.
|
||||||
@@ -502,15 +575,16 @@ Example configuration file:
|
|||||||
|
|
||||||
# Use C++ syntax for .ino files
|
# Use C++ syntax for .ino files
|
||||||
--map-syntax "*.ino:C++"
|
--map-syntax "*.ino:C++"
|
||||||
|
|
||||||
# Use ".gitignore"-style highlighting for ".ignore" files
|
|
||||||
--map-syntax ".ignore:Git Ignore"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using `bat` on Windows
|
## Using `bat` on Windows
|
||||||
|
|
||||||
`bat` mostly works out-of-the-box on Windows, but a few features may need extra configuration.
|
`bat` mostly works out-of-the-box on Windows, but a few features may need extra configuration.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
You will need to install the [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) package.
|
||||||
|
|
||||||
### Paging
|
### Paging
|
||||||
|
|
||||||
Windows only includes a very limited pager in the form of `more`. You can download a Windows binary
|
Windows only includes a very limited pager in the form of `more`. You can download a Windows binary
|
||||||
@@ -553,9 +627,10 @@ bat() {
|
|||||||
|
|
||||||
### Terminals & colors
|
### Terminals & colors
|
||||||
|
|
||||||
`bat` handles terminals *with* and *without* truecolor support. However, the colors in the syntax
|
`bat` handles terminals *with* and *without* truecolor support. However, the colors in most syntax
|
||||||
highlighting themes are not optimized for 8-bit colors and it is therefore strongly recommended
|
highlighting themes are not optimized for 8-bit colors. It is therefore strongly recommended
|
||||||
that you use a terminal with 24-bit truecolor support (`terminator`, `konsole`, `iTerm2`, ...).
|
that you use a terminal with 24-bit truecolor support (`terminator`, `konsole`, `iTerm2`, ...),
|
||||||
|
or use one of the basic [8-bit themes](#8-bit-themes) designed for a restricted set of colors.
|
||||||
See [this article](https://gist.github.com/XVilka/8346728) for more details and a full list of
|
See [this article](https://gist.github.com/XVilka/8346728) for more details and a full list of
|
||||||
terminals with truecolor support.
|
terminals with truecolor support.
|
||||||
|
|
||||||
@@ -594,17 +669,22 @@ cargo build --bins
|
|||||||
cargo test
|
cargo test
|
||||||
|
|
||||||
# Install (release version)
|
# Install (release version)
|
||||||
cargo install
|
cargo install --path . --locked
|
||||||
|
|
||||||
# Build a bat binary with modified syntaxes and themes
|
# Build a bat binary with modified syntaxes and themes
|
||||||
bash assets/create.sh
|
bash assets/create.sh
|
||||||
cargo install -f
|
cargo install --path . --locked --force
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
|
||||||
|
|
||||||
## Maintainers
|
## Maintainers
|
||||||
|
|
||||||
- [sharkdp](https://github.com/sharkdp)
|
- [sharkdp](https://github.com/sharkdp)
|
||||||
- [eth-p](https://github.com/eth-p)
|
- [eth-p](https://github.com/eth-p)
|
||||||
|
- [keith-hall](https://github.com/keith-hall)
|
||||||
|
|
||||||
## Project goals and alternatives
|
## Project goals and alternatives
|
||||||
|
|
||||||
@@ -621,6 +701,6 @@ There are a lot of alternatives, if you are looking for similar programs. See
|
|||||||
## License
|
## License
|
||||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
||||||
|
|
||||||
`bat` is distributed under the terms of both the MIT License and the Apache License 2.0.
|
`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
|
||||||
|
|
||||||
See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details.
|
See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details.
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
environment:
|
|
||||||
global:
|
|
||||||
TARGET: x86_64-pc-windows-msvc
|
|
||||||
RUST_VERSION: stable
|
|
||||||
CRATE_NAME: bat
|
|
||||||
CARGO_HOME: "c:\\cargo"
|
|
||||||
RUSTUP_HOME: "c:\\rustup"
|
|
||||||
|
|
||||||
install:
|
|
||||||
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
|
||||||
- rustup-init.exe -y --default-host %TARGET%
|
|
||||||
- set PATH=%PATH%;C:\cargo\bin
|
|
||||||
- rustc -Vv
|
|
||||||
- cargo -V
|
|
||||||
|
|
||||||
build: false
|
|
||||||
test_script:
|
|
||||||
- cargo test --target %TARGET% --verbose
|
|
||||||
- cargo run --target %TARGET% -- src/bin/bat/main.rs README.md --paging=never
|
|
||||||
|
|
||||||
before_deploy:
|
|
||||||
# Generate artifacts for release
|
|
||||||
- cargo build --bins --release --verbose
|
|
||||||
- ps: ci\before_deploy.ps1
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
description: 'Automatically deployed release'
|
|
||||||
artifact: /.*\.zip/
|
|
||||||
# Here's how:
|
|
||||||
# - Go to 'https://github.com/settings/tokens/new' and generate a Token with only the
|
|
||||||
# `public_repo` scope enabled
|
|
||||||
# - Then go to 'https://ci.appveyor.com/tools/encrypt' and enter the newly generated token.
|
|
||||||
# - Enter the "encrypted value" below
|
|
||||||
auth_token:
|
|
||||||
secure: oO4/J+hcFXgXcEqEc8gzlQNqLG0IxU78s4EyH+uczGdsyWajb3yipxPR6nXUvmoj
|
|
||||||
provider: GitHub
|
|
||||||
on:
|
|
||||||
RUST_VERSION: stable
|
|
||||||
appveyor_repo_tag: true
|
|
||||||
|
|
||||||
cache:
|
|
||||||
- C:\Users\appveyor\.cargo\registry
|
|
||||||
- target
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
- provider: Email
|
|
||||||
on_build_success: false
|
|
||||||
on_build_failure: false
|
|
||||||
on_build_status_changed: false
|
|
||||||
Vendored
-41
@@ -1,41 +0,0 @@
|
|||||||
## Syntax Highlighting in bat
|
|
||||||
|
|
||||||
`bat` uses the [syntect](https://github.com/trishume/syntect) library to highlight source
|
|
||||||
code. As a basis, syntect uses [Sublime Text](https://www.sublimetext.com/) syntax definitions
|
|
||||||
in the `.sublime-syntax` format.
|
|
||||||
|
|
||||||
In order to add new syntaxes to `bat`, follow these steps:
|
|
||||||
|
|
||||||
1. Find a Sublime Text syntax for the given language, preferably in a separate Git repository
|
|
||||||
which can be included as a submodule (under `assets/syntaxes`).
|
|
||||||
|
|
||||||
2. If the Sublime Text syntax is only available as a `.tmLanguage` file, open the file in
|
|
||||||
Sublime Text and convert it to a `.sublime-syntax` file via *Tools* -> *Developer* ->
|
|
||||||
*New Syntax from XXX.tmLanguage...*. Save the new file in the `assets/syntaxes` folder.
|
|
||||||
|
|
||||||
3. Run the `create.sh` script. It calls `bat cache --build` to parse all available
|
|
||||||
`.sublime-syntax` files and serialize them to a `syntaxes.bin` file (in this folder).
|
|
||||||
|
|
||||||
4. Re-compile `bat`. At compilation time, the `syntaxes.bin` file will be stored inside the
|
|
||||||
`bat` binary.
|
|
||||||
|
|
||||||
5. If you send a pull request with your changes, please do *not* include the changed `syntaxes.bin`
|
|
||||||
file. A new binary cache file will be created once before every new release of `bat`.
|
|
||||||
|
|
||||||
### Troubleshooting
|
|
||||||
|
|
||||||
Make sure that the local cache does not interfere with the internally stored syntaxes and
|
|
||||||
themes (`bat cache --clear`).
|
|
||||||
|
|
||||||
### Manual modifications
|
|
||||||
|
|
||||||
The following files have been manually modified after converting from a `.tmLanguage` file:
|
|
||||||
|
|
||||||
* `Dart.sublime-syntax` => removed `#regex.dart` include.
|
|
||||||
* `INI.sublime-syntax` => added `.hgrc`, `hgrc`, and `desktop` file types.
|
|
||||||
* `Org mode.sublime-syntax` => removed `task` file type.
|
|
||||||
|
|
||||||
### Non-submodule additions
|
|
||||||
|
|
||||||
* `Assembly (x86_64)` has been manually added from https://github.com/13xforever/x86-assembly-textmate-bundle due to `git clone` recursion problems
|
|
||||||
* `Nim.sublime-syntax` has been added manually from https://github.com/getzola/zola/blob/master/sublime_syntaxes/Nim.sublime-syntax as there was no suitable Git repository for it. The original syntax seems to originate from https://github.com/Varriount/NimLime
|
|
||||||
Vendored
+2
@@ -52,6 +52,8 @@ complete -c {{PROJECT_EXECUTABLE}} -l paging -xka "auto never always" -d "Specif
|
|||||||
|
|
||||||
complete -c {{PROJECT_EXECUTABLE}} -s p -l plain -d "Only show plain style, no decorations. Alias for '--style=plain'" -n "not __fish_seen_subcommand_from cache"
|
complete -c {{PROJECT_EXECUTABLE}} -s p -l plain -d "Only show plain style, no decorations. Alias for '--style=plain'" -n "not __fish_seen_subcommand_from cache"
|
||||||
|
|
||||||
|
complete -c {{PROJECT_EXECUTABLE}} -s P -d "Disable paging. Alias for '--paging=never'" -n "not __fish_seen_subcommand_from cache"
|
||||||
|
|
||||||
complete -c {{PROJECT_EXECUTABLE}} -s A -l show-all -d "Show non-printable characters like space/tab/newline" -n "not __fish_seen_subcommand_from cache"
|
complete -c {{PROJECT_EXECUTABLE}} -s A -l show-all -d "Show non-printable characters like space/tab/newline" -n "not __fish_seen_subcommand_from cache"
|
||||||
|
|
||||||
complete -c {{PROJECT_EXECUTABLE}} -l style -xka "auto full plain changes header grid numbers" -d "Comma-separated list of style elements or presets to display with file contents" -n "not __fish_seen_subcommand_from cache"
|
complete -c {{PROJECT_EXECUTABLE}} -l style -xka "auto full plain changes header grid numbers" -d "Comma-separated list of style elements or presets to display with file contents" -n "not __fish_seen_subcommand_from cache"
|
||||||
|
|||||||
Vendored
+93
@@ -0,0 +1,93 @@
|
|||||||
|
#compdef {{PROJECT_EXECUTABLE}}
|
||||||
|
|
||||||
|
local context state state_descr line
|
||||||
|
typeset -A opt_args
|
||||||
|
|
||||||
|
(( $+functions[_{{PROJECT_EXECUTABLE}}_cache_subcommand] )) ||
|
||||||
|
_{{PROJECT_EXECUTABLE}}_cache_subcommand() {
|
||||||
|
local -a args
|
||||||
|
args=(
|
||||||
|
'(-b --build -c --clear)'{-b,--build}'[Initialize or update the syntax/theme cache]'
|
||||||
|
'(-b --build -c --clear)'{-c,--clear}'[Remove the cached syntax definitions and themes]'
|
||||||
|
'(--source)'--source='[Use a different directory to load syntaxes and themes from]:directory:_files -/'
|
||||||
|
'(--target)'--target='[Use a different directory to store the cached syntax and theme set]:directory:_files -/'
|
||||||
|
'(--blank)'--blank'[Create completely new syntax and theme sets]'
|
||||||
|
'(: -)'{-h,--help}'[Prints help information]'
|
||||||
|
'*: :'
|
||||||
|
)
|
||||||
|
|
||||||
|
_arguments -S -s $args
|
||||||
|
}
|
||||||
|
|
||||||
|
(( $+functions[_{{PROJECT_EXECUTABLE}}_main] )) ||
|
||||||
|
_{{PROJECT_EXECUTABLE}}_main() {
|
||||||
|
local -a args
|
||||||
|
args=(
|
||||||
|
'(-A --show-all)'{-A,--show-all}'[Show non-printable characters (space, tab, newline, ..)]'
|
||||||
|
'*'{-p,--plain}'[Show plain style (alias for `--style=plain`), repeat twice to disable disable automatic paging (alias for `--paging=never`)]'
|
||||||
|
'(-l --language)'{-l+,--language=}'[Set the language for syntax highlighting]:<language>:->language'
|
||||||
|
'(-H --highlight-line)'{-H,--highlight-line}'[Highlight lines N through M]:<N\:M>...'
|
||||||
|
'(--file-name)'--file-name'[Specify the name to display for a file]:<name>...:_files'
|
||||||
|
'(-d --diff)'--diff'[Only show lines that have been added/removed/modified]'
|
||||||
|
'(--diff-context)'--diff-context'[Include N lines of context around added/removed/modified lines when using `--diff`]:<N> (lines):()'
|
||||||
|
'(--tabs)'--tabs'[Set the tab width to T spaces]:<T> (tab width):()'
|
||||||
|
'(--wrap)'--wrap='[Specify the text-wrapping mode]:<when>:(auto never character)'
|
||||||
|
'(--terminal-width)'--terminal-width'[Explicitly set the width of the terminal instead of determining it automatically]:<width>'
|
||||||
|
'(-n --number)'{-n,--number}'[Show line numbers]'
|
||||||
|
'(--color)'--color='[When to use colors]:<when>:(auto never always)'
|
||||||
|
'(--italic-text)'--italic-text='[Use italics in output]:<when>:(always never)'
|
||||||
|
'(--decorations)'--decorations='[When to show the decorations]:<when>:(auto never always)'
|
||||||
|
'(--paging)'--paging='[Specify when to use the pager]:<when>:(auto never always)'
|
||||||
|
'(-m --map-syntax)'{-m+,--map-syntax=}'[Use the specified syntax for files matching the glob pattern]:<glob\:syntax>...'
|
||||||
|
'(--theme)'--theme='[Set the color theme for syntax highlighting]:<theme>:->theme'
|
||||||
|
'(: --list-themes --list-languages -L)'--list-themes'[Display all supported highlighting themes]'
|
||||||
|
'(--style)'--style='[Comma-separated list of style elements to display]:<components>:->style'
|
||||||
|
'(-r --line-range)'{-r+,--line-range=}'[Only print the lines from N to M]:<N\:M>...'
|
||||||
|
'(: --list-themes --list-languages -L)'{-L,--list-languages}'[Display all supported languages]'
|
||||||
|
'(: -)'{-h,--help}'[Print this help message]'
|
||||||
|
'(: -)'{-V,--version}'[Show version information]'
|
||||||
|
'*: :_files'
|
||||||
|
)
|
||||||
|
|
||||||
|
_arguments -S -s $args
|
||||||
|
|
||||||
|
case "$state" in
|
||||||
|
language)
|
||||||
|
local IFS=$'\n'
|
||||||
|
local -a languages
|
||||||
|
languages=( $({{PROJECT_EXECUTABLE}} --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }') )
|
||||||
|
|
||||||
|
_describe 'language' languages
|
||||||
|
;;
|
||||||
|
|
||||||
|
theme)
|
||||||
|
local IFS=$'\n'
|
||||||
|
local -a themes
|
||||||
|
themes=( $({{PROJECT_EXECUTABLE}} --list-themes | sort) )
|
||||||
|
|
||||||
|
_values 'theme' $themes
|
||||||
|
;;
|
||||||
|
|
||||||
|
style)
|
||||||
|
_values -s , 'style' auto full plain changes header grid numbers snip
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# first positional argument
|
||||||
|
if (( ${#words} == 2 )); then
|
||||||
|
local -a subcommands
|
||||||
|
subcommands=('cache:Modify the syntax-definition and theme cache')
|
||||||
|
_describe subcommand subcommands
|
||||||
|
_{{PROJECT_EXECUTABLE}}_main
|
||||||
|
else
|
||||||
|
case $words[2] in
|
||||||
|
cache)
|
||||||
|
_{{PROJECT_EXECUTABLE}}_cache_subcommand
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
_{{PROJECT_EXECUTABLE}}_main
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
Vendored
+17
-7
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
ASSET_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
ASSET_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
@@ -42,12 +42,22 @@ fi
|
|||||||
# Always remove the local cache to avoid any confusion
|
# Always remove the local cache to avoid any confusion
|
||||||
bat cache --clear
|
bat cache --clear
|
||||||
|
|
||||||
# TODO: Remove this (and the reverse part below) when
|
# TODO:
|
||||||
# https://github.com/trishume/syntect/issues/222 has been fixed
|
# - Remove the JavaDoc patch once https://github.com/trishume/syntect/issues/222 has been fixed
|
||||||
JAVADOC_FILE="${ASSET_DIR}/syntaxes/01_Packages/Java/JavaDoc.sublime-syntax"
|
# - Remove the C# patch once https://github.com/sublimehq/Packages/pull/2331 has been merged
|
||||||
JAVADOC_PATCH="${ASSET_DIR}/JavaDoc.sublime-syntax.patch"
|
|
||||||
patch "$JAVADOC_FILE" "$JAVADOC_PATCH"
|
(
|
||||||
|
cd "$ASSET_DIR"
|
||||||
|
for patch in patches/*.patch; do
|
||||||
|
patch --strip=0 < "$patch"
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
bat cache --build --blank --source="$ASSET_DIR" --target="$ASSET_DIR"
|
bat cache --build --blank --source="$ASSET_DIR" --target="$ASSET_DIR"
|
||||||
|
|
||||||
patch -R "$JAVADOC_FILE" "$JAVADOC_PATCH"
|
(
|
||||||
|
cd "$ASSET_DIR"
|
||||||
|
for patch in patches/*.patch; do
|
||||||
|
patch --strip=0 --reverse < "$patch"
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|||||||
Vendored
+50
-9
@@ -1,4 +1,4 @@
|
|||||||
.TH {{PROJECT_EXECUTABLE | upcase}} "1"
|
.TH {{PROJECT_EXECUTABLE_UPPERCASE}} "1"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
{{PROJECT_EXECUTABLE}} \- a cat(1) clone with syntax highlighting and Git integration.
|
{{PROJECT_EXECUTABLE}} \- a cat(1) clone with syntax highlighting and Git integration.
|
||||||
.SH "USAGE"
|
.SH "USAGE"
|
||||||
@@ -87,17 +87,22 @@ Specify when to use the decorations that have been specified via '\-\-style'. Th
|
|||||||
automatic mode only enables decorations if an interactive terminal is detected. Possible
|
automatic mode only enables decorations if an interactive terminal is detected. Possible
|
||||||
values: *auto*, never, always.
|
values: *auto*, never, always.
|
||||||
.HP
|
.HP
|
||||||
|
\fB\-f\fR, \fB\-\-force\-colorization\fR
|
||||||
|
.IP
|
||||||
|
Alias for '--decorations=always --color=always'. This is useful \
|
||||||
|
if the output of {{PROJECT_EXECUTABLE}} is piped to another program, but you want \
|
||||||
|
to keep the colorization/decorations.
|
||||||
|
.HP
|
||||||
\fB\-\-paging\fR <when>
|
\fB\-\-paging\fR <when>
|
||||||
.IP
|
.IP
|
||||||
Specify when to use the pager. To control which pager is used, set the PAGER or
|
Specify when to use the pager. To disable the pager, use \&'\-\-paging=never' or its alias,
|
||||||
BAT_PAGER environment variables (the latter takes precedence) or use the '\-\-pager'
|
\fB-P\fR. To disable the pager permanently, set BAT_PAGER to an empty string. To control
|
||||||
option. To disable the pager permanently, set BAT_PAGER to an empty string or set
|
which pager is used, see the '\-\-pager' option. Possible values: *auto*, never, always.
|
||||||
\&'\-\-paging=never' in the configuration file. Possible values: *auto*, never, always.
|
|
||||||
.HP
|
.HP
|
||||||
\fB\-\-pager\fR <command>
|
\fB\-\-pager\fR <command>
|
||||||
.IP
|
.IP
|
||||||
Determine which pager is used. This option will overwrite the PAGER and BAT_PAGER
|
Determine which pager is used. This option will override the PAGER and BAT_PAGER
|
||||||
environment variables. The default pager is 'less'. To disable the pager completely, use
|
environment variables. The default pager is 'less'. To control when the pager is used, see
|
||||||
the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'.
|
the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'.
|
||||||
.HP
|
.HP
|
||||||
\fB\-m\fR, \fB\-\-map\-syntax\fR <glob-pattern:syntax-name>...
|
\fB\-m\fR, \fB\-\-map\-syntax\fR <glob-pattern:syntax-name>...
|
||||||
@@ -124,7 +129,7 @@ Configure which elements (line numbers, file headers, grid borders, Git modifica
|
|||||||
of components to display (e.g. 'numbers,changes,grid') or a pre\-defined style ('full').
|
of components to display (e.g. 'numbers,changes,grid') or a pre\-defined style ('full').
|
||||||
To set a default style, add the '\-\-style=".."' option to the configuration file or
|
To set a default style, add the '\-\-style=".."' option to the configuration file or
|
||||||
export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
|
export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
|
||||||
values: *auto*, full, plain, changes, header, grid, numbers, snip.
|
values: *auto*, full, plain, changes, header, grid, rule, numbers, snip.
|
||||||
.HP
|
.HP
|
||||||
\fB\-r\fR, \fB\-\-line\-range\fR <N:M>...
|
\fB\-r\fR, \fB\-\-line\-range\fR <N:M>...
|
||||||
.IP
|
.IP
|
||||||
@@ -169,5 +174,41 @@ is dependent on your operating system. To get the default path for your system,
|
|||||||
|
|
||||||
\fB{{PROJECT_EXECUTABLE}} --config-file\fR
|
\fB{{PROJECT_EXECUTABLE}} --config-file\fR
|
||||||
|
|
||||||
Alternatively, you can use the BAT_CONFIG_PATH environment variable to point bat to a non-default
|
Alternatively, you can use the BAT_CONFIG_PATH environment variable to point {{PROJECT_EXECUTABLE}} to a non-default
|
||||||
location of the configuration file.
|
location of the configuration file.
|
||||||
|
.SH "ADDING CUSTOM LANGUAGES"
|
||||||
|
{{PROJECT_EXECUTABLE}} supports Sublime Text \fB.sublime-syntax\fR language files, and can be
|
||||||
|
customized to add additional languages to your local installation. To do this, add the \fB.sublime-syntax\fR language
|
||||||
|
files to `\fB$({{PROJECT_EXECUTABLE}} --config-dir)/syntaxes\fR` and run `\fB{{PROJECT_EXECUTABLE}} cache --build\fR`.
|
||||||
|
|
||||||
|
\fBExample:\fR
|
||||||
|
|
||||||
|
.RS 0.5i
|
||||||
|
mkdir -p "$({{PROJECT_EXECUTABLE}} --config-dir)/syntaxes"
|
||||||
|
.br
|
||||||
|
cd "$({{PROJECT_EXECUTABLE}} --config-dir)/syntaxes"
|
||||||
|
|
||||||
|
# Put new '.sublime-syntax' language definition files
|
||||||
|
.br
|
||||||
|
# in this folder (or its subdirectories), for example:
|
||||||
|
.br
|
||||||
|
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
||||||
|
|
||||||
|
# And then build the cache.
|
||||||
|
.br
|
||||||
|
{{PROJECT_EXECUTABLE}} cache --build
|
||||||
|
.RE
|
||||||
|
|
||||||
|
Once the cache is built, the new language will be visible in `\fB{{PROJECT_EXECUTABLE}} --list-languages\fR`.
|
||||||
|
.br
|
||||||
|
If you ever want to remove the custom languages, you can clear the cache with `\fB{{PROJECT_EXECUTABLE}} cache --clear\fR`.
|
||||||
|
|
||||||
|
.SH "ADDING CUSTOM THEMES"
|
||||||
|
Similarly to custom languages, {{PROJECT_EXECUTABLE}} supports Sublime Text \fB.tmTheme\fR themes.
|
||||||
|
These can be installed to `\fB$({{PROJECT_EXECUTABLE}} --config-dir)/themes\fR`, and are added to the cache with
|
||||||
|
`\fB{{PROJECT_EXECUTABLE}} cache --build`.
|
||||||
|
.SH "MORE INFORMATION"
|
||||||
|
|
||||||
|
For more information and up-to-date documentation, visit the {{PROJECT_EXECUTABLE}} repo:
|
||||||
|
.br
|
||||||
|
\fBhttps://github.com/sharkdp/bat\fR
|
||||||
|
|||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git syntaxes/01_Packages/C#/C#.sublime-syntax syntaxes/01_Packages/C#/C#.sublime-syntax
|
||||||
|
index ed494f8b..01b710e8 100644
|
||||||
|
--- syntaxes/01_Packages/C#/C#.sublime-syntax
|
||||||
|
+++ syntaxes/01_Packages/C#/C#.sublime-syntax
|
||||||
|
@@ -1312,7 +1312,7 @@ contexts:
|
||||||
|
2: punctuation.separator.cs
|
||||||
|
3: punctuation.section.brackets.end.cs
|
||||||
|
4: keyword.operator.pointer.cs
|
||||||
|
- - match: \((?=(?:[^,)(]*|\([^\)]*\))*,)
|
||||||
|
+ - match: \((?=(?:[^,)(]|\([^\)]*\))*,)
|
||||||
|
scope: punctuation.section.group.begin.cs
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.group.tuple.cs
|
||||||
+81
@@ -0,0 +1,81 @@
|
|||||||
|
diff --git syntaxes/01_Packages/Makefile/Makefile.sublime-syntax syntaxes/01_Packages/Makefile/Makefile.sublime-syntax
|
||||||
|
index 3cc3a97e..0c7a3f24 100644
|
||||||
|
--- syntaxes/01_Packages/Makefile/Makefile.sublime-syntax
|
||||||
|
+++ syntaxes/01_Packages/Makefile/Makefile.sublime-syntax
|
||||||
|
@@ -44,64 +44,50 @@ variables:
|
||||||
|
# variable substitutions anywhere. We try to remedy this by hacking in a
|
||||||
|
# regex that matches up to four levels of nested parentheses, and ignores
|
||||||
|
# whatever's inside the parentheses.
|
||||||
|
- nps: '[^()]*'
|
||||||
|
- open: '(?:\('
|
||||||
|
- close: '\))?' # ignore this invalid.illegal
|
||||||
|
+ nps_unnested: '[^()]*'
|
||||||
|
+ nps: '[^()]*(?=[()])'
|
||||||
|
+ open: '(?:{{nps}}\('
|
||||||
|
+ close: '\){{nps_unnested}})?' # ignore this invalid.illegal
|
||||||
|
just_eat: | # WARNING: INSANITY FOLLOWS!
|
||||||
|
- (?x) # ignore whitespace in this regex
|
||||||
|
- {{nps}} # level 0
|
||||||
|
+ (?x)(?: # ignore whitespace in this regex
|
||||||
|
{{open}} # start level 1 __
|
||||||
|
- {{nps}} # level 1 _______ /*_>-<
|
||||||
|
{{open}} # start level 2 ___/ _____ \__/ /
|
||||||
|
- {{nps}} # level 2 <____/ \____/
|
||||||
|
{{open}} # start level 3 is like snek... (by Valerie Haecky)
|
||||||
|
- {{nps}} # level 3
|
||||||
|
{{open}} # start level 4
|
||||||
|
{{nps}} # level 4
|
||||||
|
{{close}} # end level 4
|
||||||
|
- {{nps}} # level 3
|
||||||
|
{{close}} # end level 3
|
||||||
|
- {{nps}} # level 2
|
||||||
|
{{open}} # start level 3
|
||||||
|
- {{nps}} # level 3
|
||||||
|
{{open}} # start level 4
|
||||||
|
{{nps}} # level 4
|
||||||
|
{{close}} # end level 4
|
||||||
|
- {{nps}} # level 3
|
||||||
|
{{close}} # end level 3
|
||||||
|
- {{nps}} # level 2
|
||||||
|
+ {{nps}}
|
||||||
|
{{close}} # end level 2
|
||||||
|
- {{nps}} # level 1
|
||||||
|
{{open}} # start level 2
|
||||||
|
- {{nps}} # level 2
|
||||||
|
{{open}} # start level 3
|
||||||
|
- {{nps}} # level 3
|
||||||
|
{{open}} # start level 4
|
||||||
|
{{nps}} # level 4
|
||||||
|
{{close}} # end level 4
|
||||||
|
- {{nps}} # level 3
|
||||||
|
+ {{nps}}
|
||||||
|
{{close}} # end level 3
|
||||||
|
- {{nps}} # level 2
|
||||||
|
{{open}} # start level 3
|
||||||
|
- {{nps}} # level 3
|
||||||
|
{{open}} # start level 4
|
||||||
|
{{nps}} # level 4
|
||||||
|
{{close}} # end level 4
|
||||||
|
- {{nps}} # level 3
|
||||||
|
+ {{nps}}
|
||||||
|
{{close}} # end level 3
|
||||||
|
- {{nps}} # level 2
|
||||||
|
{{open}} # start level 3
|
||||||
|
- {{nps}} # level 3
|
||||||
|
{{open}} # start level 4
|
||||||
|
{{nps}} # level 4
|
||||||
|
{{close}} # end level 4
|
||||||
|
- {{nps}} # level 3
|
||||||
|
+ {{nps}}
|
||||||
|
{{close}} # end level 3
|
||||||
|
- {{nps}} # level 2
|
||||||
|
+ {{nps}}
|
||||||
|
{{close}} # end level 2
|
||||||
|
- {{nps}} # level 1
|
||||||
|
+ {{nps}}
|
||||||
|
{{close}} # end level 1
|
||||||
|
- {{nps}} # level 0
|
||||||
|
+ |{{nps_unnested}})
|
||||||
|
rule_lookahead: '{{just_eat}}{{ruleassign}}{{just_eat}}'
|
||||||
|
|
||||||
|
var_lookahead_base: '{{just_eat}}({{varassign}}|{{shellassign}}){{just_eat}}'
|
||||||
+168
@@ -0,0 +1,168 @@
|
|||||||
|
diff --git syntaxes/01_Packages/Markdown/Markdown.sublime-syntax syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||||
|
index 19dc685d..6afd87ae 100644
|
||||||
|
--- syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||||
|
+++ syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||||
|
@@ -24,7 +24,6 @@ variables:
|
||||||
|
)
|
||||||
|
[ \t]*$ # followed by any number of tabs or spaces, followed by the end of the line
|
||||||
|
)
|
||||||
|
- setext_escape: ^(?=\s{0,3}(?:---+|===+)\s*$)
|
||||||
|
block_quote: (?:[ ]{,3}>(?:.|$)) # between 0 and 3 spaces, followed by a greater than sign, followed by any character or the end of the line
|
||||||
|
atx_heading: (?:[#]{1,6}\s*) # between 1 and 6 hashes, followed by any amount of whitespace
|
||||||
|
indented_code_block: (?:[ ]{4}|\t) # 4 spaces or a tab
|
||||||
|
@@ -277,69 +276,40 @@ contexts:
|
||||||
|
8: markup.underline.link.markdown
|
||||||
|
push: [link-ref-def, after-link-title, link-title]
|
||||||
|
- match: '^(?=\S)(?![=-]{3,}\s*$)'
|
||||||
|
- branch_point: heading2-branch
|
||||||
|
- branch:
|
||||||
|
- - not-heading2
|
||||||
|
- - heading2
|
||||||
|
-
|
||||||
|
- not-paragraph:
|
||||||
|
- - match: |-
|
||||||
|
- (?x) # pop out of this context when one of the following conditions are met:
|
||||||
|
- ^(?:
|
||||||
|
- \s*$ # the line is blank (or only contains whitespace)
|
||||||
|
- | (?=
|
||||||
|
- {{block_quote}} # a block quote begins the line
|
||||||
|
- | [ ]{,3}[*+-][ ] # an unordered list item begins the line
|
||||||
|
- | [ ]{,3}1[.][ ] # an ordered list item with number "1" begins the line
|
||||||
|
- | \# # an ATX heading begins the line
|
||||||
|
- | [ ]{,3}<( # all types of HTML blocks except type 7 may interrupt a paragraph
|
||||||
|
- {{html_tag_block_end_at_close_tag}} # 1
|
||||||
|
- | !-- # 2
|
||||||
|
- | \? # 3
|
||||||
|
- | ![A-Z] # 4
|
||||||
|
- | !\[CDATA\[ # 5
|
||||||
|
- | {{html_tag_block_end_at_blank_line}} # 6
|
||||||
|
+ push:
|
||||||
|
+ - meta_scope: meta.paragraph.markdown
|
||||||
|
+ - match: |-
|
||||||
|
+ (?x) # pop out of this context when one of the following conditions are met:
|
||||||
|
+ ^(?:
|
||||||
|
+ \s*$ # the line is blank (or only contains whitespace)
|
||||||
|
+ | (?=
|
||||||
|
+ {{block_quote}} # a block quote begins the line
|
||||||
|
+ | [ ]{,3}[*+-][ ] # an unordered list item begins the line
|
||||||
|
+ | [ ]{,3}1[.][ ] # an ordered list item with number "1" begins the line
|
||||||
|
+ | \# # an ATX heading begins the line
|
||||||
|
+ | [ ]{,3}<( # all types of HTML blocks except type 7 may interrupt a paragraph
|
||||||
|
+ {{html_tag_block_end_at_close_tag}} # 1
|
||||||
|
+ | !-- # 2
|
||||||
|
+ | \? # 3
|
||||||
|
+ | ![A-Z] # 4
|
||||||
|
+ | !\[CDATA\[ # 5
|
||||||
|
+ | {{html_tag_block_end_at_blank_line}} # 6
|
||||||
|
+ )
|
||||||
|
)
|
||||||
|
)
|
||||||
|
- )
|
||||||
|
- pop: true
|
||||||
|
-
|
||||||
|
- not-heading2:
|
||||||
|
- - include: not-paragraph
|
||||||
|
- - match: (?=\S)
|
||||||
|
- branch_point: heading1-branch
|
||||||
|
- branch:
|
||||||
|
- - paragraph
|
||||||
|
- - heading1
|
||||||
|
- - match: ''
|
||||||
|
- pop: true
|
||||||
|
-
|
||||||
|
- paragraph:
|
||||||
|
- - meta_scope: meta.paragraph.markdown
|
||||||
|
- - match: ^\s{0,3}===+\s*$
|
||||||
|
- fail: heading1-branch
|
||||||
|
- - match: ^\s{0,3}---+\s*$
|
||||||
|
- fail: heading2-branch
|
||||||
|
- - include: not-paragraph
|
||||||
|
- - include: inline-bold-italic-linebreak
|
||||||
|
- - include: scope:text.html.basic
|
||||||
|
-
|
||||||
|
- heading1:
|
||||||
|
- - meta_scope: markup.heading.1.markdown
|
||||||
|
- - include: inline-bold-italic-linebreak
|
||||||
|
- - match: '^[ \t]{0,3}(={3,})(?=[ \t]*$)'
|
||||||
|
- captures:
|
||||||
|
- 1: markup.heading.1.setext.markdown punctuation.definition.heading.setext.markdown
|
||||||
|
- pop: true
|
||||||
|
-
|
||||||
|
- heading2:
|
||||||
|
- - meta_scope: markup.heading.2.markdown
|
||||||
|
- - include: inline-bold-italic-linebreak
|
||||||
|
- - match: '^[ \t]{0,3}(-{3,})(?=[ \t]*$)'
|
||||||
|
- captures:
|
||||||
|
- 1: markup.heading.2.setext.markdown punctuation.definition.heading.setext.markdown
|
||||||
|
- pop: true
|
||||||
|
-
|
||||||
|
+ pop: true
|
||||||
|
+ - include: inline-bold-italic-linebreak
|
||||||
|
+ - include: scope:text.html.basic
|
||||||
|
+ - match: '^(={3,})(?=[ \t]*$)'
|
||||||
|
+ scope: markup.heading.1.setext.markdown
|
||||||
|
+ captures:
|
||||||
|
+ 1: punctuation.definition.heading.setext.markdown
|
||||||
|
+ pop: true
|
||||||
|
+ - match: '^(-{3,})(?=[ \t]*$)'
|
||||||
|
+ scope: markup.heading.2.setext.markdown
|
||||||
|
+ captures:
|
||||||
|
+ 1: punctuation.definition.heading.setext.markdown
|
||||||
|
+ pop: true
|
||||||
|
link-ref-def:
|
||||||
|
- meta_scope: meta.link.reference.def.markdown
|
||||||
|
- match: ''
|
||||||
|
@@ -430,8 +400,6 @@ contexts:
|
||||||
|
push:
|
||||||
|
- meta_scope: markup.bold.markdown
|
||||||
|
- meta_content_scope: markup.italic.markdown
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
[ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic
|
||||||
|
@@ -446,8 +414,6 @@ contexts:
|
||||||
|
scope: punctuation.definition.bold.end.markdown
|
||||||
|
set:
|
||||||
|
- meta_content_scope: markup.italic.markdown
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
[ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic
|
||||||
|
@@ -463,8 +429,6 @@ contexts:
|
||||||
|
scope: punctuation.definition.italic.end.markdown
|
||||||
|
set:
|
||||||
|
- meta_content_scope: markup.bold.markdown
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
[ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic
|
||||||
|
@@ -727,8 +691,6 @@ contexts:
|
||||||
|
scope: punctuation.definition.italic.begin.markdown
|
||||||
|
push:
|
||||||
|
- meta_scope: markup.italic.markdown
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
[ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic
|
||||||
|
@@ -745,8 +707,6 @@ contexts:
|
||||||
|
scope: punctuation.definition.italic.begin.markdown
|
||||||
|
push:
|
||||||
|
- meta_scope: markup.italic.markdown
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
[ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic
|
||||||
|
@@ -773,8 +733,6 @@ contexts:
|
||||||
|
- include: bold-italic-trailing
|
||||||
|
bold-italic-trailing:
|
||||||
|
- include: scope:text.html.basic
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: ^\s*$\n?
|
||||||
|
scope: invalid.illegal.non-terminated.bold-italic.markdown
|
||||||
|
pop: true
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git syntaxes/01_Packages/Rust/Rust.sublime-syntax syntaxes/01_Packages/Rust/Rust.sublime-syntax
|
||||||
|
index 3c354486..24727a4e 100644
|
||||||
|
--- syntaxes/01_Packages/Rust/Rust.sublime-syntax
|
||||||
|
+++ syntaxes/01_Packages/Rust/Rust.sublime-syntax
|
||||||
|
@@ -907,6 +907,8 @@ contexts:
|
||||||
|
- include: type-any-identifier
|
||||||
|
- match: ':'
|
||||||
|
scope: punctuation.separator.rust
|
||||||
|
+ - match: (?=;)
|
||||||
|
+ pop: true
|
||||||
|
|
||||||
|
fn-body:
|
||||||
|
- meta_scope: meta.function.rust
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
diff --git syntaxes/01_Packages/ShellScript/Bash.sublime-syntax syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
||||||
|
index e973e319..a703cef8 100644
|
||||||
|
--- syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
||||||
|
+++ syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
||||||
|
@@ -30,8 +30,8 @@ file_extensions:
|
||||||
|
- .zshenv
|
||||||
|
- .zshrc
|
||||||
|
- PKGBUILD # https://jlk.fjfi.cvut.cz/arch/manpages/man/PKGBUILD.5
|
||||||
|
- - .ebuild
|
||||||
|
- - .eclass
|
||||||
|
+ - ebuild
|
||||||
|
+ - eclass
|
||||||
|
|
||||||
|
first_line_match: |
|
||||||
|
(?x)
|
||||||
Vendored
BIN
Binary file not shown.
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/AWK updated: 1ce5f90d44...e593eb6d42
+1
Submodule assets/syntaxes/02_Extra/Apache added at 163bc03ae8
+221
@@ -0,0 +1,221 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Apache Conf
|
||||||
|
file_extensions:
|
||||||
|
- envvars
|
||||||
|
- htaccess
|
||||||
|
- HTACCESS
|
||||||
|
- htgroups
|
||||||
|
- HTGROUPS
|
||||||
|
- htpasswd
|
||||||
|
- HTPASSWD
|
||||||
|
- .htaccess
|
||||||
|
- .HTACCESS
|
||||||
|
- .htgroups
|
||||||
|
- .HTGROUPS
|
||||||
|
- .htpasswd
|
||||||
|
- .HTPASSWD
|
||||||
|
scope: source.apacheconf
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: ^(\s)*(#).*$\n?
|
||||||
|
scope: comment.line.hash.ini
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.apacheconf
|
||||||
|
- match: (<)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost|Macro|If|Else|ElseIf)(\s(.+?))?(>)
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.tag.apacheconf
|
||||||
|
2: entity.tag.apacheconf
|
||||||
|
4: string.value.apacheconf
|
||||||
|
5: punctuation.definition.tag.apacheconf
|
||||||
|
- match: (</)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost|Macro|If|Else|ElseIf)(>)
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.tag.apacheconf
|
||||||
|
2: entity.tag.apacheconf
|
||||||
|
3: punctuation.definition.tag.apacheconf
|
||||||
|
- match: (?<=(Rewrite(Rule|Cond)))\s+(.+?)\s+(.+?)($|\s)
|
||||||
|
captures:
|
||||||
|
3: string.regexp.apacheconf
|
||||||
|
4: string.replacement.apacheconf
|
||||||
|
- match: (?<=RedirectMatch)(\s+(\d\d\d|permanent|temp|seeother|gone))?\s+(.+?)\s+((.+?)($|\s))?
|
||||||
|
captures:
|
||||||
|
2: entity.status.apacheconf
|
||||||
|
3: string.regexp.apacheconf
|
||||||
|
5: string.path.apacheconf
|
||||||
|
- match: (?<=Redirect)(\s+(\d\d\d|permanent|temp|seeother|gone))?\s+(.+?)\s+((.+?)($|\s))?
|
||||||
|
captures:
|
||||||
|
2: entity.status.apacheconf
|
||||||
|
3: string.path.apacheconf
|
||||||
|
5: string.path.apacheconf
|
||||||
|
- match: (?<=ScriptAliasMatch|AliasMatch)\s+(.+?)\s+((.+?)\s)?
|
||||||
|
captures:
|
||||||
|
1: string.regexp.apacheconf
|
||||||
|
3: string.path.apacheconf
|
||||||
|
- match: (?<=RedirectPermanent|RedirectTemp|ScriptAlias|Alias)\s+(.+?)\s+((.+?)($|\s))?
|
||||||
|
captures:
|
||||||
|
1: string.path.apacheconf
|
||||||
|
3: string.path.apacheconf
|
||||||
|
- match: \b(AcceptPathInfo|AccessFileName|AddDefaultCharset|AddOutputFilterByType|AllowEncodedSlashes|AllowOverride|AuthName|AuthType|CGIMapExtension|ContentDigest|DefaultType|Define|DocumentRoot|EnableMMAP|EnableSendfile|ErrorDocument|ErrorLog|FileETag|ForceType|HostnameLookups|IdentityCheck|Include(Optional)?|KeepAlive|KeepAliveTimeout|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine|LimitXMLRequestBody|LogLevel|MaxKeepAliveRequests|Mutex|NameVirtualHost|Options|Require|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScriptInterpreterSource|ServerAdmin|ServerAlias|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|SetHandler|SetInputFilter|SetOutputFilter|Time(O|o)ut|TraceEnable|UseCanonicalName|Use|ErrorLogFormat|GlobalLog|PHPIniDir|SSLHonorCipherOrder|SSLCompression|SSLUseStapling|SSLStapling\w+|SSLCARevocationCheck|SSLSRPVerifierFile|SSLSessionTickets|RequestReadTimeout|ProxyHTML\w+|MaxRanges)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.core.apacheconf
|
||||||
|
- match: \b(AcceptMutex|AssignUserID|BS2000Account|ChildPerUserID|CoreDumpDirectory|EnableExceptionHook|Group|Listen|ListenBacklog|LockFile|MaxClients|MaxConnectionsPerChild|MaxMemFree|MaxRequestsPerChild|MaxRequestsPerThread|MaxRequestWorkers|MaxSpareServers|MaxSpareThreads|MaxThreads|MaxThreadsPerChild|MinSpareServers|MinSpareThreads|NumServers|PidFile|ReceiveBufferSize|ScoreBoardFile|SendBufferSize|ServerLimit|StartServers|StartThreads|ThreadLimit|ThreadsPerChild|ThreadStackSize|User|Win32DisableAcceptEx)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.mpm.apacheconf
|
||||||
|
- match: \b(Allow|Deny|Order)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.access.apacheconf
|
||||||
|
- match: \b(Action|Script)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.actions.apacheconf
|
||||||
|
- match: \b(Alias|AliasMatch|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ScriptAlias|ScriptAliasMatch)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.alias.apacheconf
|
||||||
|
- match: \b(AuthAuthoritative|AuthGroupFile|AuthUserFile|AuthBasicProvider|AuthBasicFake|AuthBasicAuthoritative|AuthBasicUseDigestAlgorithm)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.auth.apacheconf
|
||||||
|
- match: \b(Anonymous|Anonymous_Authoritative|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID|Anonymous_VerifyEmail)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.auth_anon.apacheconf
|
||||||
|
- match: \b(AuthDBMAuthoritative|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.auth_dbm.apacheconf
|
||||||
|
- match: \b(AuthDigestAlgorithm|AuthDigestDomain|AuthDigestFile|AuthDigestGroupFile|AuthDigestNcCheck|AuthDigestNonceFormat|AuthDigestNonceLifetime|AuthDigestQop|AuthDigestShmemSize|AuthDigestProvider)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.auth_digest.apacheconf
|
||||||
|
- match: \b(AuthLDAPAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases|AuthLDAPEnabled|AuthLDAPFrontPageHack|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPRemoteUserIsDN|AuthLDAPUrl)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.auth_ldap.apacheconf
|
||||||
|
- match: \b(AddAlt|AddAltByEncoding|AddAltByType|AddDescription|AddIcon|AddIconByEncoding|AddIconByType|DefaultIcon|HeaderName|IndexIgnore|IndexOptions|IndexOrderDefault|IndexStyleSheet|IndexHeadInsert|ReadmeName)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.autoindex.apacheconf
|
||||||
|
- match: \b(BalancerMember|BalancerGrowth|BalancerPersist|BalancerInherit)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.filter.apacheconf
|
||||||
|
- match: \b(CacheDefaultExpire|CacheDisable|CacheEnable|CacheForceCompletion|CacheIgnoreCacheControl|CacheIgnoreHeaders|CacheIgnoreNoLastMod|CacheLastModifiedFactor|CacheMaxExpire)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.cache.apacheconf
|
||||||
|
- match: \b(MetaDir|MetaFiles|MetaSuffix)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.cern_meta.apacheconf
|
||||||
|
- match: \b(ScriptLog|ScriptLogBuffer|ScriptLogLength)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.cgi.apacheconf
|
||||||
|
- match: \b(ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.cgid.apacheconf
|
||||||
|
- match: \b(CharsetDefault|CharsetOptions|CharsetSourceEnc)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.charset_lite.apacheconf
|
||||||
|
- match: \b(Dav|DavDepthInfinity|DavMinTimeout|DavLockDB)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.dav.apacheconf
|
||||||
|
- match: \b(DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateMemLevel|DeflateWindowSize)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.deflate.apacheconf
|
||||||
|
- match: \b(DirectoryIndex|DirectorySlash|FallbackResource)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.dir.apacheconf
|
||||||
|
- match: \b(CacheDirLength|CacheDirLevels|CacheExpiryCheck|CacheGcClean|CacheGcDaily|CacheGcInterval|CacheGcMemUsage|CacheGcUnused|CacheMaxFileSize|CacheMinFileSize|CacheRoot|CacheSize|CacheTimeMargin)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.disk_cache.apacheconf
|
||||||
|
- match: \b(DumpIOInput|DumpIOOutput)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.dumpio.apacheconf
|
||||||
|
- match: \b(PassEnv|SetEnv|UnsetEnv)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.env.apacheconf
|
||||||
|
- match: \b(ExpiresActive|ExpiresByType|ExpiresDefault)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.expires.apacheconf
|
||||||
|
- match: \b(ExtFilterDefine|ExtFilterOptions)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.ext_filter.apacheconf
|
||||||
|
- match: \b(CacheFile|MMapFile)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.file_cache.apacheconf
|
||||||
|
- match: \b(AddOutputFilterByType|FilterChain|FilterDeclare|FilterProtocol|FilterProvider|FilterTrace)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.filter.apacheconf
|
||||||
|
- match: \b(Header|RequestHeader)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.headers.apacheconf
|
||||||
|
- match: \b(ImapBase|ImapDefault|ImapMenu)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.imap.apacheconf
|
||||||
|
- match: \b(SSIEndTag|SSIErrorMsg|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|XBitHack)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.include.apacheconf
|
||||||
|
- match: \b(ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.isapi.apacheconf
|
||||||
|
- match: \b(LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionTimeout|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPSharedCacheFile|LDAPSharedCacheSize|LDAPTrustedCA|LDAPTrustedCAType)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.ldap.apacheconf
|
||||||
|
- match: \b(BufferedLogs|CookieLog|CustomLog|LogFormat|TransferLog|ForensicLog)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.log.apacheconf
|
||||||
|
- match: \b(MCacheMaxObjectCount|MCacheMaxObjectSize|MCacheMaxStreamingBuffer|MCacheMinObjectSize|MCacheRemovalAlgorithm|MCacheSize)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.mem_cache.apacheconf
|
||||||
|
- match: \b(AddCharset|AddEncoding|AddHandler|AddInputFilter|AddLanguage|AddOutputFilter|AddType|DefaultLanguage|ModMimeUsePathInfo|MultiviewsMatch|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|TypesConfig)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.mime.apacheconf
|
||||||
|
- match: \b(ProtocolEcho|Example|AddModuleInfo|MimeMagicFile|CheckSpelling|ExtendedStatus|SuexecUserGroup|UserDir)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.misc.apacheconf
|
||||||
|
- match: \b(CacheNegotiatedDocs|ForceLanguagePriority|LanguagePriority)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.negotiation.apacheconf
|
||||||
|
- match: \b(NWSSLTrustedCerts|NWSSLUpgradeable|SecureListen)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.nw_ssl.apacheconf
|
||||||
|
- match: \b(AllowCONNECT|NoProxy|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyFtpDirCharset|ProxyIOBufferSize|ProxyMaxForwards|ProxyPass|ProxyPassMatch|ProxyPassReverse|ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxyTimeout|ProxyVia)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.proxy.apacheconf
|
||||||
|
- match: \b(RewriteBase|RewriteCond|RewriteEngine|RewriteLock|RewriteLog|RewriteLogLevel|RewriteMap|RewriteOptions|RewriteRule)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.rewrite.apacheconf
|
||||||
|
- match: \b(BrowserMatch|BrowserMatchNoCase|SetEnvIf|SetEnvIfNoCase)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.setenvif.apacheconf
|
||||||
|
- match: \b(LoadFile|LoadModule)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.so.apacheconf
|
||||||
|
- match: \b(SSLCACertificateFile|SSLCACertificatePath|SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLEngine|SSLMutex|SSLOptions|SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCipherSuite|SSLProxyEngine|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRequire|SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLUserName|SSLVerifyClient|SSLVerifyDepth|SSLInsecureRenegotiation|SSLOpenSSLConfCmd)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.ssl.apacheconf
|
||||||
|
- match: \b(Substitute|SubstituteInheritBefore|SubstituteMaxLineLength)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.substitute.apacheconf
|
||||||
|
- match: \b(CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.usertrack.apacheconf
|
||||||
|
- match: \b(VirtualDocumentRoot|VirtualDocumentRootIP|VirtualScriptAlias|VirtualScriptAliasIP)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.vhost_alias.apacheconf
|
||||||
|
- match: \b(php_value|php_flag|php_admin_value|php_admin_flag)\b(\s+(.+?)(\s+(".+?"|.+?))?)?\s
|
||||||
|
captures:
|
||||||
|
1: keyword.php.apacheconf
|
||||||
|
3: entity.property.apacheconf
|
||||||
|
5: string.value.apacheconf
|
||||||
|
- match: '(%\{)((HTTP_USER_AGENT|HTTP_REFERER|HTTP_COOKIE|HTTP_FORWARDED|HTTP_HOST|HTTP_PROXY_CONNECTION|HTTP_ACCEPT|REMOTE_ADDR|REMOTE_HOST|REMOTE_PORT|REMOTE_USER|REMOTE_IDENT|REQUEST_METHOD|SCRIPT_FILENAME|PATH_INFO|QUERY_STRING|AUTH_TYPE|DOCUMENT_ROOT|SERVER_ADMIN|SERVER_NAME|SERVER_ADDR|SERVER_PORT|SERVER_PROTOCOL|SERVER_SOFTWARE|TIME_YEAR|TIME_MON|TIME_DAY|TIME_HOUR|TIME_MIN|TIME_SEC|TIME_WDAY|TIME|API_VERSION|THE_REQUEST|REQUEST_URI|REQUEST_FILENAME|IS_SUBREQ|HTTPS)|(.*?))(\})'
|
||||||
|
captures:
|
||||||
|
1: punctuation.variable.apacheconf
|
||||||
|
3: variable.env.apacheconf
|
||||||
|
4: variable.misc.apacheconf
|
||||||
|
5: punctuation.variable.apacheconf
|
||||||
|
- match: \b((text|image|application|video|audio)/.+?)\s
|
||||||
|
captures:
|
||||||
|
1: entity.mime-type.apacheconf
|
||||||
|
- match: \b(?i)(export|from|unset|set|on|off)\b
|
||||||
|
captures:
|
||||||
|
1: entity.helper.apacheconf
|
||||||
|
- match: \b(\d+)\b
|
||||||
|
captures:
|
||||||
|
1: constant.numeric.integer.decimal.apacheconf
|
||||||
|
- match: '\s(\[)(.*?)(\])\s'
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.flag.apacheconf
|
||||||
|
2: string.flag.apacheconf
|
||||||
|
3: punctuation.definition.flag.apacheconf
|
||||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/AsciiDoc updated: d0089991e5...e316a0a85c
+967
-253
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/CMake updated: aba96a0862...21e96989d6
Vendored
-1
Submodule assets/syntaxes/02_Extra/Cabal deleted from 2d98cb79eb
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Crystal updated: 2ee9d667ae...5e032ff5f5
+4
-3
@@ -108,7 +108,7 @@ contexts:
|
|||||||
- match: (?<!\.)\belse(\s)+if\b
|
- match: (?<!\.)\belse(\s)+if\b
|
||||||
comment: else if is a common mistake carried over from other languages. it works if you put in a second end, but it’s never what you want.
|
comment: else if is a common mistake carried over from other languages. it works if you put in a second end, but it’s never what you want.
|
||||||
scope: invalid.deprecated.crystal
|
scope: invalid.deprecated.crystal
|
||||||
- match: '(?<!\.)\b(BEGIN|alias|as|begin|case|select|abstract|class|END|ensure|for|fun|if|ifdef|in|lib|module|of|out|private|protected|rescue|struct|with|union|enum|macro|then|type|unless|until|while)\b(?![?!])'
|
- match: '(?<!\.)\b(BEGIN|alias|as|begin|case|select|abstract|class|END|ensure|for|fun|if|ifdef|in|lib|module|of|out|private|protected|rescue|struct|with|union|enum|macro|then|unless|until|while)\b(?![?!])|(?<!\.)\btype\b\s*(?=[A-Z])'
|
||||||
comment: everything being a reserved word, not a value and needing a 'end' is a..
|
comment: everything being a reserved word, not a value and needing a 'end' is a..
|
||||||
scope: keyword.control.primary.crystal
|
scope: keyword.control.primary.crystal
|
||||||
- match: '(?<!\.)\b(when|else|elsif)\b(?![?!])'
|
- match: '(?<!\.)\b(when|else|elsif)\b(?![?!])'
|
||||||
@@ -131,7 +131,7 @@ contexts:
|
|||||||
scope: keyword.control.pseudo-method.crystal
|
scope: keyword.control.pseudo-method.crystal
|
||||||
- match: '\b(nil|true|false)\b(?![?!])'
|
- match: '\b(nil|true|false)\b(?![?!])'
|
||||||
scope: constant.language.crystal
|
scope: constant.language.crystal
|
||||||
- match: '\b(__(DIR|FILE|LINE|END_LINE)__|self)\b(?![?!])'
|
- match: '\b(__(DIR|FILE|LINE|END_LINE)__|self)\b(?![?!])|self[?]'
|
||||||
scope: variable.language.crystal
|
scope: variable.language.crystal
|
||||||
- match: '\b(initialize|new|loop|include|extend|raise|getter|setter|property|class_getter|class_setter|class_property|describe|context|it|with|delegate|def_hash|def_equals|def_equals_and_hash|forward_missing_to|record|assert_responds_to|spawn|annotation|verbatim)\b[!?]?'
|
- match: '\b(initialize|new|loop|include|extend|raise|getter|setter|property|class_getter|class_setter|class_property|describe|context|it|with|delegate|def_hash|def_equals|def_equals_and_hash|forward_missing_to|record|assert_responds_to|spawn|annotation|verbatim)\b[!?]?'
|
||||||
comment: everything being a method but having a special function is a..
|
comment: everything being a method but having a special function is a..
|
||||||
@@ -190,7 +190,7 @@ contexts:
|
|||||||
push:
|
push:
|
||||||
- meta_scope: meta.function.method.with-arguments.crystal
|
- meta_scope: meta.function.method.with-arguments.crystal
|
||||||
- meta_content_scope: variable.parameter.function.crystal
|
- meta_content_scope: variable.parameter.function.crystal
|
||||||
- match: \)\s*$|\)\s*:|\)\s*;
|
- match: \)
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.parameters.crystal
|
0: punctuation.definition.parameters.crystal
|
||||||
pop: true
|
pop: true
|
||||||
@@ -705,6 +705,7 @@ contexts:
|
|||||||
0: punctuation.definition.string.end.crystal
|
0: punctuation.definition.string.end.crystal
|
||||||
pop: true
|
pop: true
|
||||||
- include: heredoc
|
- include: heredoc
|
||||||
|
- include: scope:text.html.basic
|
||||||
- include: scope:source.js
|
- include: scope:source.js
|
||||||
- include: interpolated_crystal
|
- include: interpolated_crystal
|
||||||
- include: escaped_char
|
- include: escaped_char
|
||||||
|
|||||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Elixir updated: 89b3bada32...4fb01891dd
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Elm updated: dfbb8bdc9a...e266d279c8
+1
Submodule assets/syntaxes/02_Extra/Email added at e89d09d440
+1
Submodule assets/syntaxes/02_Extra/Fortran added at dcf4f24f1c
@@ -4,6 +4,7 @@
|
|||||||
name: fstab
|
name: fstab
|
||||||
file_extensions:
|
file_extensions:
|
||||||
- fstab
|
- fstab
|
||||||
|
- crypttab
|
||||||
scope: source.fstab
|
scope: source.fstab
|
||||||
|
|
||||||
contexts:
|
contexts:
|
||||||
|
|||||||
+1
Submodule assets/syntaxes/02_Extra/GLSL added at 4cd4acfffc
+2
-1
@@ -25,12 +25,13 @@ contexts:
|
|||||||
scope: comment.line.semicolon.ini
|
scope: comment.line.semicolon.ini
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.comment.ini
|
1: punctuation.definition.comment.ini
|
||||||
- match: '^\s*(\[)(.*?)(\])'
|
- match: '^\s*(\[)(.*?)(\])\s*(;.*)?$\n?'
|
||||||
scope: meta.tag.section.ini
|
scope: meta.tag.section.ini
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.section.ini
|
1: punctuation.definition.section.ini
|
||||||
2: entity.section.ini
|
2: entity.section.ini
|
||||||
3: punctuation.definition.section.ini
|
3: punctuation.definition.section.ini
|
||||||
|
4: comment.definition.section.ini
|
||||||
- match: '^(\s*(["'']?)(.+?)(\2)\s*(=))?\s*((["'']?)(.*?)(\7))\s*(;.*)?$\n?'
|
- match: '^(\s*(["'']?)(.+?)(\2)\s*(=))?\s*((["'']?)(.*?)(\7))\s*(;.*)?$\n?'
|
||||||
scope: meta.declaration.ini
|
scope: meta.declaration.ini
|
||||||
captures:
|
captures:
|
||||||
|
|||||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Julia updated: 0ca4cc2990...6c0d770fc7
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/LESS updated: 3020993658...44632e19af
+138
-28
@@ -7,47 +7,157 @@ file_extensions:
|
|||||||
scope: source.man
|
scope: source.man
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
section_heading: '^\S.*$'
|
section_heading: '^(?!#)\S.*$'
|
||||||
|
command_line_option: '(--?[A-Za-z0-9][_A-Za-z0-9-]*)'
|
||||||
|
|
||||||
contexts:
|
contexts:
|
||||||
|
prototype:
|
||||||
|
# ignore syntax test lines
|
||||||
|
- match: '^#'
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.syntax-test.man
|
||||||
|
- match: $\n?
|
||||||
|
pop: true
|
||||||
main:
|
main:
|
||||||
- match: ^
|
- match: ^
|
||||||
push: first_line
|
push: first_line
|
||||||
|
|
||||||
first_line:
|
first_line:
|
||||||
- match: '([A-Z0-9_\-]+)(\()([^)]+)(\))'
|
- match: '([A-Z0-9_\-]+)(\()([^)]+)(\))\s*'
|
||||||
captures:
|
captures:
|
||||||
1: meta.preprocessor
|
1: meta.preprocessor.man
|
||||||
2: keyword.operator
|
2: keyword.operator.man
|
||||||
3: string.quoted.other
|
3: string.quoted.other.man
|
||||||
4: keyword.operator
|
4: keyword.operator.man
|
||||||
|
push:
|
||||||
- match: '$'
|
- match: (?:[\w'-]+|\s(?!\s))
|
||||||
push: body
|
scope: markup.heading.title.man
|
||||||
|
- match: \s\s
|
||||||
body:
|
pop: true
|
||||||
- match: '^(SYNOPSIS|SYNTAX|SINTASSI|SKŁADNIA|СИНТАКСИС|書式)'
|
- match: '(?=\S|$)'
|
||||||
push: Packages/C/C.sublime-syntax
|
|
||||||
scope: markup.heading
|
|
||||||
with_prototype:
|
|
||||||
- match: '(?={{section_heading}})'
|
|
||||||
pop: true
|
pop: true
|
||||||
|
|
||||||
- match: '^\S.*$'
|
- match: '$'
|
||||||
scope: markup.heading
|
set: body
|
||||||
|
|
||||||
|
body:
|
||||||
|
# English, ..., ..., ..., Russian, ...
|
||||||
|
|
||||||
|
- match: '^(?:SYNOPSIS|SYNTAX|SINTASSI|SKŁADNIA|СИНТАКСИС|書式)'
|
||||||
|
scope: markup.heading.synopsis.man
|
||||||
|
embed: synopsis
|
||||||
|
escape: '(?={{section_heading}})'
|
||||||
|
|
||||||
|
- match: '^(?:USAGE)'
|
||||||
|
scope: markup.heading.synopsis.man
|
||||||
|
embed: synopsis
|
||||||
|
escape: '(?={{section_heading}})'
|
||||||
|
|
||||||
|
- match: '{{section_heading}}'
|
||||||
|
scope: markup.heading.other.man
|
||||||
|
embed: options # some man pages put command line options under the description heading
|
||||||
|
escape: '(?={{section_heading}})'
|
||||||
|
|
||||||
|
function-call:
|
||||||
- match: '\b([A-Za-z0-9_\-]+)(\()([^)]*)(\))'
|
- match: '\b([A-Za-z0-9_\-]+)(\()([^)]*)(\))'
|
||||||
captures:
|
captures:
|
||||||
1: entity.name.function
|
1: entity.name.function.man
|
||||||
2: keyword.operator
|
2: keyword.operator.man
|
||||||
3: constant.numeric
|
3: constant.numeric.man
|
||||||
4: keyword.operator
|
4: keyword.operator.man
|
||||||
|
|
||||||
|
options:
|
||||||
# command-line options like --option=value, --some-flag, or -x
|
# command-line options like --option=value, --some-flag, or -x
|
||||||
- match: '(?:[^a-zA-Z0-9_-]|^|\s)(--?[A-Za-z0-9][A-Za-z0-9-]*)(?:(=)?("?)([A-Za-z0-9]+)("?))?'
|
- match: '^[ ]{7}(?=-)'
|
||||||
|
push: expect-command-line-option
|
||||||
|
- match: '(?:[^a-zA-Z0-9_-]|^|\s){{command_line_option}}'
|
||||||
captures:
|
captures:
|
||||||
1: entity.name
|
1: entity.name.command-line-option
|
||||||
2: keyword.operator
|
push:
|
||||||
3: punctuation.definition.string.begin
|
- match: '='
|
||||||
4: variable.parameter
|
scope: keyword.operator.man
|
||||||
3: punctuation.definition.string.end
|
set:
|
||||||
|
- match: '[^],.() ]+'
|
||||||
|
scope: variable.parameter.man
|
||||||
|
pop: true
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- match: ''
|
||||||
|
pop: true
|
||||||
|
- include: function-call
|
||||||
|
- include: c-code
|
||||||
|
|
||||||
|
expect-command-line-option:
|
||||||
|
- match: '[A-Za-z0-9-]+'
|
||||||
|
scope: entity.name.command-line-option.man
|
||||||
|
- match: '(\[)(=)'
|
||||||
|
captures:
|
||||||
|
1: punctuation.section.brackets.begin.man
|
||||||
|
2: keyword.operator.man
|
||||||
|
push: [command-line-option-or-pipe, expect-parameter]
|
||||||
|
- match: '\['
|
||||||
|
push:
|
||||||
|
- meta_scope: entity.name.command-line-option.man
|
||||||
|
- match: '\]'
|
||||||
|
pop: true
|
||||||
|
- match: '='
|
||||||
|
scope: keyword.operator.man
|
||||||
|
push: expect-parameter
|
||||||
|
- match: (?=.*\.)
|
||||||
|
pop: true
|
||||||
|
- match: '\s'
|
||||||
|
push: expect-parameter
|
||||||
|
- match: '(,)\s*'
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.man
|
||||||
|
- match: $|(?=\])
|
||||||
|
pop: true
|
||||||
|
|
||||||
|
expect-parameter:
|
||||||
|
- match: '[A-Za-z0-9-]+'
|
||||||
|
scope: variable.parameter.man
|
||||||
|
- match: (?=\s+\|)
|
||||||
|
pop: true
|
||||||
|
- match: \|
|
||||||
|
scope: keyword.operator.logical.man
|
||||||
|
- match: '\['
|
||||||
|
scope: punctuation.section.brackets.begin.man
|
||||||
|
push:
|
||||||
|
- match: '\]'
|
||||||
|
scope: punctuation.section.brackets.end.man
|
||||||
|
pop: true
|
||||||
|
- include: expect-parameter
|
||||||
|
- match: '$|(?=[],]|{{command_line_option}})'
|
||||||
|
pop: true
|
||||||
|
|
||||||
|
c-code:
|
||||||
|
- match: '^(?=\s+(?:#include\b|#define\b|/\*|struct\s+(\w+\s*)?\{))'
|
||||||
|
embed: scope:source.c
|
||||||
|
#embed_scope: source.c.embedded.man
|
||||||
|
#escape: ^(?!#|\1|\s*(?:$|/\*|#include\b|#define\b))
|
||||||
|
escape: ^(?=\s*(?:\(.*\.\)\s*$|[A-Z](?![A-Z])))
|
||||||
|
|
||||||
|
synopsis:
|
||||||
|
- include: c-code
|
||||||
|
- match: \[
|
||||||
|
scope: punctuation.section.brackets.begin.man
|
||||||
|
push: command-line-option-or-pipe
|
||||||
|
- include: options
|
||||||
|
|
||||||
|
command-line-option-or-pipe:
|
||||||
|
- match: (\|)\s*
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.logical.man
|
||||||
|
#- match: (?={{command_line_option}})
|
||||||
|
- match: \w+-\w+
|
||||||
|
- match: (?=-)
|
||||||
|
push:
|
||||||
|
- match: (?=\s*\|)
|
||||||
|
pop: true
|
||||||
|
- include: expect-command-line-option
|
||||||
|
- match: \]
|
||||||
|
scope: punctuation.section.brackets.end.man
|
||||||
|
pop: true
|
||||||
|
- match: \[
|
||||||
|
scope: punctuation.section.brackets.begin.man
|
||||||
|
push: command-line-option-or-pipe
|
||||||
|
|||||||
+1
Submodule assets/syntaxes/02_Extra/Nginx added at 15a1db1510
+1
Submodule assets/syntaxes/02_Extra/Ninja added at 25830aaec9
+52
@@ -0,0 +1,52 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Ninja
|
||||||
|
file_extensions:
|
||||||
|
- ninja
|
||||||
|
scope: source.ninja
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: (#).*$\n?
|
||||||
|
comment: Comment line.
|
||||||
|
scope: comment.line.number-sign.ninja
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.ninja
|
||||||
|
- match: ^(rule)\b
|
||||||
|
comment: Rule keyword and keywords for a rule.
|
||||||
|
captures:
|
||||||
|
1: keyword.other.ninja
|
||||||
|
push:
|
||||||
|
- match: ^(?=\S)
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: \b(?:command|deps|depfile|description|generator|pool|restat|rspfile|rspfile_content)\b
|
||||||
|
scope: keyword.other.ninja
|
||||||
|
- match: ^(pool)\b
|
||||||
|
comment: Pool keyword and keywords for a pool.
|
||||||
|
captures:
|
||||||
|
1: keyword.other.ninja
|
||||||
|
push:
|
||||||
|
- match: ^(?=\S)
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: \b(?:depth)\b
|
||||||
|
scope: keyword.other.ninja
|
||||||
|
- match: ^(?:build|rule|default|include|subninja)\b
|
||||||
|
comment: Other Keywords.
|
||||||
|
scope: keyword.other.ninja
|
||||||
|
- match: '(?:[=:]|\|{1,2})(?=\s)'
|
||||||
|
comment: Operators for variable assignment (=), rule definition (:), implicit (|) and order only (||) dependencies.
|
||||||
|
scope: keyword.operator.ninja
|
||||||
|
- match: \$$
|
||||||
|
comment: Line wrap.
|
||||||
|
scope: keyword.operator.ninja
|
||||||
|
- match: \$\$
|
||||||
|
comment: Dollar literal.
|
||||||
|
scope: keyword.operator.ninja
|
||||||
|
- match: '\$[[:alnum:]_-]+'
|
||||||
|
comment: Simple variables, e.g. $var.
|
||||||
|
scope: variable.other.ninja
|
||||||
|
- match: '\${[[:alnum:]_.-]+}'
|
||||||
|
comment: "Variables, e.g. ${some.var.name}."
|
||||||
|
scope: variable.other.ninja
|
||||||
+1
Submodule assets/syntaxes/02_Extra/QML added at e3e058a21f
+103
@@ -0,0 +1,103 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: QML
|
||||||
|
file_extensions:
|
||||||
|
- qml
|
||||||
|
- qmlproject
|
||||||
|
scope: source.qml
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: /\*(?!/)
|
||||||
|
comment: Block comment.
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.documentation.qml
|
||||||
|
- match: \*/
|
||||||
|
pop: true
|
||||||
|
- match: //.*$
|
||||||
|
comment: Line comment.
|
||||||
|
scope: comment.line.double-slash.qml
|
||||||
|
- match: \b(import)\s+
|
||||||
|
comment: import statement.
|
||||||
|
captures:
|
||||||
|
1: keyword.other.import.qml
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.import.qml
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- match: '([\w\d\.]+)\s+(\d+\.\d+)(?:\s+(as)\s+([A-Z][\w\d]*))?'
|
||||||
|
comment: "import Namespace VersionMajor.VersionMinor [as SingletonTypeIdentifier]"
|
||||||
|
scope: meta.import.namespace.qml
|
||||||
|
captures:
|
||||||
|
1: entity.name.class.qml
|
||||||
|
2: constant.numeric.qml
|
||||||
|
3: keyword.other.import.qml
|
||||||
|
4: entity.name.class.qml
|
||||||
|
- match: '(\"[^\"]+\")(?:\s+(as)\s+([A-Z][\w\d]*))?'
|
||||||
|
comment: "import <string> [as Script]"
|
||||||
|
scope: meta.import.dirjs.qml
|
||||||
|
captures:
|
||||||
|
1: string.quoted.double.qml
|
||||||
|
2: keyword.other.import.qml
|
||||||
|
3: entity.name.class.qml
|
||||||
|
- match: '\b[A-Z]\w*\b'
|
||||||
|
comment: Capitalized word (class or enum).
|
||||||
|
scope: support.class.qml
|
||||||
|
- match: '(((^|\{)\s*)|\b)on[A-Z]\w*\b'
|
||||||
|
comment: onSomething - handler.
|
||||||
|
scope: support.class.qml
|
||||||
|
- match: '(?:^|\{)\s*(id)\s*\:\s*([^;\s]+)\b'
|
||||||
|
comment: "id: <something>"
|
||||||
|
scope: meta.id.qml
|
||||||
|
captures:
|
||||||
|
1: keyword.other.qml
|
||||||
|
2: storage.modifier.qml
|
||||||
|
- match: '^\s*(?:(default|readonly)\s+)?(property)\s+(?:(alias)|([\w\<\>]+))\s+(\w+)'
|
||||||
|
comment: property definition.
|
||||||
|
scope: meta.propertydef.qml
|
||||||
|
captures:
|
||||||
|
1: keyword.other.qml
|
||||||
|
2: keyword.other.qml
|
||||||
|
3: keyword.other.qml
|
||||||
|
4: storage.type.qml
|
||||||
|
5: entity.other.attribute-name.qml
|
||||||
|
- match: \b(signal)\s+(\w+)\s*
|
||||||
|
comment: "signal <signalName>[([<type> <parameter>[, ...]])]"
|
||||||
|
captures:
|
||||||
|
1: keyword.other.qml
|
||||||
|
2: support.function.qml
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.signal.qml
|
||||||
|
- match: ;|(?=/)|$
|
||||||
|
pop: true
|
||||||
|
- match: (\w+)\s+(\w+)
|
||||||
|
scope: meta.signal.parameters.qml
|
||||||
|
captures:
|
||||||
|
1: storage.type.qml
|
||||||
|
2: variable.parameter.qml
|
||||||
|
- match: (?:\b|\s+)(?:(true|false|null|undefined)|(var|void)|(on|as|enum|connect|break|case|catch|continue|debugger|default|delete|do|else|finally|for|if|in|instanceof|new|return|switch|this|throw|try|typeof|while|with))\b
|
||||||
|
comment: js keywords.
|
||||||
|
scope: meta.keyword.qml
|
||||||
|
captures:
|
||||||
|
1: constant.language.qml
|
||||||
|
2: storage.type.qml
|
||||||
|
3: keyword.control.qml
|
||||||
|
- match: '\b(function)\s+([\w_]+)\s*(?=\()'
|
||||||
|
comment: function definition.
|
||||||
|
scope: meta.function.qml
|
||||||
|
captures:
|
||||||
|
1: storage.type.qml
|
||||||
|
2: entity.name.function.untitled
|
||||||
|
- match: '\b[\w_]+\s*(?=\()'
|
||||||
|
comment: function call.
|
||||||
|
scope: support.function.qml
|
||||||
|
- match: '(?:^|\{|;)\s*[a-z][\w\.]*\s*(?=\:)'
|
||||||
|
comment: "property (property: <something>)."
|
||||||
|
scope: entity.other.attribute-name.qml
|
||||||
|
- match: (?<=\.)\b\w*
|
||||||
|
comment: property of the variable (name.property).
|
||||||
|
scope: entity.other.attribute-name.qml
|
||||||
|
- match: '\b([a-z_]\w*)\b'
|
||||||
|
comment: All non colored words are assumed to be variables.
|
||||||
|
scope: variable.parameter
|
||||||
|
- include: scope:source.js
|
||||||
+97
@@ -0,0 +1,97 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Rego
|
||||||
|
file_extensions:
|
||||||
|
- rego
|
||||||
|
scope: source.rego
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- include: comment
|
||||||
|
- include: keyword
|
||||||
|
- include: operator
|
||||||
|
- include: head
|
||||||
|
- include: term
|
||||||
|
comment:
|
||||||
|
- match: (#).*$\n?
|
||||||
|
scope: comment.line.number-sign.rego
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.rego
|
||||||
|
call:
|
||||||
|
- match: '([a-zA-Z_][a-zA-Z0-9_]*)\('
|
||||||
|
scope: meta.function-call.rego
|
||||||
|
captures:
|
||||||
|
1: support.function.any-method.rego
|
||||||
|
constant:
|
||||||
|
- match: \b(?:true|false|null)\b
|
||||||
|
scope: constant.language.rego
|
||||||
|
head:
|
||||||
|
- match: "^([[:alpha:]_][[:alnum:]_]*)"
|
||||||
|
captures:
|
||||||
|
1: entity.name.function.declaration
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.function.rego
|
||||||
|
- match: '(=|{|\n)'
|
||||||
|
pop: true
|
||||||
|
- include: term
|
||||||
|
keyword:
|
||||||
|
- match: (^|\s+)(?:(default|not|package|import|as|with|else|some))\s+
|
||||||
|
scope: keyword.other.rego
|
||||||
|
number:
|
||||||
|
- match: |-
|
||||||
|
(?x: # turn on extended mode
|
||||||
|
-? # an optional minus
|
||||||
|
(?:
|
||||||
|
0 # a zero
|
||||||
|
| # ...or...
|
||||||
|
[1-9] # a 1-9 character
|
||||||
|
\d* # followed by zero or more digits
|
||||||
|
)
|
||||||
|
(?:
|
||||||
|
(?:
|
||||||
|
\. # a period
|
||||||
|
\d+ # followed by one or more digits
|
||||||
|
)?
|
||||||
|
(?:
|
||||||
|
[eE] # an e character
|
||||||
|
[+-]? # followed by an option +/-
|
||||||
|
\d+ # followed by one or more digits
|
||||||
|
)? # make exponent optional
|
||||||
|
)? # make decimal portion optional
|
||||||
|
)
|
||||||
|
scope: constant.numeric.rego
|
||||||
|
operator:
|
||||||
|
- match: \=|\!\=|>|<|<\=|>\=|\+|-|\*|%|/|\||&|:\=
|
||||||
|
scope: keyword.operator.comparison.rego
|
||||||
|
string:
|
||||||
|
- match: '"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.rego
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.rego
|
||||||
|
- match: '"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.rego
|
||||||
|
pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x: # turn on extended mode
|
||||||
|
\\ # a literal backslash
|
||||||
|
(?: # ...followed by...
|
||||||
|
["\\/bfnrt] # one of these characters
|
||||||
|
| # ...or...
|
||||||
|
u # a u
|
||||||
|
[0-9a-fA-F]{4} # and four hex digits
|
||||||
|
)
|
||||||
|
)
|
||||||
|
scope: constant.character.escape.rego
|
||||||
|
- match: \\.
|
||||||
|
scope: invalid.illegal.unrecognized-string-escape.rego
|
||||||
|
term:
|
||||||
|
- include: constant
|
||||||
|
- include: string
|
||||||
|
- include: number
|
||||||
|
- include: call
|
||||||
|
- include: variable
|
||||||
|
variable:
|
||||||
|
- match: '\b[[:alpha:]_][[:alnum:]_]*\b'
|
||||||
|
scope: meta.identifier.rego
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
%YAML 1.2
|
%YAML 1.2
|
||||||
---
|
---
|
||||||
# http://www.sublimetext.com/docs/3/syntax.html
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
name: Robot Framework syntax highlighting.
|
name: Robot Framework
|
||||||
file_extensions:
|
file_extensions:
|
||||||
- robot
|
- robot
|
||||||
scope: source.robot
|
scope: source.robot
|
||||||
|
|||||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/SCSS_Sass updated: b98a3f3ccf...bc6332c1be
+33
@@ -0,0 +1,33 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: SML
|
||||||
|
file_extensions:
|
||||||
|
- sml
|
||||||
|
- cm
|
||||||
|
- sig
|
||||||
|
scope: source.sml
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: \b(EQUAL|GREATER|LESS|NONE|SOME|abstraction|abstype|and|andalso|array|as|before|bool|case|char|datatype|do|else|end|eqtype|exception|exn|false|fn|fun|functor|handle|if|in|include|infix|infixr|int|let|list|local|nil|nonfix|not|o|of|op|open|option|orelse|overload|print|raise|real|rec|ref|sharing|sig|signature|string|struct|structure|substring|then|true|type|unit|val|vector|where|while|with|withtype|word)\b
|
||||||
|
comment: SML keywords
|
||||||
|
scope: keyword.source.sml
|
||||||
|
- match: '\b[0-9]+\b'
|
||||||
|
comment: Numeric constants
|
||||||
|
scope: constant.numeric.sml
|
||||||
|
- match: '\b[A-Z]([A-z0-9]*)\b'
|
||||||
|
comment: Built in types
|
||||||
|
scope: support.type.sml
|
||||||
|
- match: '"(\\"|[^"])*"'
|
||||||
|
comment: String constant
|
||||||
|
scope: string.sml
|
||||||
|
- match: \(\*
|
||||||
|
comment: Comment
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.sml
|
||||||
|
- match: \*\)
|
||||||
|
pop: true
|
||||||
|
- match: '(\(\)|=>|::|\[\]|->|:>)'
|
||||||
|
comment: Character
|
||||||
|
scope: constant.character.sml
|
||||||
|
|
||||||
+1
Submodule assets/syntaxes/02_Extra/Stylus added at 30908e3b57
+711
@@ -0,0 +1,711 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Stylus
|
||||||
|
file_extensions:
|
||||||
|
- styl
|
||||||
|
- stylus
|
||||||
|
scope: source.stylus
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- include: comments
|
||||||
|
- match: '^\s*(@(?:import|charset|css|font-face|(?:-webkit-)?keyframes)(?:\s+([\w-]+))?)\b'
|
||||||
|
captures:
|
||||||
|
1: keyword.control.at-rule.other.stylus
|
||||||
|
2: variable.other.animation-name.stylus
|
||||||
|
push:
|
||||||
|
- match: '$|;|(?=\{)'
|
||||||
|
pop: true
|
||||||
|
- include: string-quoted
|
||||||
|
- match: ^\s*(@media)\s*
|
||||||
|
captures:
|
||||||
|
1: keyword.control.at-rule.media.stylus
|
||||||
|
push:
|
||||||
|
- match: '$|(?=\{)'
|
||||||
|
pop: true
|
||||||
|
- include: media-query
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
(?<=^|;|})
|
||||||
|
\s*
|
||||||
|
(?=
|
||||||
|
[\[\]'".\w$-]+
|
||||||
|
\s*
|
||||||
|
([?:]?=)
|
||||||
|
(?![^\[]*\])
|
||||||
|
)
|
||||||
|
push:
|
||||||
|
- match: $|;
|
||||||
|
pop: true
|
||||||
|
- include: expression
|
||||||
|
- include: iteration
|
||||||
|
- include: conditionals
|
||||||
|
- include: return
|
||||||
|
- match: |-
|
||||||
|
(?x) # multi-line regex definition mode
|
||||||
|
|
||||||
|
^(\s*) # starts at the beginning of line
|
||||||
|
([\w$-]+) # identifier (name)
|
||||||
|
(\() # start of argument list
|
||||||
|
(?=
|
||||||
|
.*?
|
||||||
|
\)\s*\{ # we see a curly brace afterwards
|
||||||
|
) # which means this is a function definition
|
||||||
|
captures:
|
||||||
|
2: entity.name.function.stylus
|
||||||
|
3: punctuation.definition.parameters.start.stylus
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.function-call.stylus
|
||||||
|
- match: (\))
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.parameters.end.stylus
|
||||||
|
pop: true
|
||||||
|
- include: expression
|
||||||
|
- match: |-
|
||||||
|
(?x) # multi-line regex definition mode
|
||||||
|
(
|
||||||
|
|
||||||
|
(^|;) # starts at the beginning of line or at a ;
|
||||||
|
\s*
|
||||||
|
(\+?\s* # for block mixins
|
||||||
|
[\w$-]+) # identifier (name)
|
||||||
|
(\() # start of argument list
|
||||||
|
(?=
|
||||||
|
.*?
|
||||||
|
\)\s*;?\s* # if there are only spaces and semicolons
|
||||||
|
$|; # then this a
|
||||||
|
)
|
||||||
|
)
|
||||||
|
captures:
|
||||||
|
3: entity.other.attribute-name.mixin.stylus
|
||||||
|
4: punctuation.definition.parameters.start.stylus
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.function-call.stylus
|
||||||
|
- match: (\))
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.parameters.end.stylus
|
||||||
|
pop: true
|
||||||
|
- include: expression
|
||||||
|
- match: |-
|
||||||
|
(?x) # multi-line regex definition mode
|
||||||
|
(^|(?<=\*/|\}))\s*
|
||||||
|
(?=
|
||||||
|
font(?!
|
||||||
|
\s*:\s
|
||||||
|
|
|
||||||
|
-
|
||||||
|
|
|
||||||
|
.*?
|
||||||
|
(?:
|
||||||
|
\/|normal|bold|light(er?)|serif|sans|monospace|
|
||||||
|
\b\d+(?:\b|px|r?em|%)|
|
||||||
|
var\s*\(|
|
||||||
|
['"][^\]]*$
|
||||||
|
)
|
||||||
|
) | # we need to distinguish between tag and property `cursor`
|
||||||
|
cursor(?!
|
||||||
|
\s*[:;]\s
|
||||||
|
|
|
||||||
|
-
|
||||||
|
|
|
||||||
|
.*?
|
||||||
|
(?:
|
||||||
|
(?:url\s*\()|
|
||||||
|
(?:-moz-|-webkit-|-ms-)?
|
||||||
|
(?:auto|default|none|context-menu|help|pointer|progress|
|
||||||
|
wait|cell|crosshair|text|vertical-text|alias|copy|
|
||||||
|
move|no-drop|not-allowed|e-resize|n-resize|ne-resize|
|
||||||
|
nw-resize|s-resize|se-resize|sw-resize|w-resize|
|
||||||
|
ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|
|
||||||
|
row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing
|
||||||
|
normal|bold|light(er?)|serif|sans|monospace)
|
||||||
|
)
|
||||||
|
) | (
|
||||||
|
(
|
||||||
|
altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|
|
||||||
|
animateMotion|animateTransform|circle|clipPath|color-profile|
|
||||||
|
defs|desc|ellipse|feBlend|feColorMatrix|
|
||||||
|
feComponentTransfer|feComposite|feConvolveMatrix|
|
||||||
|
feDiffuseLighting|feDisplacementMap|feDistantLight|feFlood|
|
||||||
|
feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|
|
||||||
|
feMergeNode|feMorphology|feOffset|fePointLight|
|
||||||
|
feSpecularLighting|feSpotLight|feTile|feTurbulence|filter|
|
||||||
|
font-face|font-face-format|font-face-name|font-face-src|
|
||||||
|
font-face-uri|foreignObject|g|glyph|glyphRef|hkern|image|line|
|
||||||
|
linearGradient|marker|mask|metadata|missing-glyph|mpath|path|
|
||||||
|
pattern|polygon|polyline|radialGradient|rect|set|stop|svg|
|
||||||
|
switch|symbol|text|textPath|tref|tspan|use|view|vkern|
|
||||||
|
a|abbr|acronym|address|applet|area|article|aside|audio|b|base|
|
||||||
|
basefont|bdi|bdo|bgsound|big|blink|blockquote|body|br|button|
|
||||||
|
canvas|caption|center|cite|code|col|colgroup|data|
|
||||||
|
datalist|dd|decorator|del|details|dfn|dir|div|dl|dt|element|
|
||||||
|
em|embed|fieldset|figcaption|figure|footer|form|frame|
|
||||||
|
frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|
|
||||||
|
img|input|ins|isindex|kbd|keygen|label|legend|li|link|listing|
|
||||||
|
main|map|mark|marquee|menu|menuitem|meta|meter|nav|nobr|
|
||||||
|
noframes|noscript|object|ol|optgroup|option|output|p|param|
|
||||||
|
plaintext|pre|progress|q|rp|rt|ruby|s|samp|script|section|
|
||||||
|
select|shadow|small|source|spacer|span|strike|strong|style|
|
||||||
|
sub|summary|sup|table|tbody|td|template|textarea|tfoot|th|
|
||||||
|
thead|time|title|tr|track|tt|u|ul|var|video|wbr|xmp)
|
||||||
|
|
||||||
|
\s*([\s,.#\[]|:[^\s]|(?=\{|$))
|
||||||
|
|
||||||
|
) | (
|
||||||
|
[:~>\[*\/] # symbols but they are valid for selector
|
||||||
|
|
||||||
|
) | (
|
||||||
|
|
||||||
|
\+\s*[\w$-]+\b\s* # are an identifier starting with $
|
||||||
|
(?!\() # and they can't have anything besides
|
||||||
|
|
||||||
|
) | ( # for animtions
|
||||||
|
|
||||||
|
\d+(\.\d+)?%|(from|to)\b
|
||||||
|
|
||||||
|
) | ( # Placeholder selectors
|
||||||
|
|
||||||
|
\$[\w$-]+\b\s* # are an identifier starting with $
|
||||||
|
(?=$|\{) # and they can't have anything besides
|
||||||
|
|
||||||
|
) | ( # CSS class
|
||||||
|
|
||||||
|
\.[a-zA-Z0-9_-]+
|
||||||
|
|
||||||
|
) | ( # CSS id
|
||||||
|
|
||||||
|
\#[a-zA-Z0-9_-]+
|
||||||
|
|
||||||
|
) | ( # Reference to parent
|
||||||
|
|
||||||
|
([\w\d_-]+)? # matching any word right before &
|
||||||
|
(&) # & itself, escaped because of plist
|
||||||
|
([\w\d_-]+)? # matching any word right after &
|
||||||
|
)
|
||||||
|
)
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.selector.stylus
|
||||||
|
- match: |-
|
||||||
|
|
||||||
|
|$|(?=\{\s*\}.*$)|(?=\{.*?[:;])|(?=\{)(?!.+\}.*$)
|
||||||
|
pop: true
|
||||||
|
- include: comma
|
||||||
|
- match: \d+(\.\d+)?%|from|to
|
||||||
|
scope: entity.other.animation-keyframe.stylus
|
||||||
|
- include: selector-components
|
||||||
|
- match: .
|
||||||
|
scope: entity.other.attribute-name.stylus
|
||||||
|
- match: |-
|
||||||
|
(?x) # multi-line regex definition mode
|
||||||
|
(?<=^|;|{)\s* # starts after begining of line, '{' or ';''
|
||||||
|
(?= # lookahead for
|
||||||
|
(
|
||||||
|
[a-zA-Z0-9_-] # then a letter
|
||||||
|
| # or
|
||||||
|
(\{(.*?)\}) # interpolation
|
||||||
|
| # or
|
||||||
|
(/\*.*?\*/) # comment
|
||||||
|
)+
|
||||||
|
|
||||||
|
\s*[:\s]\s* # value is separted by colon or space
|
||||||
|
|
||||||
|
(?!(\s*\{)) # if there are only spaces afterwards
|
||||||
|
|
||||||
|
(?!
|
||||||
|
[^}]*? # checking for an unclosed curly braces on this
|
||||||
|
\{ # line because if one exists it means that
|
||||||
|
[^}]* # this is a selector and not a property
|
||||||
|
($|\})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
push:
|
||||||
|
- match: '(?=\}|;)|(?<!,)\s*\n'
|
||||||
|
pop: true
|
||||||
|
- include: comments
|
||||||
|
- include: interpolation
|
||||||
|
- match: '(?<!^|;|{)\s*(?:(:)|\s)'
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.key-value.stylus
|
||||||
|
push:
|
||||||
|
- match: '(;)|(?=\})|(?=(?<!\,)\s*\n)'
|
||||||
|
captures:
|
||||||
|
1: punctuation.terminator.rule.stylus
|
||||||
|
pop: true
|
||||||
|
- include: comments
|
||||||
|
- include: expression
|
||||||
|
- match: "-(moz|o|ms|webkit|khtml)-"
|
||||||
|
scope: support.type.vendor-prefix.stylus
|
||||||
|
- match: .
|
||||||
|
scope: meta.property-name.stylus support.type.property-name.stylus
|
||||||
|
- match: '@extends?\s'
|
||||||
|
captures:
|
||||||
|
0: keyword.language.stylus
|
||||||
|
push:
|
||||||
|
- match: (?=$|;)
|
||||||
|
pop: true
|
||||||
|
- include: selector-components
|
||||||
|
- include: string-quoted
|
||||||
|
- include: escape
|
||||||
|
- include: language-constants
|
||||||
|
- include: language-operators
|
||||||
|
- include: language-keywords
|
||||||
|
- include: property-reference
|
||||||
|
- include: function-call
|
||||||
|
- match: '\{'
|
||||||
|
scope: punctuation.section.start.stylus
|
||||||
|
- match: '\}'
|
||||||
|
scope: punctuation.section.end.stylus
|
||||||
|
attribute-selector:
|
||||||
|
- match: '\[(?=[^\]]*\])'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.entity.start.stylus
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.attribute-selector.stylus
|
||||||
|
- match: '\]'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.entity.end.stylus
|
||||||
|
pop: true
|
||||||
|
- match: '(?<=\[)|(?<=\{)'
|
||||||
|
push:
|
||||||
|
- match: '(?=[|~=\]\s])'
|
||||||
|
pop: true
|
||||||
|
- include: interpolation
|
||||||
|
- match: .
|
||||||
|
captures:
|
||||||
|
0: entity.other.attribute-name.stylus
|
||||||
|
- include: interpolation
|
||||||
|
- match: "([|~]?=)"
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.stylus
|
||||||
|
- include: string-quoted
|
||||||
|
- match: .
|
||||||
|
captures:
|
||||||
|
0: string.unquoted.stylus
|
||||||
|
color-values:
|
||||||
|
- match: \b(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)\b
|
||||||
|
scope: constant.color.w3c-standard-color-name.stylus
|
||||||
|
- match: (hsla?|rgba?)\s*(\()
|
||||||
|
captures:
|
||||||
|
1: keyword.language.function.misc.stylus
|
||||||
|
2: punctuation.definition.parameters.start.stylus
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.parameters.end.stylus
|
||||||
|
pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x) # multi-line regex definition mode
|
||||||
|
\b
|
||||||
|
(?:0*((?:1?[0-9]{1,2})|(?:2(?:[0-4][0-9]|5[0-5])))\s*(,)\s*)
|
||||||
|
(?:0*((?:1?[0-9]{1,2})|(?:2(?:[0-4][0-9]|5[0-5])))\s*(,)\s*)
|
||||||
|
(?:0*((?:1?[0-9]{1,2})|(?:2(?:[0-4][0-9]|5[0-5])))\b)
|
||||||
|
captures:
|
||||||
|
1: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.red.stylus
|
||||||
|
2: punctuation.delimiter.comma.stylus
|
||||||
|
3: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.green.stylus
|
||||||
|
4: punctuation.delimiter.comma.stylus
|
||||||
|
5: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.blue.stylus
|
||||||
|
- match: |-
|
||||||
|
(?x) # multi-line regex definition mode
|
||||||
|
\b
|
||||||
|
((?:[0-9]{1,2}|100)%)(,) # red
|
||||||
|
\s*
|
||||||
|
((?:[0-9]{1,2}|100)%)(,) # green
|
||||||
|
\s*
|
||||||
|
((?:[0-9]{1,2}|100)%) # blue
|
||||||
|
captures:
|
||||||
|
1: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.red.stylus
|
||||||
|
2: punctuation.delimiter.comma.stylus
|
||||||
|
3: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.green.stylus
|
||||||
|
4: punctuation.delimiter.comma.stylus
|
||||||
|
5: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.blue.stylus
|
||||||
|
- match: |-
|
||||||
|
(?x) # multi-line regex definition mode
|
||||||
|
(?:\s*(,)\s*((0?\.[0-9]+)|[0-1]))?
|
||||||
|
captures:
|
||||||
|
1: punctuation.delimiter.comma.stylus
|
||||||
|
2: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.alpha.stylus
|
||||||
|
- include: numeric-values
|
||||||
|
- include: numeric-values
|
||||||
|
comma:
|
||||||
|
- match: \s*,\s*
|
||||||
|
scope: punctuation.delimiter.comma.stylus
|
||||||
|
comments:
|
||||||
|
- include: single-line-comment
|
||||||
|
- match: \/\*
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.stylus
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.stylus
|
||||||
|
- match: \*\/
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.stylus
|
||||||
|
pop: true
|
||||||
|
conditionals:
|
||||||
|
- match: '(^\s*|\s+)(if|unless|else)(?=[\s({]|$)\s*'
|
||||||
|
captures:
|
||||||
|
2: keyword.control.stylus
|
||||||
|
push:
|
||||||
|
- match: '(?=$|\{)'
|
||||||
|
pop: true
|
||||||
|
- include: expression
|
||||||
|
escape:
|
||||||
|
- match: \\.
|
||||||
|
scope: constant.character.escape.stylus
|
||||||
|
expression:
|
||||||
|
- include: single-line-comment
|
||||||
|
- include: comma
|
||||||
|
- include: iteration
|
||||||
|
- include: conditionals
|
||||||
|
- include: language-operators
|
||||||
|
- include: language-keywords
|
||||||
|
- include: hash-definition
|
||||||
|
- include: color-values
|
||||||
|
- include: url
|
||||||
|
- include: function-call
|
||||||
|
- include: string-quoted
|
||||||
|
- include: escape
|
||||||
|
- include: hash-access
|
||||||
|
- include: language-constants
|
||||||
|
- include: language-property-value-constants
|
||||||
|
- include: property-reference
|
||||||
|
- include: variable
|
||||||
|
function-call:
|
||||||
|
- match: '([\w$-]+)(\()'
|
||||||
|
captures:
|
||||||
|
1: entity.function-name.stylus
|
||||||
|
2: punctuation.definition.parameters.start.stylus
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.function-call.stylus
|
||||||
|
- match: (\))
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.parameters.end.stylus
|
||||||
|
pop: true
|
||||||
|
- include: expression
|
||||||
|
hash-access:
|
||||||
|
- match: '(?=[\w$-]+(?:\.|\[[^\]=]*\]))'
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.hash-access.stylus
|
||||||
|
- match: '(?=[^''''""\[\]\w.$-]|\s|$)'
|
||||||
|
pop: true
|
||||||
|
- match: \.
|
||||||
|
scope: punctuation.delimiter.hash.stylus
|
||||||
|
- match: '\['
|
||||||
|
scope: punctuation.definition.entity.start.stylus
|
||||||
|
- match: '\]'
|
||||||
|
scope: punctuation.definition.entity.end.stylus
|
||||||
|
- include: string-quoted
|
||||||
|
- include: variable
|
||||||
|
hash-definition:
|
||||||
|
- match: '\{'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.embedded.start.stylus
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.hash.stylus
|
||||||
|
- match: '\}'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.embedded.end.stylus
|
||||||
|
pop: true
|
||||||
|
- include: single-line-comment
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
(?:
|
||||||
|
([\w$-]+)
|
||||||
|
|
|
||||||
|
('[^']*')
|
||||||
|
|
|
||||||
|
("[^"]*")
|
||||||
|
)
|
||||||
|
\s*
|
||||||
|
(:)
|
||||||
|
\s*
|
||||||
|
captures:
|
||||||
|
1: support.type.property-name.stylus
|
||||||
|
2: string.quoted.single.stylus
|
||||||
|
3: string.quoted.double.stylus
|
||||||
|
4: punctuation.separator.key-value.stylus
|
||||||
|
push:
|
||||||
|
- match: '(;)|(?=\}|$)'
|
||||||
|
captures:
|
||||||
|
1: punctuation.terminator.statement.stylus
|
||||||
|
pop: true
|
||||||
|
- include: expression
|
||||||
|
interpolation:
|
||||||
|
- match: '\{'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.embedded.start.stylus
|
||||||
|
push:
|
||||||
|
- meta_scope: stylus.embedded.source
|
||||||
|
- match: '\}'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.embedded.end.stylus
|
||||||
|
pop: true
|
||||||
|
- include: expression
|
||||||
|
iteration:
|
||||||
|
- match: (^\s*|\s+)(for)\s+(?=.*?\s+in\s+)
|
||||||
|
captures:
|
||||||
|
2: keyword.control.stylus
|
||||||
|
push:
|
||||||
|
- match: '$|\{'
|
||||||
|
pop: true
|
||||||
|
- include: expression
|
||||||
|
language-constants:
|
||||||
|
- match: \b(true|false|null)\b
|
||||||
|
scope: constant.language.stylus
|
||||||
|
language-keywords:
|
||||||
|
- match: (\b|\s)(return|else)\b
|
||||||
|
scope: keyword.control.stylus
|
||||||
|
- match: (\b|\s)(!important|in|is defined|is a)\b
|
||||||
|
scope: keyword.other.stylus
|
||||||
|
- match: \barguments\b
|
||||||
|
scope: variable.language.stylus
|
||||||
|
language-operators:
|
||||||
|
- match: ((?:\?|:|!|~|\+|-|(?:\*)?\*|\/|%|(\.)?\.\.|<|>|(?:=|:|\?|\+|-|\*|\/|%|<|>)?=|!=)|\b(?:in|is(?:nt)?|(?<!:)not)\b)
|
||||||
|
scope: keyword.operator.stylus
|
||||||
|
language-property-value-constants:
|
||||||
|
- match: \b(absolute|all(-scroll)?|always|armenian|auto|avoid|baseline|below|bidi-override|block|bold(er)?|(border|content|padding)-box|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|crosshair|cursive|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fantasy|fixed|geometricPrecision|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|monospace|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|optimize(Legibility|Quality|Speed)|outset|outside|overline|pointer|pre(-(wrap|line))?|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|(sans-)?serif|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|sub|super|sw-resize|table(-(row|cell|footer-group|header-group))?|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical(-(ideographic|text))?|visible(Painted|Fill|Stroke)?|w-resize|wait|whitespace|zero|smaller|larger|((xx?-)?(small(er)?|large(r)?))|painted|fill|stroke)\b
|
||||||
|
scope: constant.property-value.stylus
|
||||||
|
media-query:
|
||||||
|
- match: '\s*(?![{;]|$)'
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.at-rule.media.stylus
|
||||||
|
- match: '\s*(?=[{;]|$)'
|
||||||
|
pop: true
|
||||||
|
- match: '(?i)\s*(only|not)?\s*(all|aural|braille|embossed|handheld|print|projection|screen|tty|tv)?(?![\w\d$-]+)'
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.logic.media.stylus
|
||||||
|
2: support.constant.media.stylus
|
||||||
|
push:
|
||||||
|
- match: '\s*(?:(,)|(?=[{;]|$))'
|
||||||
|
pop: true
|
||||||
|
- include: media-query-list
|
||||||
|
- include: variable
|
||||||
|
media-query-list:
|
||||||
|
- match: \s*(and)?\s*(\()\s*
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.logic.media.stylus
|
||||||
|
2: punctuation.definition.parameters.start.stylus
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.parameters.end.stylus
|
||||||
|
pop: true
|
||||||
|
- include: media-query-properties
|
||||||
|
- include: numeric-values
|
||||||
|
media-query-properties:
|
||||||
|
- match: \s*:\s*
|
||||||
|
captures:
|
||||||
|
0: punctuation.separator.key-value.stylus
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
(
|
||||||
|
((min|max)-)?
|
||||||
|
(
|
||||||
|
((device-)?(height|width|aspect-ratio))|
|
||||||
|
(color(-index)?)|monochrome|resolution
|
||||||
|
)
|
||||||
|
)|grid|scan|orientation
|
||||||
|
captures:
|
||||||
|
0: support.type.property-name.media.stylus
|
||||||
|
- match: \b(portrait|landscape|progressive|interlace)\b
|
||||||
|
captures:
|
||||||
|
1: support.constant.property-value.stylus
|
||||||
|
numeric-values:
|
||||||
|
- match: |-
|
||||||
|
(?x) # multi-line regex definition mode
|
||||||
|
(\#)(?:
|
||||||
|
([0-9a-fA-F])
|
||||||
|
([0-9a-fA-F])
|
||||||
|
([0-9a-fA-F])
|
||||||
|
([0-9a-fA-F])?
|
||||||
|
| ([0-9a-fA-F]{2})
|
||||||
|
([0-9a-fA-F]{2})
|
||||||
|
([0-9a-fA-F]{2})
|
||||||
|
([0-9a-fA-F]{2})?
|
||||||
|
)\b
|
||||||
|
scope: constant.other.color.rgb-value.stylus
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.constant.stylus
|
||||||
|
2: constant.other.color.rgb-value.red.stylus
|
||||||
|
3: constant.other.color.rgb-value.green.stylus
|
||||||
|
4: constant.other.color.rgb-value.blue.stylus
|
||||||
|
5: constant.other.color.rgb-value.alpha.stylus
|
||||||
|
6: constant.other.color.rgb-value.red.stylus
|
||||||
|
7: constant.other.color.rgb-value.green.stylus
|
||||||
|
8: constant.other.color.rgb-value.blue.stylus
|
||||||
|
9: constant.other.color.rgb-value.alpha.stylus
|
||||||
|
- match: |-
|
||||||
|
(?x) # multi-line regex definition mode
|
||||||
|
(?:-|\+)? # negative / positive
|
||||||
|
(?:
|
||||||
|
(?:
|
||||||
|
[0-9]+ # integer part
|
||||||
|
(?:\.[0-9]+)? # fraction
|
||||||
|
) |
|
||||||
|
(?:\.[0-9]+) # fraction without leading zero
|
||||||
|
)
|
||||||
|
((?: # units
|
||||||
|
px|pt|ch|cm|mm|in|
|
||||||
|
r?em|ex|pc|vw|vh|vmin|vmax|deg|
|
||||||
|
g?rad|turn|dpi|dpcm|dppx|m?s|k?Hz
|
||||||
|
)\b|%)?
|
||||||
|
scope: constant.numeric.stylus
|
||||||
|
captures:
|
||||||
|
1: keyword.other.unit.stylus
|
||||||
|
property-reference:
|
||||||
|
- match: "@[a-z-]+"
|
||||||
|
scope: variable.other.property.stylus
|
||||||
|
pseudo:
|
||||||
|
- match: (:)(active|checked|default|disabled|empty|enabled|first-child|first-of-type|first|fullscreen|focus|hover|indeterminate|in-range|invalid|last-child|last-of-type|left|link|only-child|only-of-type|optional|out-of-range|read-only|read-write|required|right|root|scope|target|valid|visited)\b
|
||||||
|
scope: entity.other.attribute-name.pseudo-class.stylus
|
||||||
|
captures:
|
||||||
|
1: puncutation.definition.entity.stylus
|
||||||
|
- match: (:?:)(before|after)\b
|
||||||
|
scope: entity.other.attribute-name.pseudo-element.stylus
|
||||||
|
captures:
|
||||||
|
1: puncutation.definition.entity.stylus
|
||||||
|
- match: (::)(first-letter|first-number|selection)\b
|
||||||
|
scope: entity.other.attribute-name.pseudo-element.stylus
|
||||||
|
captures:
|
||||||
|
1: puncutation.definition.entity.stylus
|
||||||
|
- match: ((:)dir)\s*(?:(\()(ltr|rtl)?(\)))?
|
||||||
|
captures:
|
||||||
|
1: entity.other.attribute-name.pseudo-element.stylus
|
||||||
|
2: puncutation.definition.entity.stylus
|
||||||
|
3: puncutation.definition.parameters.start.stylus
|
||||||
|
4: constant.language.stylus
|
||||||
|
5: puncutation.definition.parameters.end.stylus
|
||||||
|
- match: ((:)lang)\s*(?:(\()(\w+(-\w+)?)?(\)))?
|
||||||
|
captures:
|
||||||
|
1: entity.other.attribute-name.pseudo-element.stylus
|
||||||
|
2: puncutation.definition.entity.stylus
|
||||||
|
3: puncutation.definition.parameters.start.stylus
|
||||||
|
4: constant.language.stylus
|
||||||
|
5: puncutation.definition.parameters.end.stylus
|
||||||
|
- include: pseudo-nth
|
||||||
|
- include: pseudo-not
|
||||||
|
pseudo-not:
|
||||||
|
- match: ((:)not)\s*(\()
|
||||||
|
captures:
|
||||||
|
1: entity.other.attribute-name.pseudo-element.stylus
|
||||||
|
2: puncutation.definition.entity.stylus
|
||||||
|
3: puncutation.definition.parameters.start.stylus
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: puncutation.definition.parameters.end.stylus
|
||||||
|
pop: true
|
||||||
|
- include: selector-components
|
||||||
|
pseudo-nth:
|
||||||
|
- match: ((:)(?:nth-child|nth-last-child|nth-of-type|nth-last-of-type|nth-match|nth-last-match|nth-column|nth-last-column))\s*(\()
|
||||||
|
captures:
|
||||||
|
1: entity.other.attribute-name.pseudo-class.stylus
|
||||||
|
2: puncutation.definition.entity.stylus
|
||||||
|
3: puncutation.definition.parameters.start.stylus
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: puncutation.definition.parameters.end.stylus
|
||||||
|
pop: true
|
||||||
|
- include: language-operators
|
||||||
|
- include: interpolation
|
||||||
|
- match: \b(odd|even)\b
|
||||||
|
scope: constant.language.stylus
|
||||||
|
- match: \b(\d+)?n\b
|
||||||
|
scope: variable.language.stylus
|
||||||
|
captures:
|
||||||
|
1: constant.numeric.stylus
|
||||||
|
- match: \d+
|
||||||
|
scope: constant.numeric.stylus
|
||||||
|
return:
|
||||||
|
- match: ^\s*(return)
|
||||||
|
captures:
|
||||||
|
1: keyword.control.stylus
|
||||||
|
push:
|
||||||
|
- match: (;)|(?=$)
|
||||||
|
captures:
|
||||||
|
1: punctuation.terminator.statement.stylus
|
||||||
|
pop: true
|
||||||
|
- include: expression
|
||||||
|
selector-components:
|
||||||
|
- include: comments
|
||||||
|
- include: interpolation
|
||||||
|
- include: attribute-selector
|
||||||
|
- include: pseudo
|
||||||
|
- match: '\$[\w$-]+\b'
|
||||||
|
scope: entity.other.placeholder.stylus
|
||||||
|
- match: "[:~>]"
|
||||||
|
scope: keyword.operator.selector.stylus
|
||||||
|
- match: |-
|
||||||
|
(?x) # multi-line regex definition mode
|
||||||
|
\b(
|
||||||
|
altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|
|
||||||
|
animateMotion|animateTransform|circle|clipPath|color-profile|
|
||||||
|
defs|desc|ellipse|feBlend|feColorMatrix|
|
||||||
|
feComponentTransfer|feComposite|feConvolveMatrix|
|
||||||
|
feDiffuseLighting|feDisplacementMap|feDistantLight|feFlood|
|
||||||
|
feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|
|
||||||
|
feMergeNode|feMorphology|feOffset|fePointLight|
|
||||||
|
feSpecularLighting|feSpotLight|feTile|feTurbulence|filter|
|
||||||
|
font-face|font-face-format|font-face-name|font-face-src|
|
||||||
|
font-face-uri|foreignObject|g|glyph|glyphRef|hkern|image|line|
|
||||||
|
linearGradient|marker|mask|metadata|missing-glyph|mpath|path|
|
||||||
|
pattern|polygon|polyline|radialGradient|rect|set|stop|svg|
|
||||||
|
switch|symbol|text|textPath|tref|tspan|use|view|vkern|
|
||||||
|
a|abbr|acronym|address|applet|area|article|aside|audio|b|base|
|
||||||
|
basefont|bdi|bdo|bgsound|big|blink|blockquote|body|br|button|
|
||||||
|
canvas|caption|center|cite|code|col|colgroup|content|data|
|
||||||
|
datalist|dd|decorator|del|details|dfn|dir|div|dl|dt|element|
|
||||||
|
em|embed|fieldset|figcaption|figure|font|footer|form|frame|
|
||||||
|
frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|
|
||||||
|
img|input|ins|isindex|kbd|keygen|label|legend|li|link|listing|
|
||||||
|
main|map|mark|marquee|menu|menuitem|meta|meter|nav|nobr|
|
||||||
|
noframes|noscript|object|ol|optgroup|option|output|p|param|
|
||||||
|
plaintext|pre|progress|q|rp|rt|ruby|s|samp|script|section|
|
||||||
|
select|shadow|small|source|spacer|span|strike|strong|style|
|
||||||
|
sub|summary|sup|table|tbody|td|template|textarea|tfoot|th|
|
||||||
|
thead|time|title|tr|track|tt|u|ul|var|video|wbr|xmp
|
||||||
|
)\b
|
||||||
|
scope: entity.name.tag.stylus
|
||||||
|
- match: '\.[a-zA-Z0-9_-]+'
|
||||||
|
scope: entity.other.attribute-name.class.stylus
|
||||||
|
- match: "#[a-zA-Z0-9_-]+"
|
||||||
|
scope: entity.other.attribute-name.id.stylus
|
||||||
|
- match: |-
|
||||||
|
(?x) # multi-line regex definition mode
|
||||||
|
([\w\d_-]+)? # matching any word right before &
|
||||||
|
(&) # & itself, escaped because of plist
|
||||||
|
([\w\d_-]+)? # matching any word right after &
|
||||||
|
captures:
|
||||||
|
1: entity.other.attribute-name.stylus
|
||||||
|
2: variable.language.stylus
|
||||||
|
3: entity.other.attribute-name.stylus
|
||||||
|
single-line-comment:
|
||||||
|
- match: (\/\/).*$
|
||||||
|
scope: comment.line.stylus
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.stylus
|
||||||
|
string-quoted:
|
||||||
|
- match: "'[^']*'"
|
||||||
|
scope: string.quoted.single.stylus
|
||||||
|
- match: '"[^"]*"'
|
||||||
|
scope: string.quoted.double.stylus
|
||||||
|
url:
|
||||||
|
- match: (url)\s*(\()
|
||||||
|
captures:
|
||||||
|
1: entity.function-name.stylus
|
||||||
|
2: punctuation.definition.parameters.start.stylus
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.function-call.stylus
|
||||||
|
- match: (\))
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.parameters.end.stylus
|
||||||
|
pop: true
|
||||||
|
- include: string-quoted
|
||||||
|
- include: language-constants
|
||||||
|
- include: language-property-value-constants
|
||||||
|
- include: property-reference
|
||||||
|
- include: variable
|
||||||
|
variable:
|
||||||
|
- match: '([\w$-]+\b)'
|
||||||
|
scope: variable.other.stylus
|
||||||
+1
Submodule assets/syntaxes/02_Extra/Svelte added at bf92f5b7b6
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Terraform updated: 64208ea816...54d8350c3c
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/TypeScript updated: 9cd994af73...603ebb48b1
+63
-35
@@ -9,10 +9,7 @@ contexts:
|
|||||||
main:
|
main:
|
||||||
- include: directives
|
- include: directives
|
||||||
- include: statements
|
- include: statements
|
||||||
- match: \A(#!).*(?=$)
|
- include: shebang
|
||||||
scope: comment.line.shebang.ts
|
|
||||||
captures:
|
|
||||||
1: punctuation.definition.comment.ts
|
|
||||||
comment:
|
comment:
|
||||||
- match: /\*\*(?!/)
|
- match: /\*\*(?!/)
|
||||||
captures:
|
captures:
|
||||||
@@ -120,7 +117,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -815,7 +812,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -856,7 +853,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -918,7 +915,7 @@ contexts:
|
|||||||
captures:
|
captures:
|
||||||
1: keyword.control.as.ts
|
1: keyword.control.as.ts
|
||||||
push:
|
push:
|
||||||
- match: '(?=$|^|[;,:})\]]|\|\||\&\&|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+)|(\s+\<))'
|
- match: '(?=^|[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+)|(\s+\<))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: type
|
- include: type
|
||||||
- match: \.\.\.
|
- match: \.\.\.
|
||||||
@@ -933,7 +930,7 @@ contexts:
|
|||||||
scope: keyword.operator.comparison.ts
|
scope: keyword.operator.comparison.ts
|
||||||
- match: <=|>=|<>|<|>
|
- match: <=|>=|<>|<|>
|
||||||
scope: keyword.operator.relational.ts
|
scope: keyword.operator.relational.ts
|
||||||
- match: '(\!)\s*(/)(?![/*])'
|
- match: '(?<=[_$[:alnum:]])(\!)\s*(/)(?![/*])'
|
||||||
captures:
|
captures:
|
||||||
1: keyword.operator.logical.ts
|
1: keyword.operator.logical.ts
|
||||||
2: keyword.operator.arithmetic.ts
|
2: keyword.operator.arithmetic.ts
|
||||||
@@ -1038,7 +1035,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -1079,7 +1076,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -1125,25 +1122,42 @@ contexts:
|
|||||||
- match: \*
|
- match: \*
|
||||||
scope: keyword.generator.asterisk.ts
|
scope: keyword.generator.asterisk.ts
|
||||||
function-call:
|
function-call:
|
||||||
- match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()'
|
- match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||||
push:
|
push:
|
||||||
- match: '(?<=\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()'
|
- match: '(?<=\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
|
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.function-call.ts
|
- meta_scope: meta.function-call.ts
|
||||||
- match: '(?=\s*(?:(\?\.\s*)|(\!))?(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()'
|
- match: '(?=\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||||
pop: true
|
pop: true
|
||||||
- include: support-function-call-identifiers
|
- include: function-call-target
|
||||||
- match: '(\#?[_$[:alpha:]][_$[:alnum:]]*)'
|
|
||||||
scope: entity.name.function.ts
|
|
||||||
- include: comment
|
- include: comment
|
||||||
- match: \?\.
|
- include: function-call-optionals
|
||||||
scope: meta.function-call.ts punctuation.accessor.optional.ts
|
|
||||||
- match: \!
|
|
||||||
scope: meta.function-call.ts keyword.operator.definiteassignment.ts
|
|
||||||
- include: type-arguments
|
- include: type-arguments
|
||||||
- include: paren-expression
|
- include: paren-expression
|
||||||
|
- match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$))'
|
||||||
|
push:
|
||||||
|
- match: '(?<=\>)(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$))'
|
||||||
|
pop: true
|
||||||
|
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.function-call.ts
|
||||||
|
- match: '(?=(<\s*[\{\[\(]\s*$))'
|
||||||
|
pop: true
|
||||||
|
- include: function-call-target
|
||||||
|
- include: comment
|
||||||
|
- include: function-call-optionals
|
||||||
|
- include: type-arguments
|
||||||
|
function-call-optionals:
|
||||||
|
- match: \?\.
|
||||||
|
scope: meta.function-call.ts punctuation.accessor.optional.ts
|
||||||
|
- match: \!
|
||||||
|
scope: meta.function-call.ts keyword.operator.definiteassignment.ts
|
||||||
|
function-call-target:
|
||||||
|
- include: support-function-call-identifiers
|
||||||
|
- match: '(\#?[_$[:alpha:]][_$[:alnum:]]*)'
|
||||||
|
scope: entity.name.function.ts
|
||||||
function-declaration:
|
function-declaration:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s*'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s*'
|
||||||
captures:
|
captures:
|
||||||
@@ -1221,7 +1235,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -1431,7 +1445,7 @@ contexts:
|
|||||||
captures:
|
captures:
|
||||||
1: keyword.operator.expression.instanceof.ts
|
1: keyword.operator.expression.instanceof.ts
|
||||||
push:
|
push:
|
||||||
- match: '(?<=\))|(?=[;),}\]:?]|\|\||\&\&|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
- match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|(([\&\~\^\|]\s*)?[_$[:alpha:]][_$[:alnum:]]*\s+instanceof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: type
|
- include: type
|
||||||
interface-declaration:
|
interface-declaration:
|
||||||
@@ -1582,7 +1596,7 @@ contexts:
|
|||||||
1: keyword.operator.new.ts
|
1: keyword.operator.new.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: new.expr.ts
|
- meta_scope: new.expr.ts
|
||||||
- match: '(?<=\))|(?=[;),}\]:\-\+]|\|\||\&\&|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
- match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: paren-expression
|
- include: paren-expression
|
||||||
- include: class-declaration
|
- include: class-declaration
|
||||||
@@ -1864,7 +1878,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -1900,7 +1914,7 @@ contexts:
|
|||||||
1: keyword.control.as.ts
|
1: keyword.control.as.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.object.member.ts
|
- meta_scope: meta.object.member.ts
|
||||||
- match: '(?=$|^|[,}]|\|\||\&\&|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+))'
|
- match: '(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|^|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: type
|
- include: type
|
||||||
- match: '(?=[_$[:alpha:]][_$[:alnum:]]*\s*=)'
|
- match: '(?=[_$[:alpha:]][_$[:alnum:]]*\s*=)'
|
||||||
@@ -2010,7 +2024,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -2051,7 +2065,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -2313,6 +2327,11 @@ contexts:
|
|||||||
- include: type-object
|
- include: type-object
|
||||||
- include: type-predicate-operator
|
- include: type-predicate-operator
|
||||||
- include: type
|
- include: type
|
||||||
|
shebang:
|
||||||
|
- match: \A(#!).*(?=$)
|
||||||
|
scope: comment.line.shebang.ts
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.ts
|
||||||
single-line-comment-consuming-line-ending:
|
single-line-comment-consuming-line-ending:
|
||||||
- match: '(^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?)'
|
- match: '(^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?)'
|
||||||
captures:
|
captures:
|
||||||
@@ -2684,20 +2703,20 @@ contexts:
|
|||||||
0: case-clause.expr.ts punctuation.definition.section.case-statement.ts
|
0: case-clause.expr.ts punctuation.definition.section.case-statement.ts
|
||||||
- include: statements
|
- include: statements
|
||||||
template:
|
template:
|
||||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.template.ts
|
- meta_scope: string.template.ts
|
||||||
- match: (?=`)
|
- match: (?=`)
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
|
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
|
||||||
push:
|
push:
|
||||||
- match: '(?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
- match: '(?=(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
||||||
pop: true
|
pop: true
|
||||||
- include: support-function-call-identifiers
|
- include: support-function-call-identifiers
|
||||||
- match: "([_$[:alpha:]][_$[:alnum:]]*)"
|
- match: "([_$[:alpha:]][_$[:alnum:]]*)"
|
||||||
scope: entity.name.function.tagged-template.ts
|
scope: entity.name.function.tagged-template.ts
|
||||||
- include: type-arguments
|
- include: type-arguments
|
||||||
- match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)`)'
|
- match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)`)'
|
||||||
captures:
|
captures:
|
||||||
1: entity.name.function.tagged-template.ts
|
1: entity.name.function.tagged-template.ts
|
||||||
push:
|
push:
|
||||||
@@ -2974,6 +2993,8 @@ contexts:
|
|||||||
scope: keyword.operator.ternary.ts
|
scope: keyword.operator.ternary.ts
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))infer(?=\s+[_$[:alpha:]])'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))infer(?=\s+[_$[:alpha:]])'
|
||||||
scope: keyword.operator.expression.infer.ts
|
scope: keyword.operator.expression.infer.ts
|
||||||
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))awaited(?=\s+[_$[:alpha:]])'
|
||||||
|
scope: keyword.operator.expression.awaited.ts
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\()'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\()'
|
||||||
scope: keyword.operator.expression.import.ts
|
scope: keyword.operator.expression.import.ts
|
||||||
type-parameters:
|
type-parameters:
|
||||||
@@ -3063,6 +3084,13 @@ contexts:
|
|||||||
captures:
|
captures:
|
||||||
0: meta.brace.square.ts
|
0: meta.brace.square.ts
|
||||||
pop: true
|
pop: true
|
||||||
|
- match: \.\.\.
|
||||||
|
scope: keyword.operator.rest.ts
|
||||||
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))([_$[:alpha:]][_$[:alnum:]]*)\s*(\?)?\s*(:)'
|
||||||
|
captures:
|
||||||
|
1: entity.name.label.ts
|
||||||
|
2: keyword.operator.optional.ts
|
||||||
|
3: punctuation.separator.label.ts
|
||||||
- include: type
|
- include: type
|
||||||
- include: punctuation-comma
|
- include: punctuation-comma
|
||||||
typeof-operator:
|
typeof-operator:
|
||||||
@@ -3159,7 +3187,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -3200,7 +3228,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -3246,7 +3274,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
@@ -3287,7 +3315,7 @@ contexts:
|
|||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ file_extensions:
|
|||||||
scope: whitespace
|
scope: whitespace
|
||||||
contexts:
|
contexts:
|
||||||
main:
|
main:
|
||||||
- match: "•"
|
- match: "·"
|
||||||
scope: support.function.show-nonprintable.space
|
scope: support.function.show-nonprintable.space
|
||||||
- match: "├─*┤"
|
- match: "├─*┤"
|
||||||
scope: constant.character.escape.show-nonprintable.tab
|
scope: constant.character.escape.show-nonprintable.tab
|
||||||
|
|||||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/ssh-config updated: 16e19d5da4...1ddcb320ac
+151
@@ -0,0 +1,151 @@
|
|||||||
|
# SYNTAX TEST "Manpage.sublime-syntax"
|
||||||
|
SOMETHING(8) System Manager's Manual SOMETHING(8)
|
||||||
|
# ^^^^^ meta.preprocessor
|
||||||
|
# ^^^^^^^^^^^^^^^^^^^^^^^ markup.heading.title
|
||||||
|
# ^^^^^^^ meta.preprocessor
|
||||||
|
|
||||||
|
NAME
|
||||||
|
#^^^ markup.heading.other
|
||||||
|
example - do something useful
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
example [options] [--home DIR] [--shell SHELL] [--no-create-home]
|
||||||
|
# ^ punctuation.section.brackets.begin
|
||||||
|
# ^^^^^^ entity.name.command-line-option
|
||||||
|
# ^^^ variable.parameter
|
||||||
|
# ^ punctuation.section.brackets.end
|
||||||
|
# ^ punctuation.section.brackets.begin
|
||||||
|
# ^^^^^^^ entity.name.command-line-option
|
||||||
|
# ^^^^^ variable.parameter
|
||||||
|
# ^ punctuation.section.brackets.end
|
||||||
|
# ^ punctuation.section.brackets.begin
|
||||||
|
# ^^^^^^^^^^^^^^^^ entity.name.command-line-option
|
||||||
|
# ^ punctuation.section.brackets.end
|
||||||
|
[-u | --set-upstream] [-o <string> | --push-option=<string>]
|
||||||
|
# ^ punctuation.section.brackets.begin
|
||||||
|
# ^^ entity.name.command-line-option
|
||||||
|
# ^ keyword.operator.logical
|
||||||
|
# ^^^^^^^^^^^^^^ entity.name.command-line-option
|
||||||
|
# ^ punctuation.section.brackets.end
|
||||||
|
# ^^^^^^^^^^^^^ entity.name.command-line-option
|
||||||
|
[--force-with-lease[=<refname>[:<expect>]]]
|
||||||
|
# ^ punctuation.section.brackets.begin
|
||||||
|
# ^^^^^^^^^^^^^^^^^^ entity.name.command-line-option
|
||||||
|
# ^ punctuation.section.brackets.begin
|
||||||
|
# ^ keyword.operator
|
||||||
|
# ^^^^^^^ variable.parameter
|
||||||
|
# ^ punctuation.section.brackets.begin
|
||||||
|
# ^^^^^^ variable.parameter
|
||||||
|
# ^^^ punctuation.section.brackets.end
|
||||||
|
|
||||||
|
example --system [options]
|
||||||
|
# ^^^^^^^^ entity.name
|
||||||
|
|
||||||
|
COMMON OPTIONS
|
||||||
|
[--quiet] [--debug] [--help|-h] [--version] [--conf FILE]
|
||||||
|
|
||||||
|
/* According to POSIX.1-2001, POSIX.1-2008 */
|
||||||
|
# ^^ source.c comment.block punctuation.definition.comment
|
||||||
|
#include <sys/select.h>
|
||||||
|
# ^^^^^^^^ source.c meta.preprocessor.include keyword.control.import.include
|
||||||
|
struct timeval {
|
||||||
|
# ^^^^^^ source.c storage.type
|
||||||
|
|
||||||
|
time_t tv_sec; /* seconds */
|
||||||
|
suseconds_t tv_usec; /* microseconds */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
example does something useful in relation to the command line options
|
||||||
|
and configuration information in /etc/example.conf.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
--conf FILE
|
||||||
|
# ^^^^^^ entity.name.command-line-option
|
||||||
|
#^^^^^^ - variable - entity - markup
|
||||||
|
# ^^^^ variable.parameter
|
||||||
|
Use FILE instead of /etc/example.conf.
|
||||||
|
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - variable - entity
|
||||||
|
|
||||||
|
--disabled-login
|
||||||
|
Do not run passwd to set the password. The user won't be able
|
||||||
|
to use her account until the password is set.
|
||||||
|
|
||||||
|
--disabled-password
|
||||||
|
Like --disabled-login, but logins are still possible (for exam-
|
||||||
|
# ^^^^^^^^^^^^^^^^ entity.name
|
||||||
|
#^^^^^^^^^^^^^^^^^^ - entity - variable - markup
|
||||||
|
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - entity - variable - markup
|
||||||
|
ple using SSH RSA keys) but not using password authentication.
|
||||||
|
|
||||||
|
--help Display brief instructions.
|
||||||
|
# ^^^^^^ entity.name.command-line-option
|
||||||
|
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - variable.parameter
|
||||||
|
|
||||||
|
--home DIR
|
||||||
|
# ^^^^^^ entity.name.command-line-option
|
||||||
|
# ^^^ variable.parameter
|
||||||
|
# ^ - variable - entity - markup
|
||||||
|
Use DIR as the user's home directory, rather than the default
|
||||||
|
specified by the configuration file. If the directory does not
|
||||||
|
exist, it is created and skeleton files are copied.
|
||||||
|
|
||||||
|
--[no-]signed, --signed=(true|false|if-asked)
|
||||||
|
# ^^^^^^^^^^^^^ entity.name.command-line-option
|
||||||
|
# ^ punctuation.separator
|
||||||
|
# ^^^^^^^^ entity.name.command-line-option
|
||||||
|
# ^ keyword.operator
|
||||||
|
# ^ - variable
|
||||||
|
# ^^^^ variable.parameter
|
||||||
|
# ^ keyword.operator.logical
|
||||||
|
# ^^^^^ variable.parameter
|
||||||
|
# ^ keyword.operator.logical
|
||||||
|
# ^^^^^^^^ variable.parameter
|
||||||
|
# ^ - variable
|
||||||
|
--no-recurse-submodules, --recurse-submodules=check|on-demand|only|no
|
||||||
|
# ^^^^^^^^^^^^^^^^^^^^^^^ entity.name.command-line-option
|
||||||
|
# ^ punctuation.separator
|
||||||
|
# ^^^^^^^^^^^^^^^^^^^^ entity.name.command-line-option
|
||||||
|
# ^ keyword.operator
|
||||||
|
# ^^^^^ variable.parameter
|
||||||
|
# ^ keyword.operator.logical
|
||||||
|
# ^^^^^^^^^ variable.parameter
|
||||||
|
# ^ keyword.operator.logical
|
||||||
|
# ^^^^ variable.parameter
|
||||||
|
# ^ keyword.operator.logical
|
||||||
|
# ^^ variable.parameter
|
||||||
|
May be used to make sure all submodule commits used by the
|
||||||
|
|
||||||
|
-c, -C NUM, --context[=NUM]
|
||||||
|
# ^^ entity.name.command-line-option
|
||||||
|
# ^ punctuation.separator
|
||||||
|
# ^^ entity.name.command-line-option
|
||||||
|
# ^^^ variable.parameter
|
||||||
|
# ^ punctuation.separator
|
||||||
|
# ^^^^^^^^^ entity.name.command-line-option
|
||||||
|
# ^^^^^^^ - entity.name
|
||||||
|
# ^ keyword.operator
|
||||||
|
# ^^^ variable.parameter
|
||||||
|
# ^^ - variable
|
||||||
|
output NUM (default 3) lines of copied context
|
||||||
|
|
||||||
|
EXAMPLE
|
||||||
|
#include <stdio.h>
|
||||||
|
# ^^^^^^^^ source.c meta.preprocessor.include keyword.control.import.include
|
||||||
|
|
||||||
|
(This is not C code.)
|
||||||
|
# ^^^^^^^^^^^^^^^^^^^^^^ - source.c
|
||||||
|
|
||||||
|
struct timeval {
|
||||||
|
time_t tv_sec; /* seconds */
|
||||||
|
suseconds_t tv_usec; /* microseconds */
|
||||||
|
};
|
||||||
|
# ^ source.c punctuation.terminator
|
||||||
|
|
||||||
|
The corresponding argument for pselect() has the following type:
|
||||||
|
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - source.c
|
||||||
|
#define POLLIN_SET (EPOLLRDNORM | EPOLLRDBAND | EPOLLIN |
|
||||||
|
EPOLLHUP | EPOLLERR)
|
||||||
|
# ^ source.c meta.preprocessor.macro meta.group punctuation.section.group.end
|
||||||
Vendored
BIN
Binary file not shown.
+1
Submodule assets/themes/Coldark added at b4a1c74d8d
+1
Submodule assets/themes/Solarized added at 87e01090cf
Vendored
+551
@@ -0,0 +1,551 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<!--
|
||||||
|
Most base16 users should use the base16 theme. This theme, base16-256,
|
||||||
|
is for users who configure their terminal with a 256-color variant of a
|
||||||
|
base16 theme, and who use base16-shell. DO NOT use this theme simply
|
||||||
|
because your terminal supports 256 colors.
|
||||||
|
|
||||||
|
base16: https://github.com/chriskempson/base16
|
||||||
|
base16-shell: https://github.com/chriskempson/base16-shell
|
||||||
|
|
||||||
|
The colors in this theme are encoded as #RRGGBBAA where RR is an ANSI
|
||||||
|
palette number from 00 to ff (the 256 terminal colors), and AA is the
|
||||||
|
special value 00 to indicate this encoding is being used.
|
||||||
|
-->
|
||||||
|
<key>author</key>
|
||||||
|
<string>Template: Chris Kempson, Scheme: Mitchell Kember</string>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Base16 256</string>
|
||||||
|
<key>colorSpaceName</key>
|
||||||
|
<string>sRGB</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#00000000</string>
|
||||||
|
<key>caret</key>
|
||||||
|
<string>#07000000</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#07000000</string>
|
||||||
|
<key>invisibles</key>
|
||||||
|
<string>#08000000</string>
|
||||||
|
<key>lineHighlight</key>
|
||||||
|
<string>#08000000</string>
|
||||||
|
<key>selection</key>
|
||||||
|
<string>#13000000</string>
|
||||||
|
<key>gutter</key>
|
||||||
|
<string>#12000000</string>
|
||||||
|
<key>gutterForeground</key>
|
||||||
|
<string>#08000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Text</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>variable.parameter.function</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#07000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Comments</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>comment, punctuation.definition.comment</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#08000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Punctuation</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#07000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Delimiters</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>none</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#07000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Operators</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>keyword.operator</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#07000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Keywords</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>keyword</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#05000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Variables</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>variable</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#07000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Functions</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.function, meta.require, support.function.any-method</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#04000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Labels</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.label</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#11000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Classes</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>support.class, entity.name.class, entity.name.type.class</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#03000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Classes</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.class</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#0f000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Methods</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>keyword.other.special-method</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#04000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Storage</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>storage</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#05000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Support</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>support.function</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#06000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Strings, Inherited Class</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>string, constant.other.symbol, entity.other.inherited-class</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#02000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Integers</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant.numeric</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#10000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Floats</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>none</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#10000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>none</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#10000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Constants</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#10000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Tags</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.tag</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#01000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Attributes</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.other.attribute-name</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#10000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Attribute IDs</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.other.attribute-name.id, punctuation.definition.entity</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#04000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Selector</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.selector</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#05000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Values</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>none</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#10000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Headings</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.heading punctuation.definition.heading, entity.name.section</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#04000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Units</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>keyword.other.unit</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#10000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Bold</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.bold, punctuation.definition.bold</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>bold</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#03000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Italic</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.italic, punctuation.definition.italic</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#05000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Code</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.raw.inline</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#02000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Link Text</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>string.other.link, punctuation.definition.string.end.markdown, punctuation.definition.string.begin.markdown</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#01000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Link Url</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.link</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#10000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Quotes</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.quote</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#10000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Separator</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.separator</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#13000000</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#07000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Inserted</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.inserted</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#02000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Deleted</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.deleted</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#01000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Changed</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.changed</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#05000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Colors</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant.other.color</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#06000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Regular Expressions</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>string.regexp</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#06000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Escape Characters</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant.character.escape</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#06000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Embedded</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>punctuation.section.embedded, variable.interpolation</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#05000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Illegal</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>invalid.illegal</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#01000000</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#0f000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Broken</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>invalid.broken</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#10000000</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#00000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Deprecated</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>invalid.deprecated</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#11000000</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#0f000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Unimplemented</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>invalid.unimplemented</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#08000000</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#0f000000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>uuid</key>
|
||||||
|
<string>uuid</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
Vendored
+9
-2
@@ -3,9 +3,16 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<!--
|
<!--
|
||||||
|
This theme is meant for users who configure their terminal with a base16
|
||||||
|
color theme. If you use a 256-color variant along with base16-shell, use
|
||||||
|
the bat theme base16-256 instead.
|
||||||
|
|
||||||
|
base16: https://github.com/chriskempson/base16
|
||||||
|
base16-shell: https://github.com/chriskempson/base16-shell
|
||||||
|
|
||||||
The colors in this theme are encoded as #RRGGBBAA where RR is an ANSI
|
The colors in this theme are encoded as #RRGGBBAA where RR is an ANSI
|
||||||
palette number from 00 to 0f, and AA is the special value 00 to indicate
|
palette number from 00 to 0f (the 8 colors and their bright versions),
|
||||||
that this encoding is being used.
|
and AA is the special value 00 to indicate this encoding is being used.
|
||||||
-->
|
-->
|
||||||
<key>author</key>
|
<key>author</key>
|
||||||
<string>Template: Chris Kempson, Scheme: Mitchell Kember</string>
|
<string>Template: Chris Kempson, Scheme: Mitchell Kember</string>
|
||||||
|
|||||||
Vendored
+1
-1
Submodule assets/themes/dracula-sublime updated: 811a634420...26c57ec282
+1
Submodule assets/themes/gruvbox added at e3db74d0e5
Vendored
+1
-1
Submodule assets/themes/onehalf updated: fdcbffe317...89923117bc
Vendored
-1
Submodule assets/themes/solarized-sublime deleted from 1394cf0f5f
@@ -1,66 +1,53 @@
|
|||||||
// TODO: Re-enable generation of shell completion files (below) when clap 3 is out.
|
// TODO: Re-enable generation of shell completion files (below) when clap 3 is out.
|
||||||
// For more details, see https://github.com/sharkdp/bat/issues/372
|
// For more details, see https://github.com/sharkdp/bat/issues/372
|
||||||
|
|
||||||
#[macro_use]
|
// For bat-as-a-library, no build script is required. The build script is for
|
||||||
extern crate lazy_static;
|
// the manpage and completions, which are only relevant to the bat application.
|
||||||
extern crate liquid;
|
#[cfg(not(feature = "application"))]
|
||||||
|
fn main() {}
|
||||||
|
|
||||||
use std::error::Error;
|
#[cfg(feature = "application")]
|
||||||
use std::fs;
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
use std::path::Path;
|
use std::collections::HashMap;
|
||||||
|
use std::error::Error;
|
||||||
|
use std::fs;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
// Read environment variables.
|
// Read environment variables.
|
||||||
lazy_static! {
|
let project_name = option_env!("PROJECT_NAME").unwrap_or("bat");
|
||||||
pub static ref PROJECT_NAME: &'static str = option_env!("PROJECT_NAME").unwrap_or("bat");
|
let executable_name = option_env!("PROJECT_EXECUTABLE").unwrap_or(project_name);
|
||||||
pub static ref PROJECT_VERSION: &'static str = option_env!("CARGO_PKG_VERSION").unwrap();
|
let executable_name_uppercase = executable_name.to_uppercase();
|
||||||
pub static ref EXECUTABLE_NAME: &'static str = option_env!("PROJECT_EXECUTABLE")
|
static PROJECT_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
.or(option_env!("PROJECT_NAME"))
|
|
||||||
.unwrap_or("bat");
|
|
||||||
}
|
|
||||||
|
|
||||||
fn init_template() -> liquid::value::Object {
|
/// Generates a file from a template.
|
||||||
let mut globals = liquid::value::Object::new();
|
fn template(
|
||||||
|
variables: &HashMap<&str, &str>,
|
||||||
|
in_file: &str,
|
||||||
|
out_file: impl AsRef<Path>,
|
||||||
|
) -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut content = fs::read_to_string(in_file)?;
|
||||||
|
|
||||||
globals.insert(
|
for (variable_name, value) in variables {
|
||||||
"PROJECT_NAME".into(),
|
// Replace {{variable_name}} by the value
|
||||||
liquid::value::Value::scalar(PROJECT_NAME.to_owned()),
|
let pattern = format!("{{{{{variable_name}}}}}", variable_name = variable_name);
|
||||||
);
|
content = content.replace(&pattern, value);
|
||||||
|
}
|
||||||
|
|
||||||
globals.insert(
|
fs::write(out_file, content)?;
|
||||||
"PROJECT_EXECUTABLE".into(),
|
Ok(())
|
||||||
liquid::value::Value::scalar(EXECUTABLE_NAME.to_owned()),
|
}
|
||||||
);
|
|
||||||
|
|
||||||
globals.insert(
|
let mut variables = HashMap::new();
|
||||||
"PROJECT_VERSION".into(),
|
variables.insert("PROJECT_NAME", project_name);
|
||||||
liquid::value::Value::scalar(PROJECT_VERSION.to_owned()),
|
variables.insert("PROJECT_EXECUTABLE", executable_name);
|
||||||
);
|
variables.insert("PROJECT_EXECUTABLE_UPPERCASE", &executable_name_uppercase);
|
||||||
|
variables.insert("PROJECT_VERSION", PROJECT_VERSION);
|
||||||
globals
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Generates a file from a liquid template.
|
|
||||||
fn template(
|
|
||||||
variables: &liquid::value::Object,
|
|
||||||
in_file: &str,
|
|
||||||
out_file: impl AsRef<Path>,
|
|
||||||
) -> Result<(), Box<dyn Error>> {
|
|
||||||
let template = liquid::ParserBuilder::with_liquid()
|
|
||||||
.build()?
|
|
||||||
.parse(&fs::read_to_string(in_file)?)?;
|
|
||||||
|
|
||||||
fs::write(out_file, template.render(variables)?)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn Error>> {
|
|
||||||
let variables = init_template();
|
|
||||||
|
|
||||||
let out_dir_env = std::env::var_os("OUT_DIR").expect("OUT_DIR to be set in build.rs");
|
let out_dir_env = std::env::var_os("OUT_DIR").expect("OUT_DIR to be set in build.rs");
|
||||||
let out_dir = Path::new(&out_dir_env);
|
let out_dir = Path::new(&out_dir_env);
|
||||||
|
|
||||||
std::fs::create_dir_all(out_dir.join("assets/manual")).unwrap();
|
fs::create_dir_all(out_dir.join("assets/manual")).unwrap();
|
||||||
std::fs::create_dir_all(out_dir.join("assets/completions")).unwrap();
|
fs::create_dir_all(out_dir.join("assets/completions")).unwrap();
|
||||||
|
|
||||||
template(
|
template(
|
||||||
&variables,
|
&variables,
|
||||||
@@ -72,6 +59,11 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
"assets/completions/bat.fish.in",
|
"assets/completions/bat.fish.in",
|
||||||
out_dir.join("assets/completions/bat.fish"),
|
out_dir.join("assets/completions/bat.fish"),
|
||||||
)?;
|
)?;
|
||||||
|
template(
|
||||||
|
&variables,
|
||||||
|
"assets/completions/bat.zsh.in",
|
||||||
|
out_dir.join("assets/completions/bat.zsh"),
|
||||||
|
)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,187 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Building and packaging for release
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# Ensure environment variables exist.
|
|
||||||
if [[ -z "$PROJECT_NAME" ]]; then
|
|
||||||
export PROJECT_NAME="bat"
|
|
||||||
fi
|
|
||||||
|
|
||||||
build() {
|
|
||||||
cargo build --bins --target "$TARGET" --release --verbose
|
|
||||||
}
|
|
||||||
|
|
||||||
pack() {
|
|
||||||
local tempdir
|
|
||||||
local out_dir
|
|
||||||
local package_name
|
|
||||||
local gcc_prefix
|
|
||||||
|
|
||||||
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
|
||||||
out_dir=$(pwd)
|
|
||||||
package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"
|
|
||||||
|
|
||||||
if [[ $TARGET == "arm-unknown-linux-gnueabihf" ]]; then
|
|
||||||
gcc_prefix="arm-linux-gnueabihf-"
|
|
||||||
elif [[ $TARGET == "aarch64-unknown-linux-gnu" ]]; then
|
|
||||||
gcc_prefix="aarch64-linux-gnu-"
|
|
||||||
else
|
|
||||||
gcc_prefix=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# create a "staging" directory
|
|
||||||
mkdir "$tempdir/$package_name"
|
|
||||||
mkdir "$tempdir/$package_name/autocomplete"
|
|
||||||
|
|
||||||
# copying the main binary
|
|
||||||
cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
|
|
||||||
"${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"
|
|
||||||
|
|
||||||
# manpage, readme and license
|
|
||||||
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/manual/bat.1 "$tempdir/$package_name/$PROJECT_NAME.1"
|
|
||||||
cp README.md "$tempdir/$package_name"
|
|
||||||
cp LICENSE-MIT "$tempdir/$package_name"
|
|
||||||
cp LICENSE-APACHE "$tempdir/$package_name"
|
|
||||||
|
|
||||||
# various autocomplete
|
|
||||||
# TODO: disabled for now, see issue #372
|
|
||||||
# cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".bash "$tempdir/$package_name/autocomplete/${PROJECT_NAME}.bash-completion"
|
|
||||||
# cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".fish "$tempdir/$package_name/autocomplete"
|
|
||||||
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/completions/bat.fish "$tempdir/$package_name/autocomplete/$PROJECT_NAME.fish"
|
|
||||||
# cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/_"$PROJECT_NAME" "$tempdir/$package_name/autocomplete"
|
|
||||||
|
|
||||||
# archiving
|
|
||||||
pushd "$tempdir"
|
|
||||||
tar czf "$out_dir/$package_name.tar.gz" "$package_name"/*
|
|
||||||
popd
|
|
||||||
rm -r "$tempdir"
|
|
||||||
}
|
|
||||||
|
|
||||||
make_deb() {
|
|
||||||
local tempdir
|
|
||||||
local architecture
|
|
||||||
local version
|
|
||||||
local dpkgname
|
|
||||||
local conflictname
|
|
||||||
local gcc_prefix
|
|
||||||
local homepage
|
|
||||||
local maintainer
|
|
||||||
|
|
||||||
homepage="https://github.com/sharkdp/bat"
|
|
||||||
maintainer="David Peter <mail@david-peter.de>"
|
|
||||||
|
|
||||||
case $TARGET in
|
|
||||||
x86_64*)
|
|
||||||
architecture=amd64
|
|
||||||
gcc_prefix=""
|
|
||||||
;;
|
|
||||||
i686*)
|
|
||||||
architecture=i386
|
|
||||||
gcc_prefix=""
|
|
||||||
;;
|
|
||||||
aarch64*)
|
|
||||||
architecture=arm64
|
|
||||||
gcc_prefix="aarch64-linux-gnu-"
|
|
||||||
;;
|
|
||||||
arm*hf)
|
|
||||||
architecture=armhf
|
|
||||||
gcc_prefix="arm-linux-gnueabihf-"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "make_deb: skipping target '${TARGET}'" >&2
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
version=${TRAVIS_TAG#v}
|
|
||||||
if [[ $TARGET = *musl* ]]; then
|
|
||||||
dpkgname=$PROJECT_NAME-musl
|
|
||||||
conflictname=$PROJECT_NAME
|
|
||||||
else
|
|
||||||
dpkgname=$PROJECT_NAME
|
|
||||||
conflictname=$PROJECT_NAME-musl
|
|
||||||
fi
|
|
||||||
|
|
||||||
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
|
||||||
|
|
||||||
# copy the main binary
|
|
||||||
install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"
|
|
||||||
"${gcc_prefix}"strip "$tempdir/usr/bin/$PROJECT_NAME"
|
|
||||||
|
|
||||||
# manpage
|
|
||||||
install -Dm644 target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/manual/bat.1 "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
|
|
||||||
gzip --best "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
|
|
||||||
|
|
||||||
# completions
|
|
||||||
install -Dm644 target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/completions/bat.fish "$tempdir/usr/share/fish/vendor_completions.d/$PROJECT_NAME.fish"
|
|
||||||
|
|
||||||
# readme and license
|
|
||||||
install -Dm644 README.md "$tempdir/usr/share/doc/$PROJECT_NAME/README.md"
|
|
||||||
install -Dm644 LICENSE-MIT "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-MIT"
|
|
||||||
install -Dm644 LICENSE-APACHE "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-APACHE"
|
|
||||||
cat > "$tempdir/usr/share/doc/$PROJECT_NAME/copyright" <<EOF
|
|
||||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
|
||||||
Upstream-Name: $PROJECT_NAME
|
|
||||||
Source: $homepage
|
|
||||||
|
|
||||||
Files: *
|
|
||||||
Copyright: $maintainer
|
|
||||||
License: Apache-2.0 or MIT
|
|
||||||
|
|
||||||
License: Apache-2.0
|
|
||||||
On Debian systems, the complete text of the Apache-2.0 can be found in the
|
|
||||||
file /usr/share/common-licenses/Apache-2.0.
|
|
||||||
|
|
||||||
License: MIT
|
|
||||||
Permission is hereby granted, free of charge, to any
|
|
||||||
person obtaining a copy of this software and associated
|
|
||||||
documentation files (the "Software"), to deal in the
|
|
||||||
Software without restriction, including without
|
|
||||||
limitation the rights to use, copy, modify, merge,
|
|
||||||
publish, distribute, sublicense, and/or sell copies of
|
|
||||||
the Software, and to permit persons to whom the Software
|
|
||||||
is furnished to do so, subject to the following
|
|
||||||
conditions:
|
|
||||||
.
|
|
||||||
The above copyright notice and this permission notice
|
|
||||||
shall be included in all copies or substantial portions
|
|
||||||
of the Software.
|
|
||||||
.
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
||||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
||||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
||||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
||||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
||||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Control file
|
|
||||||
mkdir "$tempdir/DEBIAN"
|
|
||||||
cat > "$tempdir/DEBIAN/control" <<EOF
|
|
||||||
Package: $dpkgname
|
|
||||||
Version: $version
|
|
||||||
Section: utils
|
|
||||||
Priority: optional
|
|
||||||
Maintainer: David Peter <mail@david-peter.de>
|
|
||||||
Architecture: $architecture
|
|
||||||
Provides: $PROJECT_NAME
|
|
||||||
Conflicts: $conflictname
|
|
||||||
Description: A cat(1) clone with wings.
|
|
||||||
A cat(1) clone with syntax highlighting and Git integration.
|
|
||||||
EOF
|
|
||||||
|
|
||||||
fakeroot dpkg-deb --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main() {
|
|
||||||
build
|
|
||||||
pack
|
|
||||||
if [[ $TARGET = *linux* ]]; then
|
|
||||||
make_deb
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# This script takes care of packaging the build artifacts that will go in the
|
|
||||||
# release zipfile
|
|
||||||
|
|
||||||
$SRC_DIR = $PWD.Path
|
|
||||||
$STAGE = [System.Guid]::NewGuid().ToString()
|
|
||||||
|
|
||||||
Set-Location $ENV:Temp
|
|
||||||
New-Item -Type Directory -Name $STAGE
|
|
||||||
Set-Location $STAGE
|
|
||||||
|
|
||||||
$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip"
|
|
||||||
|
|
||||||
Copy-Item "$SRC_DIR\target\release\bat.exe" '.\'
|
|
||||||
# TODO: disabled for now, see issue #372
|
|
||||||
# Copy-Item $SRC_DIR\target\release\build\bat-*\out\_bat.ps1 '.\'
|
|
||||||
|
|
||||||
# readme and license
|
|
||||||
Copy-Item $SRC_DIR\README.md '.\'
|
|
||||||
Copy-Item $SRC_DIR\LICENSE-MIT '.\'
|
|
||||||
Copy-Item $SRC_DIR\LICENSE-APACHE '.\'
|
|
||||||
|
|
||||||
7z a "$ZIP" *
|
|
||||||
|
|
||||||
Push-AppveyorArtifact "$ZIP"
|
|
||||||
|
|
||||||
Set-Location ..
|
|
||||||
Remove-Item $STAGE -Force -Recurse
|
|
||||||
Set-Location $SRC_DIR
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
if [ "$TRAVIS_OS_NAME" != linux ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo apt-get update
|
|
||||||
|
|
||||||
# needed for musl targets
|
|
||||||
sudo apt-get install -y musl-tools
|
|
||||||
|
|
||||||
# needed to build deb packages
|
|
||||||
sudo apt-get install -y fakeroot
|
|
||||||
|
|
||||||
# needed for i686 linux gnu target
|
|
||||||
if [[ $TARGET == i686-unknown-linux-gnu ]]; then
|
|
||||||
sudo apt-get install -y gcc-multilib
|
|
||||||
fi
|
|
||||||
|
|
||||||
# needed for cross-compiling for arm
|
|
||||||
if [[ $TARGET == arm-unknown-linux-gnueabihf ]]; then
|
|
||||||
sudo apt-get install -y \
|
|
||||||
gcc-4.8-arm-linux-gnueabihf \
|
|
||||||
binutils-arm-linux-gnueabihf \
|
|
||||||
libc6-armhf-cross \
|
|
||||||
libc6-dev-armhf-cross
|
|
||||||
fi
|
|
||||||
|
|
||||||
# needed for cross-compiling for arm64
|
|
||||||
if [[ $TARGET == aarch64-unknown-linux-gnu ]]; then
|
|
||||||
sudo apt-get install -y \
|
|
||||||
gcc-4.8-aarch64-linux-gnu \
|
|
||||||
binutils-aarch64-linux-gnu \
|
|
||||||
gcc-aarch64-linux-gnu \
|
|
||||||
libc6-dev-arm64-cross
|
|
||||||
fi
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# Incorporate TARGET env var to the build and test process
|
|
||||||
cargo build --target "$TARGET" --verbose
|
|
||||||
|
|
||||||
# We cannot run arm executables on linux
|
|
||||||
if [[ $TARGET != arm-unknown-linux-gnueabihf ]] && [[ $TARGET != aarch64-unknown-linux-gnu ]]; then
|
|
||||||
cargo test --target "$TARGET" --verbose
|
|
||||||
|
|
||||||
# Run 'bat' on its own source code and the README
|
|
||||||
cargo run --target "$TARGET" -- src/bin/bat/main.rs README.md --paging=never
|
|
||||||
fi
|
|
||||||
Vendored
+102
-37
@@ -2,6 +2,24 @@
|
|||||||
_modules=('system' 'bat' 'bat_config' 'bat_wrapper' 'bat_wrapper_function' 'tool')
|
_modules=('system' 'bat' 'bat_config' 'bat_wrapper' 'bat_wrapper_function' 'tool')
|
||||||
_modules_consented=()
|
_modules_consented=()
|
||||||
|
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
export LC_ALL=C
|
||||||
|
export LANG=C
|
||||||
|
|
||||||
|
BAT="bat"
|
||||||
|
if ! command -v bat &>/dev/null; then
|
||||||
|
if command -v batcat &> /dev/null; then
|
||||||
|
BAT="batcat"
|
||||||
|
else
|
||||||
|
tput setaf 1
|
||||||
|
printf "%s\n%s\n" \
|
||||||
|
"Unable to find a bat executable on your PATH." \
|
||||||
|
"Please ensure that 'bat' exists and is not named something else."
|
||||||
|
tput sgr0
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Modules:
|
# Modules:
|
||||||
@@ -9,6 +27,7 @@ _modules_consented=()
|
|||||||
|
|
||||||
_bat_:description() {
|
_bat_:description() {
|
||||||
_collects "Version information for 'bat'."
|
_collects "Version information for 'bat'."
|
||||||
|
_collects "Custom syntaxes and themes for 'bat'."
|
||||||
}
|
}
|
||||||
|
|
||||||
_bat_config_:description() {
|
_bat_config_:description() {
|
||||||
@@ -33,59 +52,92 @@ _tool_:description() {
|
|||||||
_collects "Version information for 'less'."
|
_collects "Version information for 'less'."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
_bat_:run() {
|
_bat_:run() {
|
||||||
_out bat --version
|
_out "$BAT" --version
|
||||||
_out env | grep '^BAT_\|^PAGER='
|
_out env | grep '^BAT_\|^PAGER='
|
||||||
|
|
||||||
|
local cache_dir="$($BAT --cache-dir)"
|
||||||
|
if [[ -f "${cache_dir}/syntaxes.bin" ]]; then
|
||||||
|
_print_command "$BAT" "--list-languages"
|
||||||
|
echo "Found custom syntax set."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "${cache_dir}/themes.bin" ]]; then
|
||||||
|
_print_command "$BAT" "--list-themes"
|
||||||
|
echo "Found custom theme set."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_bat_config_:run() {
|
_bat_config_:run() {
|
||||||
if [[ -f "$(bat --config-file)" ]]; then
|
if [[ -f "$("$BAT" --config-file)" ]]; then
|
||||||
_out_fence cat "$(bat --config-file)";
|
_out_fence cat "$("$BAT" --config-file)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_bat_wrapper_:run() {
|
_bat_wrapper_:run() {
|
||||||
if file "$(which bat)" | grep "text executable" &>/dev/null; then
|
_bat_wrapper_:detect_wrapper() {
|
||||||
_out_fence cat "$(which bat)"
|
local bat="$1"
|
||||||
return
|
if file "$(which "${bat}")" | grep "text executable" &> /dev/null; then
|
||||||
|
_out_fence cat "$(which "${bat}")"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "\nNo wrapper script for '%s'.\n" "${bat}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_bat_wrapper_:detect_wrapper bat
|
||||||
|
if [[ "$BAT" != "bat" ]]; then
|
||||||
|
_bat_wrapper_:detect_wrapper "$BAT"
|
||||||
fi
|
fi
|
||||||
printf "\nNo wrapper script.\n"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_bat_wrapper_function_:run() {
|
_bat_wrapper_function_:run() {
|
||||||
case "$("$SHELL" --version | head -n 1)" in
|
_bat_wrapper_function_:detect_wrapper() {
|
||||||
*fish*)
|
local command="$1"
|
||||||
if "$SHELL" --login -c 'type bat' 2>&1 | grep 'function' &>/dev/null; then
|
case "$("$SHELL" --version | head -n 1)" in
|
||||||
_out_fence "$SHELL" --login -c 'functions bat'
|
*fish*)
|
||||||
fi ;;
|
if "$SHELL" --login -i -c "type ${command}" 2>&1 | grep 'function' &> /dev/null; then
|
||||||
|
_out_fence "$SHELL" --login -i -c "functions ${command}"
|
||||||
|
return
|
||||||
|
fi ;;
|
||||||
|
|
||||||
*bash*)
|
*bash* | *zsh*)
|
||||||
if "$SHELL" --login -c 'type bat' 2>&1 | grep 'function' &>/dev/null; then
|
local type="$("$SHELL" --login -i -c "type ${command}" 2>&1)"
|
||||||
_out_fence "$SHELL" --login -c 'declare -f bat'
|
if grep 'function' <<< "$type" &> /dev/null; then
|
||||||
fi ;;
|
_out_fence "$SHELL" --login -i -c "declare -f ${command}"
|
||||||
|
return
|
||||||
|
elif grep 'alias' <<< "$type" &> /dev/null; then
|
||||||
|
_out_fence "$SHELL" --login -i -c "type ${command}"
|
||||||
|
return
|
||||||
|
fi ;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Unable to determine if a wrapper function is set."
|
echo "Unable to determine if a wrapper function for '${command}' is set."
|
||||||
return ;;
|
return ;;
|
||||||
esac
|
esac
|
||||||
printf "\nNo wrapper function.\n"
|
printf "\nNo wrapper function for '%s'.\n" "${command}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_bat_wrapper_function_:detect_wrapper bat
|
||||||
|
_bat_wrapper_function_:detect_wrapper cat
|
||||||
|
if [[ "$BAT" != "bat" ]]; then
|
||||||
|
_bat_wrapper_function_:detect_wrapper "$BAT"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_system_:run() {
|
_system_:run() {
|
||||||
_out uname -srm
|
_out uname -srm
|
||||||
|
|
||||||
if command -v "sw_vers" &>/dev/null; then _out sw_vers; fi
|
if command -v "sw_vers" &> /dev/null; then _out sw_vers; fi
|
||||||
if command -v "lsb_release" &>/dev/null; then _out lsb_release -a; fi
|
if command -v "lsb_release" &> /dev/null; then _out lsb_release -a; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_tool_:run() {
|
_tool_:run() {
|
||||||
_out less --version | head -n1
|
_out less --version | head -n1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Functions:
|
# Functions:
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@@ -109,7 +161,7 @@ _out_fence() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_tput() {
|
_tput() {
|
||||||
tput "$@" 1>&2 2>/dev/null
|
tput "$@" 1>&2 2> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
_collects() {
|
_collects() {
|
||||||
@@ -120,7 +172,7 @@ _ask_module() {
|
|||||||
_tput clear
|
_tput clear
|
||||||
_tput cup 0 0
|
_tput cup 0 0
|
||||||
|
|
||||||
cat 1>&2 <<EOF
|
cat 1>&2 << EOF
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
This script runs some harmless commands to collect information about your
|
This script runs some harmless commands to collect information about your
|
||||||
system and bat configuration. It will give you a small preview of the commands
|
system and bat configuration. It will give you a small preview of the commands
|
||||||
@@ -135,7 +187,7 @@ EOF
|
|||||||
_tput sgr0
|
_tput sgr0
|
||||||
"_$1_:description"
|
"_$1_:description"
|
||||||
_tput sgr0
|
_tput sgr0
|
||||||
|
|
||||||
# Print preview.
|
# Print preview.
|
||||||
_tput setaf 3
|
_tput setaf 3
|
||||||
printf "\nThe following commands will be run:\n" 1>&2
|
printf "\nThe following commands will be run:\n" 1>&2
|
||||||
@@ -143,19 +195,20 @@ EOF
|
|||||||
declare -f "_$1_:run" \
|
declare -f "_$1_:run" \
|
||||||
| sed 's/^ *//; s/;$//' \
|
| sed 's/^ *//; s/;$//' \
|
||||||
| grep '^_out[^ ]* ' \
|
| grep '^_out[^ ]* ' \
|
||||||
| sed 's/^_out[^ ]* //' 1>&2
|
| sed 's/^_out[^ ]* //' \
|
||||||
|
| sed "s/\"\$BAT\"/$BAT/" 1>&2
|
||||||
|
|
||||||
# Prompt
|
# Prompt
|
||||||
printf "\n" 1>&2
|
printf "\n" 1>&2
|
||||||
local response
|
local response
|
||||||
while true; do
|
while true; do
|
||||||
_tput cup "$(( $(tput lines || echo 22) - 2 ))"
|
_tput cup "$(($( tput lines || echo 22) - 2))"
|
||||||
_tput el
|
_tput el
|
||||||
read -er -p "Collect $(sed 's/_/ /' <<< "$1") data? [Y/n] " response
|
read -er -p "Collect $(sed 's/_/ /' <<< "$1") data? [Y/n] " response
|
||||||
case "$response" in
|
case "$response" in
|
||||||
Y|y|yes|'') return 0 ;;
|
Y | y | yes | '') return 0 ;;
|
||||||
N|n|no) return 1 ;;
|
N | n | no) return 1 ;;
|
||||||
*) continue
|
*) continue ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -166,13 +219,27 @@ _run_module() {
|
|||||||
"_$1_:run"
|
"_$1_:run"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Functions:
|
# Functions:
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Tell the user if their executable isn't named "bat".
|
||||||
|
if [[ "$BAT" != "bat" ]] && [[ "$1" != '-y' ]]; then
|
||||||
|
trap '_tput rmcup; exit 1' INT
|
||||||
|
_tput smcup
|
||||||
|
_tput clear
|
||||||
|
_tput cup 0 0
|
||||||
|
_tput setaf 1
|
||||||
|
printf "The %s executable on your system is named '%s'.\n%s\n" "bat" "$BAT" \
|
||||||
|
"If your issue is related to installation, please check that this isn't the issue."
|
||||||
|
_tput sgr0
|
||||||
|
printf "Press any key to continue...\n"
|
||||||
|
read -rsn1
|
||||||
|
_tput rmcup
|
||||||
|
fi
|
||||||
|
|
||||||
# Ask for consent.
|
# Ask for consent.
|
||||||
if [[ "$1" = '-y' ]]; then
|
if [[ "$1" == '-y' ]]; then
|
||||||
_modules_consented=("${_modules[@]}")
|
_modules_consented=("${_modules[@]}")
|
||||||
else
|
else
|
||||||
trap '_tput rmcup; exit 1' INT
|
trap '_tput rmcup; exit 1' INT
|
||||||
@@ -190,5 +257,3 @@ for _module in "${_modules_consented[@]}"; do
|
|||||||
_run_module "$_module" 2>&1
|
_run_module "$_module" 2>&1
|
||||||
printf "\n"
|
printf "\n"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+39
-28
@@ -39,18 +39,18 @@
|
|||||||
|
|
||||||
### 自動ページング
|
### 自動ページング
|
||||||
|
|
||||||
出力が1つの画面に対して大きすぎる場合、`bat` は自身の出力を `less` にパイプで繋げることが可能です。
|
出力が1つの画面に対して大きすぎる場合、`bat` は自身の出力をページャー(例えば `less`) にパイプで繋げます。
|
||||||
|
|
||||||
### ファイルの連結
|
### ファイルの連結
|
||||||
|
|
||||||
あなたはさらにファイルを連結させるに使うことも可能です:wink:。
|
あなたはさらにファイルを連結させるために使うことも可能です:wink:。
|
||||||
`bat` は非対話型のターミナルを検出すると、
|
`bat` は非対話型のターミナルを検出すると(すなわち他のプロセスにパイプしたりファイル出力していると)、
|
||||||
いつでも `cat` の完全互換として振る舞い、
|
`bat` は `cat` の完全互換として振る舞い、
|
||||||
プレーンなファイルを表示します。
|
プレーンなファイルを表示します。
|
||||||
|
|
||||||
## 使い方
|
## 使い方
|
||||||
|
|
||||||
単一のファイルを表示させたい
|
単一のファイルを表示させたい場合
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
> bat README.md
|
> bat README.md
|
||||||
@@ -62,7 +62,9 @@
|
|||||||
> bat src/*.rs
|
> bat src/*.rs
|
||||||
```
|
```
|
||||||
|
|
||||||
標準入力から自動的に構文を決定させたい場合
|
標準入力から自動的に構文を決定させたい場合(ハイライトされるのは、
|
||||||
|
たいていは `#!/bin/sh` のようなシバンを利用して、
|
||||||
|
ファイルの一行目から構文を決定できる場合のみです)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
> curl -s https://sh.rustup.rs | bat
|
> curl -s https://sh.rustup.rs | bat
|
||||||
@@ -119,8 +121,7 @@ batgrep needle src/
|
|||||||
```bash
|
```bash
|
||||||
tail -f /var/log/pacman.log | bat --paging=never -l log
|
tail -f /var/log/pacman.log | bat --paging=never -l log
|
||||||
```
|
```
|
||||||
Note that we have to switch off paging in order for this to work. We have also specified the syntax
|
注意事項:`tail -f`と組み合わせるには、ページングをオフにしなければなりません。また、この場合は構文が自動検出されないため、明示的に指定(`-l log`)しています。
|
||||||
explicitly (`-l log`), as it can not be auto-detected in this case.
|
|
||||||
|
|
||||||
#### `git`
|
#### `git`
|
||||||
|
|
||||||
@@ -153,7 +154,7 @@ man 2 select
|
|||||||
```
|
```
|
||||||
|
|
||||||
フォーマットの問題が発生した場合は
|
フォーマットの問題が発生した場合は
|
||||||
`MANROFFOPT = "-c"` を設定する必要もあります。
|
`MANROFFOPT="-c"` を設定する必要もあります。
|
||||||
|
|
||||||
これを新しいコマンドにバンドルしたい場合は [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md) も使用できます。
|
これを新しいコマンドにバンドルしたい場合は [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md) も使用できます。
|
||||||
|
|
||||||
@@ -168,19 +169,29 @@ man 2 select
|
|||||||
|
|
||||||
[](https://repology.org/project/bat/versions)
|
[](https://repology.org/project/bat/versions)
|
||||||
|
|
||||||
### On Ubuntu
|
### On Ubuntu (`apt` を使用)
|
||||||
*... や他のDebianベースのLinuxディストリビューション*
|
*... や他のDebianベースのLinuxディストリビューション*
|
||||||
|
|
||||||
Ubuntu Eoan 19.10 または Debian 不安定版 sid 以降の [the Ubuntu `bat` package](https://packages.ubuntu.com/eoan/bat) または [the Debian `bat` package](https://packages.debian.org/sid/bat) をインストールできます:
|
Ubuntu Eoan 19.10 または Debian 不安定版 sid 以降の [the Ubuntu `bat` package](https://packages.ubuntu.com/eoan/bat) または [the Debian `bat` package](https://packages.debian.org/sid/bat) からインストールできます:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
apt install bat
|
apt install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`apt` を使用して `bat` をインストールした場合、実行可能ファイルの名前が `bat` ではなく `batcat` になることがあります([他のパッケージとの名前衝突のため](https://github.com/sharkdp/bat/issues/982))。`bat -> batcat` のシンボリックリンクまたはエイリアスを設定することで、実行可能ファイル名が異なることによる問題の発生を防ぎ、他のディストリビューションと一貫性を保てます。
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
mkdir -p ~/.local/bin
|
||||||
|
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### On Ubuntu (最新の `.deb` パッケージを使用)
|
||||||
|
*... や他のDebianベースのLinuxディストリビューション
|
||||||
|
|
||||||
batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
|
batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
|
||||||
次の方法でインストールします:
|
次の方法でインストールします:
|
||||||
```bash
|
```bash
|
||||||
sudo dpkg -i bat_0.13.0_amd64.deb # adapt version number and architecture
|
sudo dpkg -i bat_0.17.1_amd64.deb # adapt version number and architecture
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Alpine Linux
|
### On Alpine Linux
|
||||||
@@ -220,7 +231,7 @@ emerge sys-apps/bat
|
|||||||
|
|
||||||
### On Void Linux
|
### On Void Linux
|
||||||
|
|
||||||
xbps-ininstall経由で `bat` をインストールできます。
|
xbps-install経由で `bat` をインストールできます。
|
||||||
```
|
```
|
||||||
xbps-install -S bat
|
xbps-install -S bat
|
||||||
```
|
```
|
||||||
@@ -233,7 +244,7 @@ pkg を使用してプリコンパイルされた [`bat` package](https://www.fr
|
|||||||
pkg install bat
|
pkg install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
または FreeBSD ポートから自分でビルドする:
|
または FreeBSD ポートから自分でビルドすることもできます:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /usr/ports/textproc/bat
|
cd /usr/ports/textproc/bat
|
||||||
@@ -336,16 +347,16 @@ ansible-galaxy install aeimer.install_bat
|
|||||||
### From binaries
|
### From binaries
|
||||||
|
|
||||||
|
|
||||||
多くの異なるアーキテクチャのためのプレビルドバージョンを[リリースページ](https://github.com/sharkdp/bat/releases)からチェックしてみてください。静的にリンクされている多くのバイナリも利用できます: ファイル名に `musl` を含むアーカイブを探します。
|
多くの異なるアーキテクチャのためのプレビルドバージョンを[リリースページ](https://github.com/sharkdp/bat/releases)からチェックしてみてください。静的にリンクされている多くのバイナリも利用できます: ファイル名に `musl` を含むアーカイブを探してみてください。
|
||||||
|
|
||||||
### From source
|
### From source
|
||||||
|
|
||||||
|
|
||||||
`bat` をソースからビルドしたいならば、Rust 1.36 以上の環境が必要です。
|
`bat` をソースからビルドしたいならば、Rust 1.36 以上の環境が必要です。
|
||||||
そして `cargo` をビルドに対して使用します:
|
`cargo` を使用してビルドすることができます:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install bat
|
cargo install --locked bat
|
||||||
```
|
```
|
||||||
|
|
||||||
一部のプラットフォームでは `llvm` および/または `libclang-dev` のインストールが必要になる場合があります。
|
一部のプラットフォームでは `llvm` および/または `libclang-dev` のインストールが必要になる場合があります。
|
||||||
@@ -387,7 +398,7 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
|||||||
[Sublime Text の `.sublime-syntax` ファイル](https://www.sublimetext.com/docs/3/syntax.html)
|
[Sublime Text の `.sublime-syntax` ファイル](https://www.sublimetext.com/docs/3/syntax.html)
|
||||||
とテーマを読み取ることができます。新しい構文を定義するために以下の手順を行います。
|
とテーマを読み取ることができます。新しい構文を定義するために以下の手順を行います。
|
||||||
|
|
||||||
構文定義ファイルを入れておくためのフォルダを作る:
|
構文定義ファイルを入れておくためのフォルダを作ります:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir -p "$(bat --config-dir)/syntaxes"
|
mkdir -p "$(bat --config-dir)/syntaxes"
|
||||||
@@ -428,13 +439,13 @@ git clone https://github.com/greggb/sublime-snazzy
|
|||||||
bat cache --build
|
bat cache --build
|
||||||
```
|
```
|
||||||
|
|
||||||
最後に、 `bat --list-themes` で新しいテーマが利用可能がチェックします
|
最後に、 `bat --list-themes` で新しいテーマが利用可能かチェックします
|
||||||
|
|
||||||
### 異なるページャーの使用
|
### 異なるページャーの使用
|
||||||
|
|
||||||
`bat` は環境変数 `PAGER` に使用するページャーを明記します。
|
`bat` は環境変数 `PAGER` に使用するページャーを明記します。
|
||||||
この環境変数が定義されていない場合、デフォルトで `less` が使用されます。
|
この環境変数が定義されていない場合、デフォルトで `less` が使用されます。
|
||||||
もし、異なるページャーが使用したい場合は、`PAGER` を修正してください。
|
もし、異なるページャーを使用したい場合は、`PAGER` を修正してください。
|
||||||
または、`PAGER` を上書きする環境変数として `BAT_PAGER` を定義することも可能です。
|
または、`PAGER` を上書きする環境変数として `BAT_PAGER` を定義することも可能です。
|
||||||
|
|
||||||
もし、ページャーにコマンドライン引数を渡したい場合は、
|
もし、ページャーにコマンドライン引数を渡したい場合は、
|
||||||
@@ -526,14 +537,14 @@ Windows 10では、`conhost.exe` (コマンドプロンプト)と
|
|||||||
[ConEmu](https://conemu.github.io/) を含む [Cmder](http://cmder.net/) を使用できます。
|
[ConEmu](https://conemu.github.io/) を含む [Cmder](http://cmder.net/) を使用できます。
|
||||||
|
|
||||||
**注意:** Git と MSYS の `less` はWindows上で色を正しく解釈しません。
|
**注意:** Git と MSYS の `less` はWindows上で色を正しく解釈しません。
|
||||||
もし、あなたが他のページャーをインストールしていないのであれば、 `--paging=never` オプションを付け加える
|
もし、あなたが他のページャーをインストールしていないのであれば、 `--paging=never` オプションを付け加えるか
|
||||||
または `BAT_PAGER` に空文字を設定することでページングを完全に無効にできます。
|
`BAT_PAGER` に空文字を設定することでページングを完全に無効にできます。
|
||||||
|
|
||||||
### Cygwin
|
### Cygwin
|
||||||
|
|
||||||
Windows上の `bat` は Cygwin のunix風のpath(`/cygdrive/*`)をネイティブサポートしていません。絶対的なcygwinパスを引数として受けたときに、 `bat` は以下のエラーを返すでしょう: `The system cannot find the path specified. (os error 3)`
|
Windows上の `bat` は Cygwin のunix風のpath(`/cygdrive/*`)をネイティブサポートしていません。絶対的なcygwinパスを引数として受けたときに、 `bat` は以下のエラーを返すでしょう: `The system cannot find the path specified. (os error 3)`
|
||||||
|
|
||||||
wrapperを作成するまたは以下の関数を `.bash_profile` に追記することでこの問題を解決することができます:
|
wrapperを作成するか、以下の関数を `.bash_profile` に追記することで、この問題を解決することができます:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bat() {
|
bat() {
|
||||||
@@ -553,7 +564,7 @@ bat() {
|
|||||||
|
|
||||||
### ターミナルと色
|
### ターミナルと色
|
||||||
|
|
||||||
`bat` はターミナルがトゥルーカラーをサポートしている/していない関係なくサポートします。
|
`bat` はターミナルがトゥルーカラーをサポートしている/していないに関係なくサポートします。
|
||||||
しかし、シンタックスハイライトのテーマの色が8-bitカラーに最適化されていない場合、
|
しかし、シンタックスハイライトのテーマの色が8-bitカラーに最適化されていない場合、
|
||||||
24-bitであるトゥルーカラーをサポートしているターミナルを使用することを強く推奨します(`terminator`, `konsole`, `iTerm2`, ...)。
|
24-bitであるトゥルーカラーをサポートしているターミナルを使用することを強く推奨します(`terminator`, `konsole`, `iTerm2`, ...)。
|
||||||
この [記事](https://gist.github.com/XVilka/8346728) には
|
この [記事](https://gist.github.com/XVilka/8346728) には
|
||||||
@@ -594,11 +605,11 @@ cargo build --bins
|
|||||||
cargo test
|
cargo test
|
||||||
|
|
||||||
# Install (release version)
|
# Install (release version)
|
||||||
cargo install
|
cargo install --locked
|
||||||
|
|
||||||
# Build a bat binary with modified syntaxes and themes
|
# Build a bat binary with modified syntaxes and themes
|
||||||
bash assets/create.sh
|
bash assets/create.sh
|
||||||
cargo install -f
|
cargo install --locked --force
|
||||||
```
|
```
|
||||||
|
|
||||||
## Maintainers
|
## Maintainers
|
||||||
@@ -610,10 +621,10 @@ cargo install -f
|
|||||||
|
|
||||||
`bat` は以下の目標を達成しようと試みています:
|
`bat` は以下の目標を達成しようと試みています:
|
||||||
|
|
||||||
- 美しい高度なシンタックスハイライトの提供
|
- 美しく高度なシンタックスハイライトの提供
|
||||||
- ファイルの差分を表示するためのGitとの連携
|
- ファイルの差分を表示するためのGitとの連携
|
||||||
- (POSIX) `cat` との完全互換
|
- (POSIX) `cat` との完全互換
|
||||||
- ユーザーフレンドリーがコマンドラインインターフェースの提供
|
- ユーザーフレンドリーなコマンドラインインターフェースの提供
|
||||||
|
|
||||||
あなたが同様のプログラムを探しているなら、多くの選択肢があります。
|
あなたが同様のプログラムを探しているなら、多くの選択肢があります。
|
||||||
比較については [このドキュメント](alternatives.md) を参照してください。
|
比較については [このドキュメント](alternatives.md) を参照してください。
|
||||||
|
|||||||
+4
-4
@@ -170,7 +170,7 @@ apt install bat
|
|||||||
만약 최근 릴리즈된 bat을 사용을 원하거나 buntu/Debian 예전 버전을 사용하는 경우, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다음과 같이 `.deb` 패키지를 받아 설치 할 수도 있습니다:
|
만약 최근 릴리즈된 bat을 사용을 원하거나 buntu/Debian 예전 버전을 사용하는 경우, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다음과 같이 `.deb` 패키지를 받아 설치 할 수도 있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo dpkg -i bat_0.13.0_amd64.deb # adapt version number and architecture
|
sudo dpkg -i bat_0.17.1_amd64.deb # adapt version number and architecture
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Alpine Linux
|
### On Alpine Linux
|
||||||
@@ -327,7 +327,7 @@ ansible-galaxy install aeimer.install_bat
|
|||||||
`bat`의 소스를 직접 빌드하기 위해서는, Rust 1.36 이상이 필요하며 `cargo`를 이용해 빌드할 수 있습니다.
|
`bat`의 소스를 직접 빌드하기 위해서는, Rust 1.36 이상이 필요하며 `cargo`를 이용해 빌드할 수 있습니다.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install bat
|
cargo install --locked bat
|
||||||
```
|
```
|
||||||
|
|
||||||
일부 플랫폼에서는 `llvm` 그리고/또는 `libclang-dev` 설치가 필요할 수도 있습니다.
|
일부 플랫폼에서는 `llvm` 그리고/또는 `libclang-dev` 설치가 필요할 수도 있습니다.
|
||||||
@@ -528,11 +528,11 @@ cargo build --bins
|
|||||||
cargo test
|
cargo test
|
||||||
|
|
||||||
# Install (release version)
|
# Install (release version)
|
||||||
cargo install
|
cargo install --locked
|
||||||
|
|
||||||
# Build a bat binary with modified syntaxes and themes
|
# Build a bat binary with modified syntaxes and themes
|
||||||
bash assets/create.sh
|
bash assets/create.sh
|
||||||
cargo install -f
|
cargo install --locked --force
|
||||||
```
|
```
|
||||||
|
|
||||||
## 메인테이너들
|
## 메인테이너들
|
||||||
|
|||||||
@@ -0,0 +1,594 @@
|
|||||||
|
<p align="center">
|
||||||
|
<img src="doc/logo-header.svg" alt="bat - a cat clone with wings"><br>
|
||||||
|
<a href="https://travis-ci.org/sharkdp/bat"><img src="https://travis-ci.org/sharkdp/bat.svg?branch=master" alt="Build Status"></a>
|
||||||
|
<a href="https://ci.appveyor.com/project/sharkdp/bat"><img src="https://ci.appveyor.com/api/projects/status/cptsmtbiwbnr2vhf/branch/master?svg=true"></a>
|
||||||
|
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
||||||
|
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
||||||
|
Клон утилиты <i>cat(1)</i> с поддержкой выделения синтаксиса и Git
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="#выделение-синтаксиса">Ключевые возможности</a> •
|
||||||
|
<a href="#как-использовать">Использование</a> •
|
||||||
|
<a href="#установка">Установка</a> •
|
||||||
|
<a href="#кастомизация">Кастомизация</a> •
|
||||||
|
<a href="#цели-и-альтернативы">Цели и альтернативы </a> •
|
||||||
|
Перевод [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>][<a href="doc/README-ja.md">日本語</a>][<a href="doc/README-ko.md">한국어</a>][<a href="doc/README-ru.md">Русский</a>]
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Выделение синтаксиса
|
||||||
|
|
||||||
|
`bat` поддерживает выделение синтаксиса для огромного количества языков программирования и разметки:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Интеграция с Git
|
||||||
|
`bat` использует `git`, чтобы показать изменения в коде
|
||||||
|
(смотрите на левый сайдбар):
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Показать непечатаемые символы
|
||||||
|
|
||||||
|
Вы можете использовать `-A` / `--show-all` флаг, чтобы показать символы, которые невозможно напечатать:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Автоматическое разделение текста
|
||||||
|
|
||||||
|
`bat` умеет перенаправлять вывод в `less`, если вывод не помещается на экране полностью.
|
||||||
|
|
||||||
|
### Объединение файлов
|
||||||
|
|
||||||
|
О... Вы также можете объединять файлы :wink:. Когда
|
||||||
|
`bat` обнаружит неинтерактивный терминал (например, когда вы перенаправляете вывод в файл или процесс), он будет работать как утилита `cat` и выведет содержимое файлов как обычный текст (без подсветки синтаксиса).
|
||||||
|
|
||||||
|
## Как использовать
|
||||||
|
|
||||||
|
Вывести единственный файл в терминале
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> bat README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Отобразить сразу несколько файлов в терминале
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> bat src/*.rs
|
||||||
|
```
|
||||||
|
|
||||||
|
Читаем из stdin и определяем синтаксис автоматически (внимание: это делается по заглавной строке файла, например, `#!/bin/sh`)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> curl -s https://sh.rustup.rs | bat
|
||||||
|
```
|
||||||
|
|
||||||
|
Прочитать из stdin с явным указанием языка
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> yaml2json .travis.yml | json_pp | bat -l json
|
||||||
|
```
|
||||||
|
|
||||||
|
Вывести и выделить неотображаемые символы
|
||||||
|
```bash
|
||||||
|
> bat -A /etc/hosts
|
||||||
|
```
|
||||||
|
|
||||||
|
Использование в качестве замены `cat`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat > note.md # мгновенно создаем новый файл
|
||||||
|
|
||||||
|
bat header.md content.md footer.md > document.md
|
||||||
|
|
||||||
|
bat -n main.rs # показываем только количество строк
|
||||||
|
|
||||||
|
bat f - g # выводит 'f' в stdin, а потом 'g'.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Интеграция с другими утилитами
|
||||||
|
|
||||||
|
#### `find` или `fd`
|
||||||
|
|
||||||
|
Вы можете использовать флаг `-exec` в `find`, чтобы посмотреть превью всех файлов в `bat`
|
||||||
|
```bash
|
||||||
|
find … -exec bat {} +
|
||||||
|
```
|
||||||
|
|
||||||
|
Если вы используете [`fd`](https://github.com/sharkdp/fd), применяйте для этого флаг `-X`/`--exec-batch`:
|
||||||
|
```bash
|
||||||
|
fd … -X bat
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `ripgrep`
|
||||||
|
|
||||||
|
С помощью [`batgrep`](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md), `bat` может быть использован для вывода результата запроса [`ripgrep`](https://github.com/BurntSushi/ripgrep)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
batgrep needle src/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tail -f`
|
||||||
|
|
||||||
|
`bat` может быть использован вместе с `tail -f`, чтобы выводить содержимое файла с подсветкой синтаксиса в реальном времени.
|
||||||
|
```bash
|
||||||
|
tail -f /var/log/pacman.log | bat --paging=never -l log
|
||||||
|
```
|
||||||
|
Заметьте, что мы должны отключить пэйджинг, чтобы это заработало. Мы также явно указали синтаксис (`-l log`), так как он не может быть автоматически определен в данном случае.
|
||||||
|
|
||||||
|
#### `git`
|
||||||
|
|
||||||
|
Вы можете использовать `bat` с `git show`, чтобы просмотреть старую версию файла с выделением синтаксиса:
|
||||||
|
```bash
|
||||||
|
git show v0.6.0:src/main.rs | bat -l rs
|
||||||
|
```
|
||||||
|
|
||||||
|
Обратите внимание, что выделение синтаксиса не работает в `git diff` на данный момент. Если вам это нужно, посмотрите [`delta`](https://github.com/dandavison/delta).
|
||||||
|
|
||||||
|
#### `xclip`
|
||||||
|
|
||||||
|
Нумерация стро и отображение изменений затрудняет копирование содержимого файлов в буфер обмена.
|
||||||
|
Чтобы спроваиться с этим, используйте флаг `-p`/`--plain` или просто перенаправьте стандартный вывод в `xclip`:
|
||||||
|
```bash
|
||||||
|
bat main.cpp | xclip
|
||||||
|
```
|
||||||
|
`bat` обнаружит перенаправление вывода и выведет обычный текст без выделения синтаксиса.
|
||||||
|
|
||||||
|
#### `man`
|
||||||
|
|
||||||
|
`bat` может быть использован в виде выделения цвета для `man`, для этого установите переменную окружения
|
||||||
|
`MANPAGER`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
|
man 2 select
|
||||||
|
```
|
||||||
|
|
||||||
|
Возможно вам понадобится также установить `MANROFFOPT="-c"`, если у вас есть проблемы с форматированием.
|
||||||
|
|
||||||
|
Если вы хотите сделать этой одной командой, вы можете использовать [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md).
|
||||||
|
|
||||||
|
Обратите внимание, что [синтаксис manpage](assets/syntaxes/02_Extra/Manpage.sublime-syntax) разрабатывается в этом репозитории и все еще находится в разработке.
|
||||||
|
|
||||||
|
#### `prettier` / `shfmt` / `rustfmt`
|
||||||
|
|
||||||
|
[`Prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) — скрипт, который форматирует код и выводит его с помощью `bat`.
|
||||||
|
|
||||||
|
|
||||||
|
## Установка
|
||||||
|
|
||||||
|
[](https://repology.org/project/bat/versions)
|
||||||
|
|
||||||
|
### Ubuntu (с помощью `apt`)
|
||||||
|
*... и другие дистрибутивы основанные на Debian.*
|
||||||
|
|
||||||
|
`bat` есть в репозиториях [Ubuntu](https://packages.ubuntu.com/eoan/bat) и
|
||||||
|
[Debian](https://packages.debian.org/sid/bat) и доступен начиная с Ubuntu Eoan 19.10. На Debian `bat` пока что доступен только с нестабильной веткой "Sid".
|
||||||
|
|
||||||
|
Если ваша версия Ubuntu/Debian достаточно новая, вы можете установить `bat` так:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
Если вы установили `bat` таким образом, то бинарный файл может быть установлен как `batcat` вместо `bat` (из-за [конфликта имени с другим пакетом](https://github.com/sharkdp/bat/issues/982)). Вы можете сделать симлинк или алиас `bat -> batcat`, чтобы предотвратить подобные проблемы и в других дистрибутивах.
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
mkdir -p ~/.local/bin
|
||||||
|
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Ubuntu (С помощью самого нового `.deb` пакета)
|
||||||
|
*... и другие дистрибутивы Linux основанные на Debian*
|
||||||
|
|
||||||
|
Если пакет еще недоступен в вашем Ubuntu/Debian дистрибутиве или вы хотите установить самую последнюю версию `bat`, то вы можете скачать самый последний `deb`-пакет отсюда:
|
||||||
|
[release page](https://github.com/sharkdp/bat/releases) и установить так:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo dpkg -i bat_0.17.1_amd64.deb # измените архитектуру и версию
|
||||||
|
```
|
||||||
|
|
||||||
|
### Alpine Linux
|
||||||
|
|
||||||
|
Вы можете установить [`bat`](https://pkgs.alpinelinux.org/packages?name=bat) из официальных источников:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apk add bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Arch Linux
|
||||||
|
|
||||||
|
Вы можете установить [`bat`](https://www.archlinux.org/packages/community/x86_64/bat/) из официального источника:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pacman -S bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fedora
|
||||||
|
|
||||||
|
Вы можете установить [`bat`](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506) из официального репозитория [Fedora Modular](https://docs.fedoraproject.org/en-US/modularity/using-modules/).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dnf install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Gentoo Linux
|
||||||
|
|
||||||
|
Вы можете установить [`bat`](https://packages.gentoo.org/packages/sys-apps/bat) из официальных источников:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
emerge sys-apps/bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Void Linux
|
||||||
|
|
||||||
|
Вы можете установить `bat` с помощью `xbps-install`:
|
||||||
|
```bash
|
||||||
|
xbps-install -S bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### FreeBSD
|
||||||
|
|
||||||
|
Вы можете установить [`bat`](https://www.freshports.org/textproc/bat) с помощью `pkg`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pkg install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
или самому скомпилировать его:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /usr/ports/textproc/bat
|
||||||
|
make install
|
||||||
|
```
|
||||||
|
|
||||||
|
### С помощью nix
|
||||||
|
|
||||||
|
Вы можете установить `bat`, используя [nix package manager](https://nixos.org/nix):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix-env -i bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### openSUSE
|
||||||
|
|
||||||
|
Вы можете установить `bat` с помощью `zypper`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zypper install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
|
||||||
|
Вы можете установить `bat` с помощью [Homebrew](http://braumeister.org/formula/bat):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
Или же установить его с помощью [MacPorts](https://ports.macports.org/port/bat/summary):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
port install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
Есть несколько способов установить `bat`. Как только вы установили его, посмотрите на секцию ["Использование `bat` в Windows"](#using-bat-on-windows).
|
||||||
|
|
||||||
|
#### С помощью Chocolatey
|
||||||
|
|
||||||
|
Вы можете установить `bat` с помощью [Chocolatey](https://chocolatey.org/packages/Bat):
|
||||||
|
```bash
|
||||||
|
choco install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
#### С помощью Scoop
|
||||||
|
|
||||||
|
Вы можете установить `bat` с помощью [scoop](https://scoop.sh/):
|
||||||
|
```bash
|
||||||
|
scoop install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
Для этого у вас должен быть установлен [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads).
|
||||||
|
|
||||||
|
#### Из заранее скомпилированных файлов:
|
||||||
|
|
||||||
|
Их вы можете скачать на [странице релизов](https://github.com/sharkdp/bat/releases).
|
||||||
|
|
||||||
|
Для этого у вас должен быть установлен [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads).
|
||||||
|
|
||||||
|
### С помощью Docker
|
||||||
|
|
||||||
|
Вы можете использовать [Docker image](https://hub.docker.com/r/danlynn/bat/), чтобы запустить `bat` в контейнере:
|
||||||
|
```bash
|
||||||
|
docker pull danlynn/bat
|
||||||
|
alias bat='docker run -it --rm -e BAT_THEME -e BAT_STYLE -e BAT_TABS -v "$(pwd):/myapp" danlynn/bat'
|
||||||
|
```
|
||||||
|
|
||||||
|
### С помощью Ansible
|
||||||
|
|
||||||
|
Вы можете установить `bat` с [Ansible](https://www.ansible.com/):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Устанавливаем роль на устройстве
|
||||||
|
ansible-galaxy install aeimer.install_bat
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
# Playbook для установки bat
|
||||||
|
- host: all
|
||||||
|
roles:
|
||||||
|
- aeimer.install_bat
|
||||||
|
```
|
||||||
|
|
||||||
|
- [Ansible Galaxy](https://galaxy.ansible.com/aeimer/install_bat)
|
||||||
|
- [GitHub](https://github.com/aeimer/ansible-install-bat)
|
||||||
|
|
||||||
|
Этот способ должен сработать со следующими дистрибутивами:
|
||||||
|
- Debian/Ubuntu
|
||||||
|
- ARM (например Raspberry PI)
|
||||||
|
- Arch Linux
|
||||||
|
- Void Linux
|
||||||
|
- FreeBSD
|
||||||
|
- macOS
|
||||||
|
|
||||||
|
### Из скомпилированных файлов
|
||||||
|
|
||||||
|
Перейдите на [страницу релизов](https://github.com/sharkdp/bat/releases) для
|
||||||
|
скомпилированных файлов `bat` для различных платформ. Бинарные файлы со статической связкой так же доступны: выбирайте архив с `musl` в имени.
|
||||||
|
|
||||||
|
### Из исходников
|
||||||
|
|
||||||
|
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.40 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo install --locked bat
|
||||||
|
```
|
||||||
|
|
||||||
|
## Кастомизация
|
||||||
|
|
||||||
|
### Темы для выделения текста
|
||||||
|
|
||||||
|
Используйте `bat --list-themes`, чтобы вывести список всех доступных тем. Для выбора темы `TwoDark` используйте `bat` с флагом
|
||||||
|
`--theme=TwoDark` или выставьте переменную окружения `BAT_THEME` в `TwoDark`. Используйте `export BAT_THEME="TwoDark"` в конфигурационном файле вашей оболочки, чтобы изменить ее навсегда. Или же используйте [конфигурационный файл](https://github.com/sharkdp/bat#configuration-file) `bat`.
|
||||||
|
|
||||||
|
Если вы хотите просто просмотреть темы, используйте следующую команду (для этого вам понадобится [`fzf`](https://github.com/junegunn/fzf)):
|
||||||
|
```bash
|
||||||
|
bat --list-themes | fzf --preview="bat --theme={} --color=always /путь/к/файлу"
|
||||||
|
```
|
||||||
|
|
||||||
|
`bat` отлично смотрится на темном фоне. Однако если ваш терминал использует светлую тему, то такие темы как `GitHub` или `OneHalfLight` будут смотреться куда лучше!
|
||||||
|
Вы также можете использовать новую тему, для этого перейдите [в раздел добавления тем](https://github.com/sharkdp/bat#добавление-новых-тем).
|
||||||
|
|
||||||
|
### Изменение внешнего вывода
|
||||||
|
|
||||||
|
Вы можете использовать флаг `--style`, чтобы изменять внешний вид вывода в `bat`.
|
||||||
|
Например, вы можете использовать `--style=numbers,changes`, чтобы показать только количество строк и изменений в Git. Установите переменную окружения `BAT_STYLE` чтобы изменить это навсегда, или используйте [конфиг файл](https://github.com/sharkdp/bat#configuration-file) `bat`.
|
||||||
|
|
||||||
|
### Добавление новых синтаксисов
|
||||||
|
|
||||||
|
`bat` использует [`syntect`](https://github.com/trishume/syntect/) для выделения синтаксиса. `syntect` может читать
|
||||||
|
[файл `.sublime-syntax`](https://www.sublimetext.com/docs/3/syntax.html)
|
||||||
|
и темы. Чтобы добавить новый синтаксис, сделайте следующее:
|
||||||
|
|
||||||
|
Создайте каталог с синтаксисом:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p "$(bat --config-dir)/syntaxes"
|
||||||
|
cd "$(bat --config-dir)/syntaxes"
|
||||||
|
|
||||||
|
# Разместите файлы '.sublime-syntax'
|
||||||
|
# в каталоге (или субкаталогах), например:
|
||||||
|
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
||||||
|
```
|
||||||
|
|
||||||
|
Теперь используйте следующую команду, чтобы превратить эти файлы в бинарный кеш:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat cache --build
|
||||||
|
```
|
||||||
|
|
||||||
|
Теперь вы можете использовать `bat --list-languages`, чтобы проверить, доступны ли новые языки.
|
||||||
|
|
||||||
|
Если когда-нибудь вы заходите вернуться к настройкам по умолчанию, введите
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat cache --clear
|
||||||
|
```
|
||||||
|
|
||||||
|
### Добавление новых тем
|
||||||
|
|
||||||
|
Это работает похожим образом, так же как и добавление новых тем выделения синтаксиса
|
||||||
|
|
||||||
|
Во-первых, создайте каталог с новыми темами для синтаксиса:
|
||||||
|
```bash
|
||||||
|
mkdir -p "$(bat --config-dir)/themes"
|
||||||
|
cd "$(bat --config-dir)/themes"
|
||||||
|
|
||||||
|
# Загрузите тему в формате '.tmTheme':
|
||||||
|
git clone https://github.com/greggb/sublime-snazzy
|
||||||
|
|
||||||
|
# Обновите кеш
|
||||||
|
bat cache --build
|
||||||
|
```
|
||||||
|
|
||||||
|
Теперь используйте `bat --list-themes`, чтобы проверить доступность новых тем.
|
||||||
|
|
||||||
|
### Использование другого пейджера.
|
||||||
|
|
||||||
|
`bat` использует пейджер, указанный в переменной окружения `PAGER`. Если она не задана, то используется `less`.
|
||||||
|
Если вы желаете использовать другой пейджер, вы можете либо изменить переменную `PAGER`, либо `BAT_PAGER` чтобы перезаписать то, что указано в `PAGER`.
|
||||||
|
|
||||||
|
Чтобы передать дополнительные аргументы вашему пейджеру, перечислите их в этой переменной:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export BAT_PAGER="less -RF"
|
||||||
|
```
|
||||||
|
|
||||||
|
Так же вы можете использовать [файл конфигурации](https://github.com/sharkdp/bat#configuration-file) `bat` (флаг `--pager`).
|
||||||
|
|
||||||
|
**Внимание**: По умолчанию пейджером является`less` (без каких-либо аргументов),
|
||||||
|
`bat` задаст следующие флаги для пейджера:
|
||||||
|
`-R`/`--RAW-CONTROL-CHARS`,
|
||||||
|
`-F`/`--quit-if-one-screen` и `-X`/`--no-init`. Последний флаг(`-X`) используется только для `less`, чья версия раньше 530.
|
||||||
|
|
||||||
|
Флаг `-R` нужен чтобы корректно воспроизвести ANSI цвета. Второй флаг (`-F`) говорит
|
||||||
|
`less` чтобы тот сразу же завершился, если размер вывода меньше чем вертикальный размер терминала.
|
||||||
|
Это удобно для небольших файлов, так как вам не надо каждый раз нажимать `q`, чтобы выйти из пейджера. Третий флаг (`-X`) нужен для того, чтобы исправить баг с `--quit-if-one-screen` в старых версиях `less`. К сожалению, это блокирует возможность использования колеса мышки.
|
||||||
|
|
||||||
|
Если вы хотите все же его включить, вы можете добавить флаг `-R`.
|
||||||
|
Для `less` новее чем 530 оно должно работать из коробки.
|
||||||
|
|
||||||
|
### Темная тема
|
||||||
|
|
||||||
|
Если вы используете темный режим в macOS, возможно вы захотите чтобы `bat` использовал другую тему, основанную на теме вашей ОС. Следующий сниппет использует тему `default`, когда у вас включен темный режим, и тему `GitHub`, когда включен светлый.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Файл конфигурации
|
||||||
|
|
||||||
|
`bat` также может быть кастомизирован с помощью файла конфигурации. Его местоположение зависит от вашей ОС: чтобы посмотреть его путь, введите
|
||||||
|
```
|
||||||
|
bat --config-file
|
||||||
|
```
|
||||||
|
|
||||||
|
Также вы можете установить переменную окружения `BAT_CONFIG_PATH`, чтобы изменить путь к файлу конфигурации.
|
||||||
|
```bash
|
||||||
|
export BAT_CONFIG_PATH="/path/to/bat.conf"
|
||||||
|
```
|
||||||
|
|
||||||
|
Файл конфигурации «по умолчанию» может быть создан с помощью флага `--generate-config-file`.
|
||||||
|
```bash
|
||||||
|
bat --generate-config-file
|
||||||
|
```
|
||||||
|
|
||||||
|
### Формат
|
||||||
|
|
||||||
|
Файл конфигурации - это всего лишь набор аргументов. Введите `bat --help`, чтобы просмотреть список всех возможных флагов и аргументов. Также вы можете закомментировать строку с помощью `#`.
|
||||||
|
|
||||||
|
Пример файла конфигурации:
|
||||||
|
```bash
|
||||||
|
# Установить тему "TwoDark"
|
||||||
|
--theme="TwoDark"
|
||||||
|
|
||||||
|
# Показывать количество строк, изменений в Git и заголовок файла
|
||||||
|
--style="numbers,changes,header"
|
||||||
|
|
||||||
|
# Использовать курсив (поддерживается не всеми терминалами)
|
||||||
|
--italic-text=always
|
||||||
|
|
||||||
|
# Использовать синтаксис C++ для всех .ino файлов
|
||||||
|
--map-syntax "*.ino:C++"
|
||||||
|
|
||||||
|
# Использовать синтаксик Git Ignore для всех файлов .ignore
|
||||||
|
--map-syntax ".ignore:Git Ignore"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Использование `bat` в Windows
|
||||||
|
|
||||||
|
`bat` полностью работоспособен "из коробки", но для некоторых возможностей могут понадобиться дополнительные настройки.
|
||||||
|
|
||||||
|
### Пейджинг
|
||||||
|
|
||||||
|
Windows поддерживает только очень простой пейджер `more`. Вы можете скачать установщик для `less` [с его сайта](http://www.greenwoodsoftware.com/less/download.html) или [через Chocolatey](https://chocolatey.org/packages/Less). Чтобы его использовать, скопируйте исполняемый файл в ваш `PATH` или [используйте переменную окружения](#Использование-другого-пейджера). [Пакет из Chocolatey](#windows) установит все автоматически.
|
||||||
|
|
||||||
|
### Цвета
|
||||||
|
|
||||||
|
Windows 10 поддерживает цвета и в `conhost.exe` (Command Prompt), и в PowerShell начиная с версии Windows
|
||||||
|
[v1511](https://ru.wikipedia.org/wiki/Windows_10#Обновления и поддержка), так же как и в bash. На ранних версиях Windows вы можете использовать
|
||||||
|
[Cmder](http://cmder.net/), в котором есть [ConEmu](https://conemu.github.io/).
|
||||||
|
|
||||||
|
**Внимание:** Версия `less` в Git и MSYS2 воспроизводит цвета некорректно. Если у вас нет других пейджеров, мы можете отключить использование пейджеров с помощью флага `--paging=never`
|
||||||
|
или установить `BAT_PAGER` равным пустой строке.
|
||||||
|
|
||||||
|
### Cygwin
|
||||||
|
|
||||||
|
Из коробки `bat` не поддерживает пути в стиле Unix (`/cygdrive/*`). Когда указан абсолютный путь cygwin, `bat` выдаст следующую ошибку: `The system cannot find the path specified. (os error 3)`
|
||||||
|
|
||||||
|
Она может быть решена добавлением следующей функции в `.bash_profile`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat() {
|
||||||
|
local index
|
||||||
|
local args=("$@")
|
||||||
|
for index in $(seq 0 ${#args[@]}) ; do
|
||||||
|
case "${args[index]}" in
|
||||||
|
-*) continue;;
|
||||||
|
*) [ -e "${args[index]}" ] && args[index]="$(cygpath --windows "${args[index]}")";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
command bat "${args[@]}"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Проблемы и их решение
|
||||||
|
|
||||||
|
### Терминалы и цвета
|
||||||
|
|
||||||
|
`bat` поддерживает терминалы *с* и *без* поддержки truecolor. Однако подсветка синтаксиса не оптимизирована для терминалов с 8-битными цветами, и рекомендуется использовать терминалы с поддержкой 24-битных цветов (`terminator`, `konsole`, `iTerm2`, ...).
|
||||||
|
Смотрите [эту статью](https://gist.github.com/XVilka/8346728) для полного списка терминалов.
|
||||||
|
|
||||||
|
Удостовертесь, что переменная `COLORTERM` равна `truecolor` или
|
||||||
|
`24bit`. Иначе `bat` не сможет определить поддержку 24-битных цветов (и будет использовать 8-битные).
|
||||||
|
|
||||||
|
### Текст и номера строк плохо видны
|
||||||
|
|
||||||
|
Используйте другую тему (`bat --list-themes` выведет список всех установленных тем). Темы `OneHalfDark` и
|
||||||
|
`OneHalfLight` имеют более яркие номера строк и тексты.
|
||||||
|
|
||||||
|
### Кодировки файлов
|
||||||
|
|
||||||
|
`bat` поддерживает UTF-8 и UTF-16. Файлы в других кодировках, возможно, придётся перекодировать, так как кодировка может быть распознана неверно. Используйте `iconv`.
|
||||||
|
Пример: у вас есть PHP файл в кодировке Latin-1 (ISO-8859-1):
|
||||||
|
``` bash
|
||||||
|
iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
|
||||||
|
```
|
||||||
|
Внимание: вам может понадобится флаг `-l`/`--language`, если `bat` не сможет автоматически определить синтаксис.
|
||||||
|
|
||||||
|
## Разработка
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Рекурсивно клонирует все модули
|
||||||
|
git clone --recursive https://github.com/sharkdp/bat
|
||||||
|
|
||||||
|
# Компиляции в режиме разработки
|
||||||
|
cd bat
|
||||||
|
cargo build --bins
|
||||||
|
|
||||||
|
# Запуск тестов
|
||||||
|
cargo test
|
||||||
|
|
||||||
|
# Установка (релизная версия)
|
||||||
|
cargo install --locked
|
||||||
|
|
||||||
|
# Компилирование исполняего файла bat с другим синтаксисом и темами
|
||||||
|
bash assets/create.sh
|
||||||
|
cargo install --locked --force
|
||||||
|
```
|
||||||
|
|
||||||
|
## Разработчики
|
||||||
|
|
||||||
|
- [sharkdp](https://github.com/sharkdp)
|
||||||
|
- [eth-p](https://github.com/eth-p)
|
||||||
|
|
||||||
|
## Цели и альтернативы
|
||||||
|
|
||||||
|
Цели проекта `bat`:
|
||||||
|
|
||||||
|
- Красивая и продвинутая подсветка синтаксиса.
|
||||||
|
- Интеграция с Git.
|
||||||
|
- Полноценная замена `cat`.
|
||||||
|
- Дружелюбный интерфейс и аргументы.
|
||||||
|
|
||||||
|
Есть очень много альтернатив `bat`. Смотрите [этот документ](doc/alternatives.md) для сравнения.
|
||||||
|
|
||||||
|
## Лицензия
|
||||||
|
Copyright (c) 2018-2020 [Разработчики bat](https://github.com/sharkdp/bat).
|
||||||
|
|
||||||
|
`bat` распостраняется под лицензями MIT License и Apache License 2.0 (на выбор пользователя).
|
||||||
|
|
||||||
|
Смотрите [LICENSE-APACHE](LICENSE-APACHE) и [LICENSE-MIT](LICENSE-MIT) для более подробного ознакомления.
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
## Adding new builtin languages for syntax highlighting
|
||||||
|
|
||||||
|
Should you find that a particular syntax is not available within `bat` and think it should be included in `bat` by default, you can follow the instructions outlined below.
|
||||||
|
|
||||||
|
`bat` uses the excellent [syntect](https://github.com/trishume/syntect) library to highlight source
|
||||||
|
code. As a basis, syntect uses [Sublime Text](https://www.sublimetext.com/) syntax definitions
|
||||||
|
in the `.sublime-syntax` format.
|
||||||
|
|
||||||
|
**Important:** Before proceeding, verify that the syntax you wish to add meets the [criteria for inclusion](#Criteria-for-inclusion-of-new-syntaxes).
|
||||||
|
|
||||||
|
1. Find a Sublime Text syntax for the given language, preferably in a separate Git repository
|
||||||
|
which can be included as a submodule (under `assets/syntaxes`).
|
||||||
|
|
||||||
|
2. If the Sublime Text syntax is only available as a `.tmLanguage` file, open the file in
|
||||||
|
Sublime Text and convert it to a `.sublime-syntax` file via *Tools* -> *Developer* ->
|
||||||
|
*New Syntax from XXX.tmLanguage...*. Save the new file in the `assets/syntaxes` folder.
|
||||||
|
|
||||||
|
3. Run the `assets/create.sh` script. It calls `bat cache --build` to parse all available
|
||||||
|
`.sublime-syntax` files and serialize them to a `syntaxes.bin` file (in this folder).
|
||||||
|
|
||||||
|
4. Re-compile `bat`. At compilation time, the `syntaxes.bin` file will be stored inside the
|
||||||
|
`bat` binary.
|
||||||
|
|
||||||
|
5. Use `bat --list-languages` to check if the new languages are available.
|
||||||
|
|
||||||
|
6. If you send a pull request with your changes, please do *not* include the changed `syntaxes.bin`
|
||||||
|
file. A new binary cache file will be created once before every new release of `bat`.
|
||||||
|
|
||||||
|
### Troubleshooting
|
||||||
|
|
||||||
|
Make sure that the local cache does not interfere with the internally stored syntaxes and
|
||||||
|
themes (`bat cache --clear`).
|
||||||
|
|
||||||
|
## Criteria for inclusion of new syntaxes
|
||||||
|
|
||||||
|
* More than 10,000 downloads on packagecontrol.io/
|
||||||
|
|
||||||
|
### Manual modifications
|
||||||
|
|
||||||
|
The following files have been manually modified after converting from a `.tmLanguage` file:
|
||||||
|
|
||||||
|
* `Apache.sublime_syntax`=> removed `.conf` and `.CONF` file types.
|
||||||
|
* `Dart.sublime-syntax` => removed `#regex.dart` include.
|
||||||
|
* `INI.sublime-syntax` => added `.hgrc`, `hgrc`, and `desktop` file types and support for comments after section headers
|
||||||
|
* `Org mode.sublime-syntax` => removed `task` file type.
|
||||||
|
* `SML.sublime_syntax` => removed `ml` file type.
|
||||||
|
* `Robot.sublime_syntax` => changed name to "Robot Framework"
|
||||||
|
|
||||||
|
### Non-submodule additions
|
||||||
|
|
||||||
|
* `Assembly (x86_64)` has been manually added from https://github.com/13xforever/x86-assembly-textmate-bundle due to `git clone` recursion problems
|
||||||
|
* `Nim.sublime-syntax` has been added manually from https://github.com/getzola/zola/blob/master/sublime_syntaxes/Nim.sublime-syntax as there was no suitable Git repository for it. The original syntax seems to originate from https://github.com/Varriount/NimLime
|
||||||
|
* `Rego.sublime-syntax` has been added manually from https://github.com/open-policy-agent/opa/blob/master/misc/syntax/sublime/rego.sublime-syntax
|
||||||
|
as it is not kept in a standalone repository. The file is generated from
|
||||||
|
https://github.com/open-policy-agent/opa/blob/master/misc/syntax/textmate/Rego.tmLanguage
|
||||||
|
* `SML.sublime_syntax` has been added manually from
|
||||||
|
https://github.com/seanjames777/SML-Language-Definitiona as it is not
|
||||||
|
kept in a standalone repository. The file generated is from
|
||||||
|
https://github.com/seanjames777/SML-Language-Definition/blob/master/sml.tmLanguage
|
||||||
|
* `Cabal.sublime_syntax` has been added manually from
|
||||||
|
https://github.com/SublimeHaskell/SublimeHaskell/ - we don't want to include the whole submodule because it includes other syntaxes ("Haskell improved") as well.
|
||||||
+1
-1
@@ -45,7 +45,7 @@
|
|||||||
showguides="true"
|
showguides="true"
|
||||||
inkscape:guide-bbox="true" />
|
inkscape:guide-bbox="true" />
|
||||||
<rect
|
<rect
|
||||||
style="opacity:1;fill:#f2f2f2;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.14294769px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
|
style="opacity:0.5;fill:#e5e5e5;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.14294769px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
|
||||||
id="rect1929"
|
id="rect1929"
|
||||||
width="1000"
|
width="1000"
|
||||||
height="286.64285"
|
height="286.64285"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
@@ -0,0 +1,18 @@
|
|||||||
|
/// A program that prints its own source code using the bat library
|
||||||
|
use bat::{PagingMode, PrettyPrinter, WrappingMode};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
PrettyPrinter::new()
|
||||||
|
.header(true)
|
||||||
|
.grid(true)
|
||||||
|
.line_numbers(true)
|
||||||
|
.use_italics(true)
|
||||||
|
// The following line will be highlighted in the output:
|
||||||
|
.highlight(line!() as usize)
|
||||||
|
.theme("1337")
|
||||||
|
.wrapping_mode(WrappingMode::Character)
|
||||||
|
.paging_mode(PagingMode::QuitIfOneScreen)
|
||||||
|
.input_file(file!())
|
||||||
|
.print()
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
+8
-28
@@ -1,33 +1,13 @@
|
|||||||
/// A very simple colorized `cat` clone, using `bat` as a library.
|
/// A very simple colorized `cat` clone, using `bat` as a library.
|
||||||
/// See `src/bin/bat` for the full `bat` application.
|
/// See `src/bin/bat` for the full `bat` application.
|
||||||
use bat::{
|
use bat::PrettyPrinter;
|
||||||
config::{Config, InputFile, StyleComponent, StyleComponents},
|
|
||||||
Controller, HighlightingAssets,
|
|
||||||
};
|
|
||||||
use console::Term;
|
|
||||||
use std::process;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let files = std::env::args_os().skip(1).collect::<Vec<_>>();
|
PrettyPrinter::new()
|
||||||
|
.header(true)
|
||||||
if files.is_empty() {
|
.grid(true)
|
||||||
eprintln!("No input files specified");
|
.line_numbers(true)
|
||||||
process::exit(1);
|
.input_files(std::env::args_os().skip(1))
|
||||||
}
|
.print()
|
||||||
|
.unwrap();
|
||||||
let config = Config {
|
|
||||||
term_width: Term::stdout().size().1 as usize,
|
|
||||||
colored_output: true,
|
|
||||||
true_color: true,
|
|
||||||
style_components: StyleComponents::new(&[
|
|
||||||
StyleComponent::Header,
|
|
||||||
StyleComponent::Grid,
|
|
||||||
StyleComponent::Numbers,
|
|
||||||
]),
|
|
||||||
files: files.iter().map(|file| InputFile::Ordinary(file)).collect(),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
let assets = HighlightingAssets::from_binary();
|
|
||||||
|
|
||||||
Controller::new(&config, &assets).run().expect("no errors");
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/// A small demonstration of the Input API.
|
||||||
|
/// This prints embedded bytes with a custom header and then reads from STDIN.
|
||||||
|
use bat::{Input, PrettyPrinter};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
PrettyPrinter::new()
|
||||||
|
.header(true)
|
||||||
|
.grid(true)
|
||||||
|
.line_numbers(true)
|
||||||
|
.inputs(vec![
|
||||||
|
Input::from_bytes(b"echo 'Hello World!'")
|
||||||
|
.name("embedded.sh") // Dummy name provided to detect the syntax.
|
||||||
|
.kind("Embedded")
|
||||||
|
.title("An embedded shell script."),
|
||||||
|
Input::from_stdin().title("Standard Input").kind("FD"),
|
||||||
|
])
|
||||||
|
.print()
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/// A simple program that prints its own source code using the bat library
|
||||||
|
use bat::PrettyPrinter;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let printer = PrettyPrinter::new();
|
||||||
|
|
||||||
|
println!("Syntaxes:");
|
||||||
|
for syntax in printer.syntaxes() {
|
||||||
|
println!("- {} ({})", syntax.name, syntax.file_extensions.join(", "));
|
||||||
|
}
|
||||||
|
|
||||||
|
println!();
|
||||||
|
|
||||||
|
println!("Themes:");
|
||||||
|
for theme in printer.themes() {
|
||||||
|
println!("- {}", theme);
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-16
@@ -1,20 +1,6 @@
|
|||||||
/// A simple program that prints its own source code using the bat library
|
/// A simple program that prints its own source code using the bat library
|
||||||
use bat::{
|
use bat::PrettyPrinter;
|
||||||
config::{Config, InputFile},
|
|
||||||
Controller, HighlightingAssets,
|
|
||||||
};
|
|
||||||
use std::ffi::OsStr;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let path_to_this_file = OsStr::new(file!());
|
PrettyPrinter::new().input_file(file!()).print().unwrap();
|
||||||
|
|
||||||
let config = Config {
|
|
||||||
files: vec![InputFile::Ordinary(path_to_this_file)],
|
|
||||||
colored_output: true,
|
|
||||||
true_color: true,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
let assets = HighlightingAssets::from_binary();
|
|
||||||
|
|
||||||
Controller::new(&config, &assets).run().expect("no errors");
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/// A program that serializes a Rust structure to YAML and pretty-prints the result
|
||||||
|
use bat::{Input, PrettyPrinter};
|
||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
struct Person {
|
||||||
|
name: String,
|
||||||
|
height: f64,
|
||||||
|
adult: bool,
|
||||||
|
children: Vec<Person>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let person = Person {
|
||||||
|
name: String::from("Anne Mustermann"),
|
||||||
|
height: 1.76f64,
|
||||||
|
adult: true,
|
||||||
|
children: vec![Person {
|
||||||
|
name: String::from("Max Mustermann"),
|
||||||
|
height: 1.32f64,
|
||||||
|
adult: false,
|
||||||
|
children: vec![],
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
|
||||||
|
let bytes = serde_yaml::to_vec(&person).unwrap();
|
||||||
|
PrettyPrinter::new()
|
||||||
|
.language("yaml")
|
||||||
|
.line_numbers(true)
|
||||||
|
.grid(true)
|
||||||
|
.header(true)
|
||||||
|
.input(Input::from_bytes(&bytes).name("person.yaml").kind("File"))
|
||||||
|
.print()
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
+255
-61
@@ -1,4 +1,5 @@
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
use std::ffi::OsStr;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -7,8 +8,11 @@ use syntect::dumps::{dump_to_file, from_binary, from_reader};
|
|||||||
use syntect::highlighting::{Theme, ThemeSet};
|
use syntect::highlighting::{Theme, ThemeSet};
|
||||||
use syntect::parsing::{SyntaxReference, SyntaxSet, SyntaxSetBuilder};
|
use syntect::parsing::{SyntaxReference, SyntaxSet, SyntaxSetBuilder};
|
||||||
|
|
||||||
use crate::errors::*;
|
use path_abs::PathAbs;
|
||||||
use crate::inputfile::{InputFile, InputFileReader};
|
|
||||||
|
use crate::assets_metadata::AssetsMetadata;
|
||||||
|
use crate::error::*;
|
||||||
|
use crate::input::{InputReader, OpenedInput, OpenedInputKind};
|
||||||
use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
|
use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -67,8 +71,11 @@ impl HighlightingAssets {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_cache(theme_set_path: &Path, syntax_set_path: &Path) -> Result<Self> {
|
pub fn from_cache(cache_path: &Path) -> Result<Self> {
|
||||||
let syntax_set_file = File::open(syntax_set_path).chain_err(|| {
|
let syntax_set_path = cache_path.join("syntaxes.bin");
|
||||||
|
let theme_set_path = cache_path.join("themes.bin");
|
||||||
|
|
||||||
|
let syntax_set_file = File::open(&syntax_set_path).chain_err(|| {
|
||||||
format!(
|
format!(
|
||||||
"Could not load cached syntax set '{}'",
|
"Could not load cached syntax set '{}'",
|
||||||
syntax_set_path.to_string_lossy()
|
syntax_set_path.to_string_lossy()
|
||||||
@@ -112,7 +119,7 @@ impl HighlightingAssets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn save_to_cache(&self, target_dir: &Path) -> Result<()> {
|
pub fn save_to_cache(&self, target_dir: &Path, current_version: &str) -> Result<()> {
|
||||||
let _ = fs::create_dir_all(target_dir);
|
let _ = fs::create_dir_all(target_dir);
|
||||||
let theme_set_path = target_dir.join("themes.bin");
|
let theme_set_path = target_dir.join("themes.bin");
|
||||||
let syntax_set_path = target_dir.join("syntaxes.bin");
|
let syntax_set_path = target_dir.join("syntaxes.bin");
|
||||||
@@ -141,6 +148,13 @@ impl HighlightingAssets {
|
|||||||
})?;
|
})?;
|
||||||
println!("okay");
|
println!("okay");
|
||||||
|
|
||||||
|
print!(
|
||||||
|
"Writing metadata to folder {} ... ",
|
||||||
|
target_dir.to_string_lossy()
|
||||||
|
);
|
||||||
|
AssetsMetadata::new(current_version).save_to_folder(target_dir)?;
|
||||||
|
println!("okay");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,8 +166,23 @@ impl HighlightingAssets {
|
|||||||
self.syntax_set.syntaxes()
|
self.syntax_set.syntaxes()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn themes(&self) -> impl Iterator<Item = &String> {
|
pub fn themes(&self) -> impl Iterator<Item = &str> {
|
||||||
self.theme_set.themes.keys()
|
self.theme_set.themes.keys().map(|s| s.as_ref())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn syntax_for_file_name(
|
||||||
|
&self,
|
||||||
|
file_name: impl AsRef<Path>,
|
||||||
|
mapping: &SyntaxMapping,
|
||||||
|
) -> Option<&SyntaxReference> {
|
||||||
|
let file_name = file_name.as_ref();
|
||||||
|
match mapping.get_syntax_for(file_name) {
|
||||||
|
Some(MappingTarget::MapToUnknown) => None,
|
||||||
|
Some(MappingTarget::MapTo(syntax_name)) => {
|
||||||
|
self.syntax_set.find_syntax_by_name(syntax_name)
|
||||||
|
}
|
||||||
|
None => self.get_extension_syntax(file_name.as_os_str()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_theme(&self, theme: &str) -> &Theme {
|
pub(crate) fn get_theme(&self, theme: &str) -> &Theme {
|
||||||
@@ -168,7 +197,7 @@ impl HighlightingAssets {
|
|||||||
theme
|
theme
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
&self.theme_set.themes[self.fallback_theme.unwrap_or(Self::default_theme())]
|
&self.theme_set.themes[self.fallback_theme.unwrap_or_else(|| Self::default_theme())]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,64 +205,99 @@ impl HighlightingAssets {
|
|||||||
pub(crate) fn get_syntax(
|
pub(crate) fn get_syntax(
|
||||||
&self,
|
&self,
|
||||||
language: Option<&str>,
|
language: Option<&str>,
|
||||||
filename: InputFile,
|
input: &mut OpenedInput,
|
||||||
reader: &mut InputFileReader,
|
|
||||||
mapping: &SyntaxMapping,
|
mapping: &SyntaxMapping,
|
||||||
) -> &SyntaxReference {
|
) -> Result<&SyntaxReference> {
|
||||||
let syntax = match (language, filename) {
|
if let Some(language) = language {
|
||||||
(Some(language), _) => self.syntax_set.find_syntax_by_token(language),
|
self.syntax_set
|
||||||
(None, InputFile::Ordinary(filename)) => {
|
.find_syntax_by_token(language)
|
||||||
let path = Path::new(filename);
|
.ok_or_else(|| ErrorKind::UnknownSyntax(language.to_owned()).into())
|
||||||
|
} else {
|
||||||
|
let line_syntax = self.get_first_line_syntax(&mut input.reader);
|
||||||
|
|
||||||
let file_name = path.file_name().and_then(|n| n.to_str()).unwrap_or("");
|
// Get the path of the file:
|
||||||
let extension = path.extension().and_then(|x| x.to_str()).unwrap_or("");
|
// If this was set by the metadata, that will take priority.
|
||||||
|
// If it wasn't, it will use the real file path (if available).
|
||||||
|
let path_str =
|
||||||
|
input
|
||||||
|
.metadata
|
||||||
|
.user_provided_name
|
||||||
|
.as_ref()
|
||||||
|
.or_else(|| match input.kind {
|
||||||
|
OpenedInputKind::OrdinaryFile(ref path) => Some(path),
|
||||||
|
_ => None,
|
||||||
|
});
|
||||||
|
|
||||||
let ext_syntax = self
|
if let Some(path_str) = path_str {
|
||||||
.syntax_set
|
// If a path was provided, we try and detect the syntax based on extension mappings.
|
||||||
.find_syntax_by_extension(&file_name)
|
let path = Path::new(path_str);
|
||||||
.or_else(|| self.syntax_set.find_syntax_by_extension(&extension));
|
let absolute_path = PathAbs::new(path)
|
||||||
let line_syntax = String::from_utf8(reader.first_line.clone())
|
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|l| self.syntax_set.find_syntax_by_first_line(&l));
|
.map(|p| p.as_path().to_path_buf())
|
||||||
|
.unwrap_or_else(|| path.to_owned());
|
||||||
|
|
||||||
let absolute_path = path.canonicalize().ok().unwrap_or(path.to_owned());
|
|
||||||
match mapping.get_syntax_for(absolute_path) {
|
match mapping.get_syntax_for(absolute_path) {
|
||||||
Some(MappingTarget::MapTo(syntax_name)) => {
|
Some(MappingTarget::MapToUnknown) => line_syntax.ok_or_else(|| {
|
||||||
// TODO: we should probably return an error here if this syntax can not be
|
ErrorKind::UndetectedSyntax(path.to_string_lossy().into()).into()
|
||||||
// found. Currently, we just fall back to 'plain'.
|
}),
|
||||||
self.syntax_set.find_syntax_by_name(syntax_name)
|
|
||||||
}
|
|
||||||
Some(MappingTarget::MapToUnknown) => line_syntax,
|
|
||||||
None => ext_syntax.or(line_syntax),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(None, InputFile::StdIn) => String::from_utf8(reader.first_line.clone())
|
|
||||||
.ok()
|
|
||||||
.and_then(|l| self.syntax_set.find_syntax_by_first_line(&l)),
|
|
||||||
(_, InputFile::ThemePreviewFile) => self.syntax_set.find_syntax_by_name("Rust"),
|
|
||||||
};
|
|
||||||
|
|
||||||
syntax.unwrap_or_else(|| self.syntax_set.find_syntax_plain_text())
|
Some(MappingTarget::MapTo(syntax_name)) => self
|
||||||
|
.syntax_set
|
||||||
|
.find_syntax_by_name(syntax_name)
|
||||||
|
.ok_or_else(|| ErrorKind::UnknownSyntax(syntax_name.to_owned()).into()),
|
||||||
|
|
||||||
|
None => {
|
||||||
|
let file_name = path.file_name().unwrap_or_default();
|
||||||
|
self.get_extension_syntax(file_name)
|
||||||
|
.or(line_syntax)
|
||||||
|
.ok_or_else(|| {
|
||||||
|
ErrorKind::UndetectedSyntax(path.to_string_lossy().into()).into()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// If a path wasn't provided, we fall back to the detect first-line syntax.
|
||||||
|
line_syntax.ok_or_else(|| ErrorKind::UndetectedSyntax("[unknown]".into()).into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_extension_syntax(&self, file_name: &OsStr) -> Option<&SyntaxReference> {
|
||||||
|
self.syntax_set
|
||||||
|
.find_syntax_by_extension(file_name.to_str().unwrap_or_default())
|
||||||
|
.or_else(|| {
|
||||||
|
self.syntax_set.find_syntax_by_extension(
|
||||||
|
Path::new(file_name)
|
||||||
|
.extension()
|
||||||
|
.and_then(|x| x.to_str())
|
||||||
|
.unwrap_or_default(),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_first_line_syntax(&self, reader: &mut InputReader) -> Option<&SyntaxReference> {
|
||||||
|
String::from_utf8(reader.first_line.clone())
|
||||||
|
.ok()
|
||||||
|
.and_then(|l| self.syntax_set.find_syntax_by_first_line(&l))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::ffi::OsStr;
|
use super::*;
|
||||||
use std::fs::File;
|
|
||||||
use std::io;
|
|
||||||
use std::io::Write;
|
|
||||||
|
|
||||||
|
use std::ffi::OsStr;
|
||||||
|
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Write;
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
|
|
||||||
use crate::assets::HighlightingAssets;
|
use crate::input::Input;
|
||||||
use crate::inputfile::InputFile;
|
|
||||||
use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
|
|
||||||
|
|
||||||
struct SyntaxDetectionTest<'a> {
|
struct SyntaxDetectionTest<'a> {
|
||||||
assets: HighlightingAssets,
|
assets: HighlightingAssets,
|
||||||
pub syntax_mapping: SyntaxMapping<'a>,
|
pub syntax_mapping: SyntaxMapping<'a>,
|
||||||
temp_dir: TempDir,
|
pub temp_dir: TempDir,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> SyntaxDetectionTest<'a> {
|
impl<'a> SyntaxDetectionTest<'a> {
|
||||||
@@ -246,26 +310,80 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn synax_for_file_with_content(&self, file_name: &str, first_line: &str) -> String {
|
fn syntax_for_real_file_with_content_os(
|
||||||
|
&self,
|
||||||
|
file_name: &OsStr,
|
||||||
|
first_line: &str,
|
||||||
|
) -> String {
|
||||||
let file_path = self.temp_dir.path().join(file_name);
|
let file_path = self.temp_dir.path().join(file_name);
|
||||||
{
|
{
|
||||||
let mut temp_file = File::create(&file_path).unwrap();
|
let mut temp_file = File::create(&file_path).unwrap();
|
||||||
writeln!(temp_file, "{}", first_line).unwrap();
|
writeln!(temp_file, "{}", first_line).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
let input_file = InputFile::Ordinary(OsStr::new(&file_path));
|
let input = Input::ordinary_file(file_path.as_os_str());
|
||||||
let syntax = self.assets.get_syntax(
|
let dummy_stdin: &[u8] = &[];
|
||||||
None,
|
let mut opened_input = input.open(dummy_stdin).unwrap();
|
||||||
input_file,
|
|
||||||
&mut input_file.get_reader(&io::stdin()).unwrap(),
|
|
||||||
&self.syntax_mapping,
|
|
||||||
);
|
|
||||||
|
|
||||||
syntax.name.clone()
|
self.assets
|
||||||
|
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
||||||
|
.unwrap_or_else(|_| self.assets.syntax_set.find_syntax_plain_text())
|
||||||
|
.name
|
||||||
|
.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn syntax_for_file_with_content_os(&self, file_name: &OsStr, first_line: &str) -> String {
|
||||||
|
let file_path = self.temp_dir.path().join(file_name);
|
||||||
|
let input = Input::from_reader(Box::new(BufReader::new(first_line.as_bytes())))
|
||||||
|
.with_name(Some(file_path.as_os_str()));
|
||||||
|
let dummy_stdin: &[u8] = &[];
|
||||||
|
let mut opened_input = input.open(dummy_stdin).unwrap();
|
||||||
|
|
||||||
|
self.assets
|
||||||
|
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
||||||
|
.unwrap_or_else(|_| self.assets.syntax_set.find_syntax_plain_text())
|
||||||
|
.name
|
||||||
|
.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
fn syntax_for_file_os(&self, file_name: &OsStr) -> String {
|
||||||
|
self.syntax_for_file_with_content_os(file_name, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn syntax_for_file_with_content(&self, file_name: &str, first_line: &str) -> String {
|
||||||
|
self.syntax_for_file_with_content_os(OsStr::new(file_name), first_line)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn syntax_for_file(&self, file_name: &str) -> String {
|
fn syntax_for_file(&self, file_name: &str) -> String {
|
||||||
self.synax_for_file_with_content(file_name, "")
|
self.syntax_for_file_with_content(file_name, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn syntax_for_stdin_with_content(&self, file_name: &str, content: &[u8]) -> String {
|
||||||
|
let input = Input::stdin().with_name(Some(OsStr::new(file_name)));
|
||||||
|
let mut opened_input = input.open(content).unwrap();
|
||||||
|
|
||||||
|
self.assets
|
||||||
|
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
||||||
|
.unwrap_or_else(|_| self.assets.syntax_set.find_syntax_plain_text())
|
||||||
|
.name
|
||||||
|
.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn syntax_is_same_for_inputkinds(&self, file_name: &str, content: &str) -> bool {
|
||||||
|
let as_file = self.syntax_for_real_file_with_content_os(file_name.as_ref(), content);
|
||||||
|
let as_reader = self.syntax_for_file_with_content_os(file_name.as_ref(), content);
|
||||||
|
let consistent = as_file == as_reader;
|
||||||
|
// TODO: Compare StdIn somehow?
|
||||||
|
|
||||||
|
if !consistent {
|
||||||
|
eprintln!(
|
||||||
|
"Inconsistent syntax detection:\nFor File: {}\nFor Reader: {}",
|
||||||
|
as_file, as_reader
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
consistent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,14 +402,48 @@ mod tests {
|
|||||||
assert_eq!(test.syntax_for_file("Makefile"), "Makefile");
|
assert_eq!(test.syntax_for_file("Makefile"), "Makefile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
#[test]
|
||||||
|
fn syntax_detection_invalid_utf8() {
|
||||||
|
use std::os::unix::ffi::OsStrExt;
|
||||||
|
|
||||||
|
let test = SyntaxDetectionTest::new();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
test.syntax_for_file_os(OsStr::from_bytes(b"invalid_\xFEutf8_filename.rs")),
|
||||||
|
"Rust"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn syntax_detection_same_for_inputkinds() {
|
||||||
|
let mut test = SyntaxDetectionTest::new();
|
||||||
|
|
||||||
|
test.syntax_mapping
|
||||||
|
.insert("*.myext", MappingTarget::MapTo("C"))
|
||||||
|
.ok();
|
||||||
|
test.syntax_mapping
|
||||||
|
.insert("MY_FILE", MappingTarget::MapTo("Markdown"))
|
||||||
|
.ok();
|
||||||
|
|
||||||
|
assert!(test.syntax_is_same_for_inputkinds("Test.md", ""));
|
||||||
|
assert!(test.syntax_is_same_for_inputkinds("Test.txt", "#!/bin/bash"));
|
||||||
|
assert!(test.syntax_is_same_for_inputkinds(".bashrc", ""));
|
||||||
|
assert!(test.syntax_is_same_for_inputkinds("test.h", ""));
|
||||||
|
assert!(test.syntax_is_same_for_inputkinds("test.js", "#!/bin/bash"));
|
||||||
|
assert!(test.syntax_is_same_for_inputkinds("test.myext", ""));
|
||||||
|
assert!(test.syntax_is_same_for_inputkinds("MY_FILE", ""));
|
||||||
|
assert!(test.syntax_is_same_for_inputkinds("MY_FILE", "<?php"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn syntax_detection_well_defined_mapping_for_duplicate_extensions() {
|
fn syntax_detection_well_defined_mapping_for_duplicate_extensions() {
|
||||||
let test = SyntaxDetectionTest::new();
|
let test = SyntaxDetectionTest::new();
|
||||||
|
|
||||||
assert_eq!(test.syntax_for_file("test.h"), "C++");
|
assert_eq!(test.syntax_for_file("test.h"), "C++");
|
||||||
assert_eq!(test.syntax_for_file("test.sass"), "Sass");
|
assert_eq!(test.syntax_for_file("test.sass"), "Sass");
|
||||||
assert_eq!(test.syntax_for_file("test.hs"), "Haskell (improved)");
|
|
||||||
assert_eq!(test.syntax_for_file("test.js"), "JavaScript (Babel)");
|
assert_eq!(test.syntax_for_file("test.js"), "JavaScript (Babel)");
|
||||||
|
assert_eq!(test.syntax_for_file("test.fs"), "F#");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -299,15 +451,15 @@ mod tests {
|
|||||||
let test = SyntaxDetectionTest::new();
|
let test = SyntaxDetectionTest::new();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
test.synax_for_file_with_content("my_script", "#!/bin/bash"),
|
test.syntax_for_file_with_content("my_script", "#!/bin/bash"),
|
||||||
"Bourne Again Shell (bash)"
|
"Bourne Again Shell (bash)"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
test.synax_for_file_with_content("build", "#!/bin/bash"),
|
test.syntax_for_file_with_content("build", "#!/bin/bash"),
|
||||||
"Bourne Again Shell (bash)"
|
"Bourne Again Shell (bash)"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
test.synax_for_file_with_content("my_script", "<?php"),
|
test.syntax_for_file_with_content("my_script", "<?php"),
|
||||||
"PHP"
|
"PHP"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -333,4 +485,46 @@ mod tests {
|
|||||||
.ok();
|
.ok();
|
||||||
assert_eq!(test.syntax_for_file("README.MD"), "Markdown");
|
assert_eq!(test.syntax_for_file("README.MD"), "Markdown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn syntax_detection_stdin_filename() {
|
||||||
|
let test = SyntaxDetectionTest::new();
|
||||||
|
|
||||||
|
// from file extension
|
||||||
|
assert_eq!(test.syntax_for_stdin_with_content("test.cpp", b"a"), "C++");
|
||||||
|
// from first line (fallback)
|
||||||
|
assert_eq!(
|
||||||
|
test.syntax_for_stdin_with_content("my_script", b"#!/bin/bash"),
|
||||||
|
"Bourne Again Shell (bash)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
#[test]
|
||||||
|
fn syntax_detection_for_symlinked_file() {
|
||||||
|
use std::os::unix::fs::symlink;
|
||||||
|
|
||||||
|
let test = SyntaxDetectionTest::new();
|
||||||
|
let file_path = test.temp_dir.path().join("my_ssh_config_filename");
|
||||||
|
{
|
||||||
|
File::create(&file_path).unwrap();
|
||||||
|
}
|
||||||
|
let file_path_symlink = test.temp_dir.path().join(".ssh").join("config");
|
||||||
|
|
||||||
|
std::fs::create_dir(test.temp_dir.path().join(".ssh"))
|
||||||
|
.expect("creation of directory succeeds");
|
||||||
|
symlink(&file_path, &file_path_symlink).expect("creation of symbolic link succeeds");
|
||||||
|
|
||||||
|
let input = Input::ordinary_file(file_path_symlink.as_os_str());
|
||||||
|
let dummy_stdin: &[u8] = &[];
|
||||||
|
let mut opened_input = input.open(dummy_stdin).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
test.assets
|
||||||
|
.get_syntax(None, &mut opened_input, &test.syntax_mapping)
|
||||||
|
.unwrap_or_else(|_| test.assets.syntax_set.find_syntax_plain_text())
|
||||||
|
.name,
|
||||||
|
"SSH Config"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
use std::fs::File;
|
||||||
|
use std::path::Path;
|
||||||
|
use std::time::SystemTime;
|
||||||
|
|
||||||
|
use semver::Version;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::error::*;
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Default, Serialize, Deserialize)]
|
||||||
|
pub struct AssetsMetadata {
|
||||||
|
bat_version: Option<String>,
|
||||||
|
creation_time: Option<SystemTime>,
|
||||||
|
}
|
||||||
|
|
||||||
|
const FILENAME: &str = "metadata.yaml";
|
||||||
|
|
||||||
|
impl AssetsMetadata {
|
||||||
|
pub(crate) fn new(current_version: &str) -> AssetsMetadata {
|
||||||
|
AssetsMetadata {
|
||||||
|
bat_version: Some(current_version.to_owned()),
|
||||||
|
creation_time: Some(SystemTime::now()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn save_to_folder(&self, path: &Path) -> Result<()> {
|
||||||
|
let file = File::create(path.join(FILENAME))?;
|
||||||
|
serde_yaml::to_writer(file, self)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn try_load_from_folder(path: &Path) -> Result<Self> {
|
||||||
|
let file = File::open(path.join(FILENAME))?;
|
||||||
|
Ok(serde_yaml::from_reader(file)?)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Load metadata about the stored cache file from the given folder.
|
||||||
|
///
|
||||||
|
/// There are several possibilities:
|
||||||
|
/// - We find a metadata.yaml file and are able to parse it
|
||||||
|
/// => return the contained information
|
||||||
|
/// - We find a metadata.yaml file and but are not able to parse it
|
||||||
|
/// => return a SerdeYamlError
|
||||||
|
/// - We do not find a metadata.yaml file but a syntaxes.bin or themes.bin file
|
||||||
|
/// => assume that these were created by an old version of bat and return
|
||||||
|
/// AssetsMetadata::default() without version information
|
||||||
|
/// - We do not find a metadata.yaml file and no cached assets
|
||||||
|
/// => no user provided assets are available, return None
|
||||||
|
pub fn load_from_folder(path: &Path) -> Result<Option<Self>> {
|
||||||
|
match Self::try_load_from_folder(path) {
|
||||||
|
Ok(metadata) => Ok(Some(metadata)),
|
||||||
|
Err(e) => match e.kind() {
|
||||||
|
ErrorKind::SerdeYamlError(_) => Err(e),
|
||||||
|
_ => {
|
||||||
|
if path.join("syntaxes.bin").exists() || path.join("themes.bin").exists() {
|
||||||
|
Ok(Some(Self::default()))
|
||||||
|
} else {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_compatible_with(&self, current_version: &str) -> bool {
|
||||||
|
let current_version =
|
||||||
|
Version::parse(current_version).expect("bat follows semantic versioning");
|
||||||
|
let stored_version = self
|
||||||
|
.bat_version
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|ver| Version::parse(ver).ok());
|
||||||
|
|
||||||
|
if let Some(stored_version) = stored_version {
|
||||||
|
current_version.major == stored_version.major
|
||||||
|
&& current_version.minor == stored_version.minor
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+110
-60
@@ -1,5 +1,6 @@
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use std::ffi::OsStr;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use atty::{self, Stream};
|
use atty::{self, Stream};
|
||||||
@@ -9,20 +10,18 @@ use crate::{
|
|||||||
config::{get_args_from_config_file, get_args_from_env_var},
|
config::{get_args_from_config_file, get_args_from_env_var},
|
||||||
};
|
};
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use wild;
|
|
||||||
|
|
||||||
use console::Term;
|
use console::Term;
|
||||||
|
|
||||||
#[cfg(windows)]
|
use crate::input::{new_file_input, new_stdin_input};
|
||||||
use ansi_term;
|
|
||||||
|
|
||||||
use bat::{
|
use bat::{
|
||||||
config::{
|
assets::HighlightingAssets,
|
||||||
Config, HighlightedLineRanges, InputFile, LineRange, LineRanges, MappingTarget, OutputWrap,
|
config::{Config, VisibleLines},
|
||||||
PagingMode, StyleComponent, StyleComponents, SyntaxMapping,
|
error::*,
|
||||||
},
|
input::Input,
|
||||||
errors::*,
|
line_range::{HighlightedLineRanges, LineRange, LineRanges},
|
||||||
HighlightingAssets,
|
style::{StyleComponent, StyleComponents},
|
||||||
|
MappingTarget, PagingMode, SyntaxMapping, WrappingMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn is_truecolor_terminal() -> bool {
|
fn is_truecolor_terminal() -> bool {
|
||||||
@@ -76,18 +75,19 @@ impl App {
|
|||||||
Ok(clap_app::build_app(interactive_output).get_matches_from(args))
|
Ok(clap_app::build_app(interactive_output).get_matches_from(args))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn config(&self) -> Result<Config> {
|
pub fn config(&self, inputs: &[Input]) -> Result<Config> {
|
||||||
let files = self.files();
|
|
||||||
let style_components = self.style_components()?;
|
let style_components = self.style_components()?;
|
||||||
|
|
||||||
let paging_mode = match self.matches.value_of("paging") {
|
let paging_mode = match self.matches.value_of("paging") {
|
||||||
Some("always") => PagingMode::Always,
|
Some("always") => PagingMode::Always,
|
||||||
Some("never") => PagingMode::Never,
|
Some("never") => PagingMode::Never,
|
||||||
Some("auto") | _ => {
|
Some("auto") | None => {
|
||||||
if self.matches.occurrences_of("plain") > 1 {
|
if self.matches.occurrences_of("plain") > 1 {
|
||||||
// If we have -pp as an option when in auto mode, the pager should be disabled.
|
// If we have -pp as an option when in auto mode, the pager should be disabled.
|
||||||
PagingMode::Never
|
PagingMode::Never
|
||||||
} else if files.contains(&InputFile::StdIn) {
|
} else if self.matches.is_present("no-paging") {
|
||||||
|
PagingMode::Never
|
||||||
|
} else if inputs.iter().any(Input::is_stdin) {
|
||||||
// If we are reading from stdin, only enable paging if we write to an
|
// If we are reading from stdin, only enable paging if we write to an
|
||||||
// interactive terminal and if we do not *read* from an interactive
|
// interactive terminal and if we do not *read* from an interactive
|
||||||
// terminal.
|
// terminal.
|
||||||
@@ -102,6 +102,7 @@ impl App {
|
|||||||
PagingMode::Never
|
PagingMode::Never
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ => unreachable!("other values for --paging are not allowed"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut syntax_mapping = SyntaxMapping::builtin();
|
let mut syntax_mapping = SyntaxMapping::builtin();
|
||||||
@@ -146,34 +147,37 @@ impl App {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
show_nonprintable: self.matches.is_present("show-all"),
|
show_nonprintable: self.matches.is_present("show-all"),
|
||||||
output_wrap: if self.interactive_output || maybe_term_width.is_some() {
|
wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
|
||||||
match self.matches.value_of("wrap") {
|
match self.matches.value_of("wrap") {
|
||||||
Some("character") => OutputWrap::Character,
|
Some("character") => WrappingMode::Character,
|
||||||
Some("never") => OutputWrap::None,
|
Some("never") => WrappingMode::NoWrapping,
|
||||||
Some("auto") | _ => {
|
Some("auto") | None => {
|
||||||
if style_components.plain() {
|
if style_components.plain() {
|
||||||
OutputWrap::None
|
WrappingMode::NoWrapping
|
||||||
} else {
|
} else {
|
||||||
OutputWrap::Character
|
WrappingMode::Character
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ => unreachable!("other values for --paging are not allowed"),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We don't have the tty width when piping to another program.
|
// We don't have the tty width when piping to another program.
|
||||||
// There's no point in wrapping when this is the case.
|
// There's no point in wrapping when this is the case.
|
||||||
OutputWrap::None
|
WrappingMode::NoWrapping
|
||||||
},
|
|
||||||
colored_output: match self.matches.value_of("color") {
|
|
||||||
Some("always") => true,
|
|
||||||
Some("never") => false,
|
|
||||||
Some("auto") | _ => self.interactive_output,
|
|
||||||
},
|
},
|
||||||
|
colored_output: self.matches.is_present("force-colorization")
|
||||||
|
|| match self.matches.value_of("color") {
|
||||||
|
Some("always") => true,
|
||||||
|
Some("never") => false,
|
||||||
|
Some("auto") => env::var_os("NO_COLOR").is_none() && self.interactive_output,
|
||||||
|
_ => unreachable!("other values for --color are not allowed"),
|
||||||
|
},
|
||||||
paging_mode,
|
paging_mode,
|
||||||
term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
|
term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
|
||||||
loop_through: !(self.interactive_output
|
loop_through: !(self.interactive_output
|
||||||
|| self.matches.value_of("color") == Some("always")
|
|| self.matches.value_of("color") == Some("always")
|
||||||
|| self.matches.value_of("decorations") == Some("always")),
|
|| self.matches.value_of("decorations") == Some("always")
|
||||||
files,
|
|| self.matches.is_present("force-colorization")),
|
||||||
tab_width: self
|
tab_width: self
|
||||||
.matches
|
.matches
|
||||||
.value_of("tabs")
|
.value_of("tabs")
|
||||||
@@ -200,55 +204,91 @@ impl App {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| String::from(HighlightingAssets::default_theme())),
|
.unwrap_or_else(|| String::from(HighlightingAssets::default_theme())),
|
||||||
line_ranges: self
|
visible_lines: match self.matches.is_present("diff") {
|
||||||
.matches
|
#[cfg(feature = "git")]
|
||||||
.values_of("line-range")
|
true => VisibleLines::DiffContext(
|
||||||
.map(|vs| vs.map(LineRange::from).collect())
|
self.matches
|
||||||
.transpose()?
|
.value_of("diff-context")
|
||||||
.map(LineRanges::from)
|
.and_then(|t| t.parse().ok())
|
||||||
.unwrap_or_default(),
|
.unwrap_or(2),
|
||||||
|
),
|
||||||
|
|
||||||
|
_ => VisibleLines::Ranges(
|
||||||
|
self.matches
|
||||||
|
.values_of("line-range")
|
||||||
|
.map(|vs| vs.map(LineRange::from).collect())
|
||||||
|
.transpose()?
|
||||||
|
.map(LineRanges::from)
|
||||||
|
.unwrap_or_default(),
|
||||||
|
),
|
||||||
|
},
|
||||||
style_components,
|
style_components,
|
||||||
syntax_mapping,
|
syntax_mapping,
|
||||||
pager: self.matches.value_of("pager"),
|
pager: self.matches.value_of("pager"),
|
||||||
use_italic_text: match self.matches.value_of("italic-text") {
|
use_italic_text: self.matches.value_of("italic-text") == Some("always"),
|
||||||
Some("always") => true,
|
|
||||||
_ => false,
|
|
||||||
},
|
|
||||||
highlighted_lines: self
|
highlighted_lines: self
|
||||||
.matches
|
.matches
|
||||||
.values_of("highlight-line")
|
.values_of("highlight-line")
|
||||||
.map(|ws| ws.map(LineRange::from).collect())
|
.map(|ws| ws.map(LineRange::from).collect())
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.map(LineRanges::from)
|
.map(LineRanges::from)
|
||||||
.map(|lr| HighlightedLineRanges(lr))
|
.map(HighlightedLineRanges)
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn files(&self) -> Vec<InputFile> {
|
pub fn inputs(&self) -> Result<Vec<Input>> {
|
||||||
self.matches
|
// verify equal length of file-names and input FILEs
|
||||||
.values_of_os("FILE")
|
match self.matches.values_of("file-name") {
|
||||||
.map(|values| {
|
Some(ref filenames)
|
||||||
values
|
if self.matches.values_of_os("FILE").is_some()
|
||||||
.map(|filename| {
|
&& filenames.len() != self.matches.values_of_os("FILE").unwrap().len() =>
|
||||||
if filename == "-" {
|
{
|
||||||
InputFile::StdIn
|
return Err("Must be one file name per input type.".into());
|
||||||
} else {
|
}
|
||||||
InputFile::Ordinary(filename)
|
_ => {}
|
||||||
}
|
}
|
||||||
})
|
let filenames: Option<Vec<&str>> = self
|
||||||
.collect()
|
.matches
|
||||||
})
|
.values_of("file-name")
|
||||||
.unwrap_or_else(|| vec![InputFile::StdIn])
|
.map(|values| values.collect());
|
||||||
|
|
||||||
|
let mut filenames_or_none: Box<dyn Iterator<Item = _>> = match filenames {
|
||||||
|
Some(ref filenames) => Box::new(filenames.iter().map(|name| Some(OsStr::new(*name)))),
|
||||||
|
None => Box::new(std::iter::repeat(None)),
|
||||||
|
};
|
||||||
|
let files: Option<Vec<&OsStr>> = self.matches.values_of_os("FILE").map(|vs| vs.collect());
|
||||||
|
|
||||||
|
if files.is_none() {
|
||||||
|
return Ok(vec![new_stdin_input(
|
||||||
|
filenames_or_none.next().unwrap_or(None),
|
||||||
|
)]);
|
||||||
|
}
|
||||||
|
let files_or_none: Box<dyn Iterator<Item = _>> = match files {
|
||||||
|
Some(ref files) => Box::new(files.iter().map(|name| Some(*name))),
|
||||||
|
None => Box::new(std::iter::repeat(None)),
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut file_input = Vec::new();
|
||||||
|
for (filepath, provided_name) in files_or_none.zip(filenames_or_none) {
|
||||||
|
if let Some(filepath) = filepath {
|
||||||
|
if filepath.to_str().unwrap_or_default() == "-" {
|
||||||
|
file_input.push(new_stdin_input(provided_name));
|
||||||
|
} else {
|
||||||
|
file_input.push(new_file_input(filepath, provided_name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(file_input)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn style_components(&self) -> Result<StyleComponents> {
|
fn style_components(&self) -> Result<StyleComponents> {
|
||||||
let matches = &self.matches;
|
let matches = &self.matches;
|
||||||
Ok(StyleComponents(
|
let mut styled_components =
|
||||||
if matches.value_of("decorations") == Some("never") {
|
StyleComponents(if matches.value_of("decorations") == Some("never") {
|
||||||
HashSet::new()
|
HashSet::new()
|
||||||
} else if matches.is_present("number") {
|
} else if matches.is_present("number") {
|
||||||
[StyleComponent::Numbers].iter().cloned().collect()
|
[StyleComponent::LineNumbers].iter().cloned().collect()
|
||||||
} else if matches.is_present("plain") {
|
} else if matches.is_present("plain") {
|
||||||
[StyleComponent::Plain].iter().cloned().collect()
|
[StyleComponent::Plain].iter().cloned().collect()
|
||||||
} else {
|
} else {
|
||||||
@@ -279,7 +319,17 @@ impl App {
|
|||||||
acc.extend(components.iter().cloned());
|
acc.extend(components.iter().cloned());
|
||||||
acc
|
acc
|
||||||
})
|
})
|
||||||
},
|
});
|
||||||
))
|
|
||||||
|
// If `grid` is set, remove `rule` as it is a subset of `grid`, and print a warning.
|
||||||
|
if styled_components.grid() && styled_components.0.remove(&StyleComponent::Rule) {
|
||||||
|
use ansi_term::Colour::Yellow;
|
||||||
|
eprintln!(
|
||||||
|
"{}: Style 'rule' is a subset of style 'grid', 'rule' will not be visible.",
|
||||||
|
Yellow.paint("[bat warning]"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(styled_components)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-15
@@ -1,18 +1,13 @@
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
|
||||||
|
use clap::crate_version;
|
||||||
|
|
||||||
use crate::directories::PROJECT_DIRS;
|
use crate::directories::PROJECT_DIRS;
|
||||||
|
|
||||||
use bat::HighlightingAssets;
|
use bat::assets::HighlightingAssets;
|
||||||
|
use bat::assets_metadata::AssetsMetadata;
|
||||||
fn theme_set_path() -> PathBuf {
|
use bat::error::*;
|
||||||
PROJECT_DIRS.cache_dir().join("themes.bin")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn syntax_set_path() -> PathBuf {
|
|
||||||
PROJECT_DIRS.cache_dir().join("syntaxes.bin")
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn config_dir() -> Cow<'static, str> {
|
pub fn config_dir() -> Cow<'static, str> {
|
||||||
PROJECT_DIRS.config_dir().to_string_lossy()
|
PROJECT_DIRS.config_dir().to_string_lossy()
|
||||||
@@ -23,16 +18,41 @@ pub fn cache_dir() -> Cow<'static, str> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_assets() {
|
pub fn clear_assets() {
|
||||||
|
let theme_set_path = PROJECT_DIRS.cache_dir().join("themes.bin");
|
||||||
|
let syntax_set_path = PROJECT_DIRS.cache_dir().join("syntaxes.bin");
|
||||||
|
let metadata_file = PROJECT_DIRS.cache_dir().join("metadata.yaml");
|
||||||
|
|
||||||
print!("Clearing theme set cache ... ");
|
print!("Clearing theme set cache ... ");
|
||||||
fs::remove_file(theme_set_path()).ok();
|
fs::remove_file(theme_set_path).ok();
|
||||||
println!("okay");
|
println!("okay");
|
||||||
|
|
||||||
print!("Clearing syntax set cache ... ");
|
print!("Clearing syntax set cache ... ");
|
||||||
fs::remove_file(syntax_set_path()).ok();
|
fs::remove_file(syntax_set_path).ok();
|
||||||
|
println!("okay");
|
||||||
|
|
||||||
|
print!("Clearing metadata file ... ");
|
||||||
|
fs::remove_file(metadata_file).ok();
|
||||||
println!("okay");
|
println!("okay");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn assets_from_cache_or_binary() -> HighlightingAssets {
|
pub fn assets_from_cache_or_binary() -> Result<HighlightingAssets> {
|
||||||
HighlightingAssets::from_cache(&theme_set_path(), &syntax_set_path())
|
let cache_dir = PROJECT_DIRS.cache_dir();
|
||||||
.unwrap_or(HighlightingAssets::from_binary())
|
if let Some(metadata) = AssetsMetadata::load_from_folder(&cache_dir)? {
|
||||||
|
if !metadata.is_compatible_with(crate_version!()) {
|
||||||
|
return Err(format!(
|
||||||
|
"The binary caches for the user-customized syntaxes and themes \
|
||||||
|
in '{}' are not compatible with this version of bat ({}). To solve this, \
|
||||||
|
either rebuild the cache (bat cache --build) or remove \
|
||||||
|
the custom syntaxes/themes (bat cache --clear).\n\
|
||||||
|
For more information, see:\n\n \
|
||||||
|
https://github.com/sharkdp/bat#adding-new-syntaxes--language-definitions",
|
||||||
|
cache_dir.to_string_lossy(),
|
||||||
|
crate_version!()
|
||||||
|
)
|
||||||
|
.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(HighlightingAssets::from_cache(&cache_dir)
|
||||||
|
.unwrap_or_else(|_| HighlightingAssets::from_binary()))
|
||||||
}
|
}
|
||||||
|
|||||||
+135
-40
@@ -1,14 +1,15 @@
|
|||||||
use clap::{App as ClapApp, AppSettings, Arg, ArgGroup, SubCommand};
|
use clap::{crate_name, crate_version, App as ClapApp, AppSettings, Arg, ArgGroup, SubCommand};
|
||||||
|
use std::env;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||||
let clap_color_setting = if interactive_output {
|
let clap_color_setting = if interactive_output && env::var_os("NO_COLOR").is_none() {
|
||||||
AppSettings::ColoredHelp
|
AppSettings::ColoredHelp
|
||||||
} else {
|
} else {
|
||||||
AppSettings::ColorNever
|
AppSettings::ColorNever
|
||||||
};
|
};
|
||||||
|
|
||||||
let app = ClapApp::new(crate_name!())
|
let mut app = ClapApp::new(crate_name!())
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.global_setting(clap_color_setting)
|
.global_setting(clap_color_setting)
|
||||||
.global_setting(AppSettings::DeriveDisplayOrder)
|
.global_setting(AppSettings::DeriveDisplayOrder)
|
||||||
@@ -23,6 +24,10 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
"A cat(1) clone with wings.\n\n\
|
"A cat(1) clone with wings.\n\n\
|
||||||
Use '--help' instead of '-h' to see a more detailed version of the help text.",
|
Use '--help' instead of '-h' to see a more detailed version of the help text.",
|
||||||
)
|
)
|
||||||
|
.after_help(
|
||||||
|
"Note: `bat -h` prints a short and concise overview while `bat --help` gives all \
|
||||||
|
details.",
|
||||||
|
)
|
||||||
.long_about("A cat(1) clone with syntax highlighting and Git integration.")
|
.long_about("A cat(1) clone with syntax highlighting and Git integration.")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("FILE")
|
Arg::with_name("FILE")
|
||||||
@@ -44,7 +49,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.long_help(
|
.long_help(
|
||||||
"Show non-printable characters like space, tab or newline. \
|
"Show non-printable characters like space, tab or newline. \
|
||||||
This option can also be used to print binary files. \
|
This option can also be used to print binary files. \
|
||||||
Use '--tabs' to control the width of the tab-placeholders."
|
Use '--tabs' to control the width of the tab-placeholders.",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
@@ -90,29 +95,79 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
'--highlight-line 40' highlights line 40\n \
|
'--highlight-line 40' highlights line 40\n \
|
||||||
'--highlight-line 30:40' highlights lines 30 to 40\n \
|
'--highlight-line 30:40' highlights lines 30 to 40\n \
|
||||||
'--highlight-line :40' highlights lines 1 to 40\n \
|
'--highlight-line :40' highlights lines 1 to 40\n \
|
||||||
'--highlight-line 40:' highlights lines 40 to the end of the file"
|
'--highlight-line 40:' highlights lines 40 to the end of the file",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("tabs")
|
Arg::with_name("file-name")
|
||||||
.long("tabs")
|
.long("file-name")
|
||||||
.overrides_with("tabs")
|
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.value_name("T")
|
.number_of_values(1)
|
||||||
.validator(
|
.multiple(true)
|
||||||
|t| {
|
.value_name("name")
|
||||||
t.parse::<u32>()
|
.help("Specify the name to display for a file.")
|
||||||
.map_err(|_t| "must be a number")
|
|
||||||
.map(|_t| ()) // Convert to Result<(), &str>
|
|
||||||
.map_err(|e| e.to_string())
|
|
||||||
}, // Convert to Result<(), String>
|
|
||||||
)
|
|
||||||
.help("Set the tab width to T spaces.")
|
|
||||||
.long_help(
|
.long_help(
|
||||||
"Set the tab width to T spaces. Use a width of 0 to pass tabs through \
|
"Specify the name to display for a file. Useful when piping \
|
||||||
directly",
|
data to bat from STDIN when bat does not otherwise know \
|
||||||
|
the filename. Note that the provided file name is also \
|
||||||
|
used for syntax detection.",
|
||||||
),
|
),
|
||||||
)
|
);
|
||||||
|
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
{
|
||||||
|
app = app
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("diff")
|
||||||
|
.long("diff")
|
||||||
|
.short("d")
|
||||||
|
.help("Only show lines that have been added/removed/modified.")
|
||||||
|
.long_help(
|
||||||
|
"Only show lines that have been added/removed/modified with respect \
|
||||||
|
to the Git index. Use --diff-context=N to control how much context you want to see.",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("diff-context")
|
||||||
|
.long("diff-context")
|
||||||
|
.overrides_with("diff-context")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("N")
|
||||||
|
.validator(
|
||||||
|
|n| {
|
||||||
|
n.parse::<usize>()
|
||||||
|
.map_err(|_| "must be a number")
|
||||||
|
.map(|_| ()) // Convert to Result<(), &str>
|
||||||
|
.map_err(|e| e.to_string())
|
||||||
|
}, // Convert to Result<(), String>
|
||||||
|
)
|
||||||
|
.hidden_short_help(true)
|
||||||
|
.long_help(
|
||||||
|
"Include N lines of context around added/removed/modified lines when using '--diff'.",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
app = app.arg(
|
||||||
|
Arg::with_name("tabs")
|
||||||
|
.long("tabs")
|
||||||
|
.overrides_with("tabs")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("T")
|
||||||
|
.validator(
|
||||||
|
|t| {
|
||||||
|
t.parse::<u32>()
|
||||||
|
.map_err(|_t| "must be a number")
|
||||||
|
.map(|_t| ()) // Convert to Result<(), &str>
|
||||||
|
.map_err(|e| e.to_string())
|
||||||
|
}, // Convert to Result<(), String>
|
||||||
|
)
|
||||||
|
.help("Set the tab width to T spaces.")
|
||||||
|
.long_help(
|
||||||
|
"Set the tab width to T spaces. Use a width of 0 to pass tabs through \
|
||||||
|
directly",
|
||||||
|
),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("wrap")
|
Arg::with_name("wrap")
|
||||||
.long("wrap")
|
.long("wrap")
|
||||||
@@ -140,7 +195,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
t.parse::<i32>()
|
t.parse::<i32>()
|
||||||
.map_err(|_e| "must be an offset or number")
|
.map_err(|_e| "must be an offset or number")
|
||||||
.and_then(|v| if v == 0 && !is_offset {
|
.and_then(|v| if v == 0 && !is_offset {
|
||||||
Err("terminal width cannot be zero".into())
|
Err("terminal width cannot be zero")
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
@@ -175,7 +230,8 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.help("When to use colors (*auto*, never, always).")
|
.help("When to use colors (*auto*, never, always).")
|
||||||
.long_help(
|
.long_help(
|
||||||
"Specify when to use colored output. The automatic mode \
|
"Specify when to use colored output. The automatic mode \
|
||||||
only enables colors if an interactive terminal is detected. \
|
only enables colors if an interactive terminal is detected - \
|
||||||
|
colors are automatically disabled if the output goes to a pipe.\n\
|
||||||
Possible values: *auto*, never, always.",
|
Possible values: *auto*, never, always.",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -206,6 +262,18 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
an interactive terminal is detected. Possible values: *auto*, never, always.",
|
an interactive terminal is detected. Possible values: *auto*, never, always.",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("force-colorization")
|
||||||
|
.long("force-colorization")
|
||||||
|
.short("f")
|
||||||
|
.conflicts_with("color")
|
||||||
|
.conflicts_with("decorations")
|
||||||
|
.overrides_with("force-colorization")
|
||||||
|
.hidden_short_help(true)
|
||||||
|
.long_help("Alias for '--decorations=always --color=always'. This is useful \
|
||||||
|
if the output of bat is piped to another program, but you want \
|
||||||
|
to keep the colorization/decorations.")
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("paging")
|
Arg::with_name("paging")
|
||||||
.long("paging")
|
.long("paging")
|
||||||
@@ -215,16 +283,23 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.possible_values(&["auto", "never", "always"])
|
.possible_values(&["auto", "never", "always"])
|
||||||
.default_value("auto")
|
.default_value("auto")
|
||||||
.hide_default_value(true)
|
.hide_default_value(true)
|
||||||
.help("Specify when to use the pager (*auto*, never, always).")
|
.help("Specify when to use the pager, or use `-P` to disable (*auto*, never, always).")
|
||||||
.long_help(
|
.long_help(
|
||||||
"Specify when to use the pager. To control which pager \
|
"Specify when to use the pager. To disable the pager, use \
|
||||||
is used, set the PAGER or BAT_PAGER environment \
|
--paging=never' or its alias,'-P'. To disable the pager permanently, \
|
||||||
variables (the latter takes precedence) or use the '--pager' option. \
|
set BAT_PAGER to an empty string. To control which pager is used, see the \
|
||||||
To disable the pager permanently, set BAT_PAGER to an empty string \
|
'--pager' option. Possible values: *auto*, never, always."
|
||||||
or set '--paging=never' in the configuration file. \
|
|
||||||
Possible values: *auto*, never, always.",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("no-paging")
|
||||||
|
.short("P")
|
||||||
|
.alias("no-pager")
|
||||||
|
.overrides_with("no-paging")
|
||||||
|
.hidden(true)
|
||||||
|
.hidden_short_help(true)
|
||||||
|
.help("Alias for '--paging=never'")
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("pager")
|
Arg::with_name("pager")
|
||||||
.long("pager")
|
.long("pager")
|
||||||
@@ -234,11 +309,10 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.hidden_short_help(true)
|
.hidden_short_help(true)
|
||||||
.help("Determine which pager to use.")
|
.help("Determine which pager to use.")
|
||||||
.long_help(
|
.long_help(
|
||||||
"Determine which pager is used. This option will overwrite \
|
"Determine which pager is used. This option will override the \
|
||||||
the PAGER and BAT_PAGER environment variables. The default \
|
PAGER and BAT_PAGER environment variables. The default pager is 'less'. \
|
||||||
pager is 'less'. To disable the pager completely, use the \
|
To control when the pager is used, see the '--paging' option. \
|
||||||
'--paging' option. \
|
Example: '--pager \"less -RF\"'."
|
||||||
Example: '--pager \"less -RF\"'.",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
@@ -289,11 +363,13 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.overrides_with("style")
|
.overrides_with("style")
|
||||||
.overrides_with("plain")
|
.overrides_with("plain")
|
||||||
.overrides_with("number")
|
.overrides_with("number")
|
||||||
// Cannot use clap's built in validation because we have to turn off clap's delimiters
|
// Cannot use claps built in validation because we have to turn off clap's delimiters
|
||||||
.validator(|val| {
|
.validator(|val| {
|
||||||
let mut invalid_vals = val.split(',').filter(|style| {
|
let mut invalid_vals = val.split(',').filter(|style| {
|
||||||
!&[
|
!&[
|
||||||
"auto", "full", "plain", "changes", "header", "grid", "numbers", "snip"
|
"auto", "full", "plain", "header", "grid", "rule", "numbers", "snip",
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
"changes",
|
||||||
]
|
]
|
||||||
.contains(style)
|
.contains(style)
|
||||||
});
|
});
|
||||||
@@ -306,7 +382,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
})
|
})
|
||||||
.help(
|
.help(
|
||||||
"Comma-separated list of style elements to display \
|
"Comma-separated list of style elements to display \
|
||||||
(*auto*, full, plain, changes, header, grid, numbers, snip).",
|
(*auto*, full, plain, changes, header, grid, rule, numbers, snip).",
|
||||||
)
|
)
|
||||||
.long_help(
|
.long_help(
|
||||||
"Configure which elements (line numbers, file headers, grid \
|
"Configure which elements (line numbers, file headers, grid \
|
||||||
@@ -315,8 +391,18 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
components to display (e.g. 'numbers,changes,grid') or a \
|
components to display (e.g. 'numbers,changes,grid') or a \
|
||||||
pre-defined style ('full'). To set a default style, add the \
|
pre-defined style ('full'). To set a default style, add the \
|
||||||
'--style=\"..\"' option to the configuration file or export the \
|
'--style=\"..\"' option to the configuration file or export the \
|
||||||
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\"). \
|
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\
|
||||||
Possible values: *auto*, full, plain, changes, header, grid, numbers, snip.",
|
Possible values:\n\n \
|
||||||
|
* full: enables all available components.\n \
|
||||||
|
* auto: same as 'full', unless the output is piped (default).\n \
|
||||||
|
* plain: disables all available components.\n \
|
||||||
|
* changes: show Git modification markers.\n \
|
||||||
|
* header: show filenames before the content.\n \
|
||||||
|
* grid: vertical/horizontal lines to separate side bar\n \
|
||||||
|
and the header from the content.\n \
|
||||||
|
* rule: horizontal lines to delimit files.\n \
|
||||||
|
* numbers: show line numbers in the side bar.\n \
|
||||||
|
* snip: draw separation lines between distinct line ranges.",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
@@ -327,6 +413,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.number_of_values(1)
|
.number_of_values(1)
|
||||||
.value_name("N:M")
|
.value_name("N:M")
|
||||||
|
.conflicts_with("diff")
|
||||||
.help("Only print the lines from N to M.")
|
.help("Only print the lines from N to M.")
|
||||||
.long_help(
|
.long_help(
|
||||||
"Only print the specified range of lines for each file. \
|
"Only print the specified range of lines for each file. \
|
||||||
@@ -370,6 +457,14 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.hidden(true)
|
.hidden(true)
|
||||||
.help("Show path to the configuration file."),
|
.help("Show path to the configuration file."),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("generate-config-file")
|
||||||
|
.long("generate-config-file")
|
||||||
|
.conflicts_with("list-languages")
|
||||||
|
.conflicts_with("list-themes")
|
||||||
|
.hidden(true)
|
||||||
|
.help("Generates a default configuration file."),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("config-dir")
|
Arg::with_name("config-dir")
|
||||||
.long("config-dir")
|
.long("config-dir")
|
||||||
|
|||||||
+68
-3
@@ -1,10 +1,9 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::io::{self, Write};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use shell_words;
|
|
||||||
|
|
||||||
use crate::directories::PROJECT_DIRS;
|
use crate::directories::PROJECT_DIRS;
|
||||||
|
|
||||||
pub fn config_file() -> PathBuf {
|
pub fn config_file() -> PathBuf {
|
||||||
@@ -15,12 +14,78 @@ pub fn config_file() -> PathBuf {
|
|||||||
.unwrap_or_else(|| PROJECT_DIRS.config_dir().join("config"))
|
.unwrap_or_else(|| PROJECT_DIRS.config_dir().join("config"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn generate_config_file() -> bat::error::Result<()> {
|
||||||
|
let config_file = config_file();
|
||||||
|
if config_file.exists() {
|
||||||
|
println!(
|
||||||
|
"A config file already exists at: {}",
|
||||||
|
config_file.to_string_lossy()
|
||||||
|
);
|
||||||
|
|
||||||
|
print!("Overwrite? (y/N): ");
|
||||||
|
io::stdout().flush()?;
|
||||||
|
let mut decision = String::new();
|
||||||
|
io::stdin().read_line(&mut decision)?;
|
||||||
|
|
||||||
|
if !decision.trim().eq_ignore_ascii_case("Y") {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let config_dir = config_file.parent();
|
||||||
|
match config_dir {
|
||||||
|
Some(path) => fs::create_dir_all(path)?,
|
||||||
|
None => {
|
||||||
|
return Err(format!(
|
||||||
|
"Unable to write config file to: {}",
|
||||||
|
config_file.to_string_lossy()
|
||||||
|
)
|
||||||
|
.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let default_config = r#"# This is `bat`s configuration file. Each line either contains a comment or
|
||||||
|
# a command-line option that you want to pass to `bat` by default. You can
|
||||||
|
# run `bat --help` to get a list of all possible configuration options.
|
||||||
|
|
||||||
|
# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
|
||||||
|
# for a list of all available themes
|
||||||
|
#--theme="TwoDark"
|
||||||
|
|
||||||
|
# Enable this to use italic text on the terminal. This is not supported on all
|
||||||
|
# terminal emulators (like tmux, by default):
|
||||||
|
#--italic-text=always
|
||||||
|
|
||||||
|
# Uncomment the following line to disable automatic paging:
|
||||||
|
#--paging=never
|
||||||
|
|
||||||
|
# Uncomment the following line if you are using less version >= 551 and want to
|
||||||
|
# enable mouse scrolling support in `bat` when running inside tmux. This might
|
||||||
|
# disable text selection, unless you press shift.
|
||||||
|
#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse"
|
||||||
|
|
||||||
|
# Syntax mappings: map a certain filename pattern to a language.
|
||||||
|
# Example 1: use the C++ syntax for .ino files
|
||||||
|
# Example 2: Use ".gitignore"-style highlighting for ".ignore" files
|
||||||
|
#--map-syntax "*.ino:C++"
|
||||||
|
#--map-syntax ".ignore:Git Ignore"
|
||||||
|
"#;
|
||||||
|
|
||||||
|
fs::write(&config_file, default_config)?;
|
||||||
|
println!(
|
||||||
|
"Success! Config file written to {}",
|
||||||
|
config_file.to_string_lossy()
|
||||||
|
);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_args_from_config_file() -> Result<Vec<OsString>, shell_words::ParseError> {
|
pub fn get_args_from_config_file() -> Result<Vec<OsString>, shell_words::ParseError> {
|
||||||
Ok(fs::read_to_string(config_file())
|
Ok(fs::read_to_string(config_file())
|
||||||
.ok()
|
.ok()
|
||||||
.map(|content| get_args_from_str(&content))
|
.map(|content| get_args_from_str(&content))
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.unwrap_or_else(|| vec![]))
|
.unwrap_or_else(Vec::new))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_args_from_env_var() -> Option<Result<Vec<OsString>, shell_words::ParseError>> {
|
pub fn get_args_from_env_var() -> Option<Result<Vec<OsString>, shell_words::ParseError>> {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use dirs;
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
|
||||||
/// Wrapper for 'dirs' that treats MacOS more like Linux, by following the XDG specification.
|
/// Wrapper for 'dirs' that treats MacOS more like Linux, by following the XDG specification.
|
||||||
@@ -33,7 +32,7 @@ impl BatProjectDirs {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_cache_dir() -> Option<PathBuf> {
|
fn get_cache_dir() -> Option<PathBuf> {
|
||||||
// on all OS prefer BAT_CACHE_PATH if set
|
// on all OS prefer BAT_CACHE_PATH if set
|
||||||
let cache_dir_op = env::var_os("BAT_CACHE_PATH").map(PathBuf::from);
|
let cache_dir_op = env::var_os("BAT_CACHE_PATH").map(PathBuf::from);
|
||||||
if cache_dir_op.is_some() {
|
if cache_dir_op.is_some() {
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
use bat::input::Input;
|
||||||
|
use std::ffi::OsStr;
|
||||||
|
|
||||||
|
pub fn new_file_input<'a>(file: &'a OsStr, name: Option<&'a OsStr>) -> Input<'a> {
|
||||||
|
named(Input::ordinary_file(file), name.or_else(|| Some(file)))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_stdin_input(name: Option<&OsStr>) -> Input {
|
||||||
|
named(Input::stdin(), name)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn named<'a>(input: Input<'a>, name: Option<&OsStr>) -> Input<'a> {
|
||||||
|
if let Some(provided_name) = name {
|
||||||
|
let mut input = input.with_name(Some(provided_name));
|
||||||
|
input.description_mut().set_kind(Some("File".to_owned()));
|
||||||
|
input
|
||||||
|
} else {
|
||||||
|
input
|
||||||
|
}
|
||||||
|
}
|
||||||
+101
-30
@@ -1,38 +1,45 @@
|
|||||||
// `error_chain!` can recurse deeply
|
// `error_chain!` can recurse deeply
|
||||||
#![recursion_limit = "1024"]
|
#![recursion_limit = "1024"]
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate clap;
|
|
||||||
|
|
||||||
extern crate dirs as dirs_rs;
|
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
mod assets;
|
mod assets;
|
||||||
mod clap_app;
|
mod clap_app;
|
||||||
mod config;
|
mod config;
|
||||||
mod directories;
|
mod directories;
|
||||||
|
mod input;
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::Write;
|
use std::io::{BufReader, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process;
|
use std::process;
|
||||||
|
|
||||||
use ansi_term::Colour::Green;
|
use ansi_term::Colour::Green;
|
||||||
use ansi_term::Style;
|
use ansi_term::Style;
|
||||||
|
|
||||||
use crate::{app::App, config::config_file};
|
use crate::{
|
||||||
|
app::App,
|
||||||
|
config::{config_file, generate_config_file},
|
||||||
|
};
|
||||||
|
|
||||||
use assets::{assets_from_cache_or_binary, cache_dir, clear_assets, config_dir};
|
use assets::{assets_from_cache_or_binary, cache_dir, clear_assets, config_dir};
|
||||||
use bat::Controller;
|
use clap::crate_version;
|
||||||
use directories::PROJECT_DIRS;
|
use directories::PROJECT_DIRS;
|
||||||
|
use globset::GlobMatcher;
|
||||||
|
|
||||||
use bat::{
|
use bat::{
|
||||||
config::{Config, InputFile, StyleComponent, StyleComponents},
|
assets::HighlightingAssets,
|
||||||
errors::*,
|
config::Config,
|
||||||
HighlightingAssets,
|
controller::Controller,
|
||||||
|
error::*,
|
||||||
|
input::Input,
|
||||||
|
style::{StyleComponent, StyleComponents},
|
||||||
|
MappingTarget,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const THEME_PREVIEW_DATA: &[u8] = include_bytes!("../../../assets/theme_preview.rs");
|
||||||
|
|
||||||
fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
|
fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
|
||||||
if matches.is_present("build") {
|
if matches.is_present("build") {
|
||||||
let source_dir = matches
|
let source_dir = matches
|
||||||
@@ -47,7 +54,7 @@ fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
|
|||||||
let blank = matches.is_present("blank");
|
let blank = matches.is_present("blank");
|
||||||
|
|
||||||
let assets = HighlightingAssets::from_files(source_dir, !blank)?;
|
let assets = HighlightingAssets::from_files(source_dir, !blank)?;
|
||||||
assets.save_to_cache(target_dir)?;
|
assets.save_to_cache(target_dir, crate_version!())?;
|
||||||
} else if matches.is_present("clear") {
|
} else if matches.is_present("clear") {
|
||||||
clear_assets();
|
clear_assets();
|
||||||
}
|
}
|
||||||
@@ -55,21 +62,69 @@ fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_syntax_mapping_to_paths<'a>(
|
||||||
|
mappings: &[(GlobMatcher, MappingTarget<'a>)],
|
||||||
|
) -> HashMap<&'a str, Vec<String>> {
|
||||||
|
let mut map = HashMap::new();
|
||||||
|
for mapping in mappings {
|
||||||
|
match mapping {
|
||||||
|
(_, MappingTarget::MapToUnknown) => {}
|
||||||
|
(matcher, MappingTarget::MapTo(s)) => {
|
||||||
|
let globs = map.entry(*s).or_insert_with(Vec::new);
|
||||||
|
globs.push(matcher.glob().glob().into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map
|
||||||
|
}
|
||||||
|
|
||||||
pub fn list_languages(config: &Config) -> Result<()> {
|
pub fn list_languages(config: &Config) -> Result<()> {
|
||||||
let assets = assets_from_cache_or_binary();
|
let assets = assets_from_cache_or_binary()?;
|
||||||
let mut languages = assets
|
let mut languages = assets
|
||||||
.syntaxes()
|
.syntaxes()
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|syntax| !syntax.hidden && !syntax.file_extensions.is_empty())
|
.filter(|syntax| !syntax.hidden && !syntax.file_extensions.is_empty())
|
||||||
|
.cloned()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
// Handling of file-extension conflicts, see issue #1076
|
||||||
|
for lang in languages.iter_mut() {
|
||||||
|
let lang_name = lang.name.clone();
|
||||||
|
lang.file_extensions.retain(|extension| {
|
||||||
|
// The 'extension' variable is not certainly a real extension.
|
||||||
|
//
|
||||||
|
// Skip if 'extension' starts with '.', likely a hidden file like '.vimrc'
|
||||||
|
// Also skip if the 'extension' contains another real extension, likely
|
||||||
|
// that is a full match file name like 'CMakeLists.txt' and 'Cargo.lock'
|
||||||
|
if extension.starts_with('.') || Path::new(extension).extension().is_some() {
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
let test_file = Path::new("test").with_extension(extension);
|
||||||
|
match assets.syntax_for_file_name(test_file, &config.syntax_mapping) {
|
||||||
|
Some(syntax) => syntax.name == lang_name,
|
||||||
|
None => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
languages.sort_by_key(|lang| lang.name.to_uppercase());
|
languages.sort_by_key(|lang| lang.name.to_uppercase());
|
||||||
|
|
||||||
|
let configured_languages = get_syntax_mapping_to_paths(config.syntax_mapping.mappings());
|
||||||
|
|
||||||
|
for lang in languages.iter_mut() {
|
||||||
|
if let Some(additional_paths) = configured_languages.get(lang.name.as_str()) {
|
||||||
|
lang.file_extensions
|
||||||
|
.extend(additional_paths.iter().cloned());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let stdout = io::stdout();
|
let stdout = io::stdout();
|
||||||
let mut stdout = stdout.lock();
|
let mut stdout = stdout.lock();
|
||||||
|
|
||||||
if config.loop_through {
|
if config.loop_through {
|
||||||
for lang in languages {
|
for lang in languages {
|
||||||
write!(stdout, "{}:{}\n", lang.name, lang.file_extensions.join(","))?;
|
writeln!(stdout, "{}:{}", lang.name, lang.file_extensions.join(","))?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let longest = languages
|
let longest = languages
|
||||||
@@ -117,12 +172,16 @@ pub fn list_languages(config: &Config) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn theme_preview_file<'a>() -> Input<'a> {
|
||||||
|
Input::from_reader(Box::new(BufReader::new(THEME_PREVIEW_DATA)))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn list_themes(cfg: &Config) -> Result<()> {
|
pub fn list_themes(cfg: &Config) -> Result<()> {
|
||||||
let assets = assets_from_cache_or_binary();
|
let assets = assets_from_cache_or_binary()?;
|
||||||
let mut config = cfg.clone();
|
let mut config = cfg.clone();
|
||||||
let mut style = HashSet::new();
|
let mut style = HashSet::new();
|
||||||
style.insert(StyleComponent::Plain);
|
style.insert(StyleComponent::Plain);
|
||||||
config.files = vec![InputFile::ThemePreviewFile];
|
config.language = Some("Rust");
|
||||||
config.style_components = StyleComponents(style);
|
config.style_components = StyleComponents(style);
|
||||||
|
|
||||||
let stdout = io::stdout();
|
let stdout = io::stdout();
|
||||||
@@ -136,7 +195,9 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
|
|||||||
Style::new().bold().paint(theme.to_string())
|
Style::new().bold().paint(theme.to_string())
|
||||||
)?;
|
)?;
|
||||||
config.theme = theme.to_string();
|
config.theme = theme.to_string();
|
||||||
let _controller = Controller::new(&config, &assets).run();
|
Controller::new(&config, &assets)
|
||||||
|
.run(vec![theme_preview_file()])
|
||||||
|
.ok();
|
||||||
writeln!(stdout)?;
|
writeln!(stdout)?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -144,14 +205,22 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
|
|||||||
writeln!(stdout, "{}", theme)?;
|
writeln!(stdout, "{}", theme)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
writeln!(
|
||||||
|
stdout,
|
||||||
|
"Further themes can be installed to '{}', \
|
||||||
|
and are added to the cache with `bat cache --build`. \
|
||||||
|
For more information, see:\n\n \
|
||||||
|
https://github.com/sharkdp/bat#adding-new-themes",
|
||||||
|
config_file().join("themes").to_string_lossy()
|
||||||
|
)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_controller(config: &Config) -> Result<bool> {
|
fn run_controller(inputs: Vec<Input>, config: &Config) -> Result<bool> {
|
||||||
let assets = assets_from_cache_or_binary();
|
let assets = assets_from_cache_or_binary()?;
|
||||||
let controller = Controller::new(&config, &assets);
|
let controller = Controller::new(&config, &assets);
|
||||||
controller.run()
|
controller.run(inputs)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `Err(..)` upon fatal errors. Otherwise, returns `Ok(true)` on full success and
|
/// Returns `Err(..)` upon fatal errors. Otherwise, returns `Ok(true)` on full success and
|
||||||
@@ -168,26 +237,27 @@ fn run() -> Result<bool> {
|
|||||||
run_cache_subcommand(cache_matches)?;
|
run_cache_subcommand(cache_matches)?;
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else {
|
} else {
|
||||||
let mut config = app.config()?;
|
let inputs = vec![Input::ordinary_file(OsStr::new("cache"))];
|
||||||
config.files = vec![InputFile::Ordinary(OsStr::new("cache"))];
|
let config = app.config(&inputs)?;
|
||||||
|
|
||||||
run_controller(&config)
|
run_controller(inputs, &config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let config = app.config()?;
|
let inputs = app.inputs()?;
|
||||||
|
let config = app.config(&inputs)?;
|
||||||
|
|
||||||
if app.matches.is_present("list-languages") {
|
if app.matches.is_present("list-languages") {
|
||||||
list_languages(&config)?;
|
list_languages(&config)?;
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else if app.matches.is_present("list-themes") {
|
} else if app.matches.is_present("list-themes") {
|
||||||
list_themes(&config)?;
|
list_themes(&config)?;
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else if app.matches.is_present("config-file") {
|
} else if app.matches.is_present("config-file") {
|
||||||
println!("{}", config_file().to_string_lossy());
|
println!("{}", config_file().to_string_lossy());
|
||||||
|
Ok(true)
|
||||||
|
} else if app.matches.is_present("generate-config-file") {
|
||||||
|
generate_config_file()?;
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else if app.matches.is_present("config-dir") {
|
} else if app.matches.is_present("config-dir") {
|
||||||
writeln!(io::stdout(), "{}", config_dir())?;
|
writeln!(io::stdout(), "{}", config_dir())?;
|
||||||
@@ -196,7 +266,7 @@ fn run() -> Result<bool> {
|
|||||||
writeln!(io::stdout(), "{}", cache_dir())?;
|
writeln!(io::stdout(), "{}", cache_dir())?;
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else {
|
} else {
|
||||||
run_controller(&config)
|
run_controller(inputs, &config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +277,8 @@ fn main() {
|
|||||||
|
|
||||||
match result {
|
match result {
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
default_error_handler(&error);
|
let stderr = std::io::stderr();
|
||||||
|
default_error_handler(&error, &mut stderr.lock());
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
Ok(false) => {
|
Ok(false) => {
|
||||||
|
|||||||
+32
-23
@@ -1,27 +1,38 @@
|
|||||||
pub use crate::inputfile::InputFile;
|
use crate::line_range::{HighlightedLineRanges, LineRanges};
|
||||||
pub use crate::line_range::{HighlightedLineRanges, LineRange, LineRanges};
|
#[cfg(feature = "paging")]
|
||||||
pub use crate::style::{StyleComponent, StyleComponents};
|
use crate::paging::PagingMode;
|
||||||
pub use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
|
use crate::style::StyleComponents;
|
||||||
pub use crate::wrap::OutputWrap;
|
use crate::syntax_mapping::SyntaxMapping;
|
||||||
|
use crate::wrapping::WrappingMode;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum PagingMode {
|
pub enum VisibleLines {
|
||||||
Always,
|
/// Show all lines which are included in the line ranges
|
||||||
QuitIfOneScreen,
|
Ranges(LineRanges),
|
||||||
Never,
|
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
/// Only show lines surrounding added/deleted/modified lines
|
||||||
|
DiffContext(usize),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PagingMode {
|
impl VisibleLines {
|
||||||
|
pub fn diff_mode(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
Self::Ranges(_) => false,
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
Self::DiffContext(_) => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for VisibleLines {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
PagingMode::Never
|
VisibleLines::Ranges(LineRanges::default())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct Config<'a> {
|
pub struct Config<'a> {
|
||||||
/// List of files to print
|
|
||||||
pub files: Vec<InputFile<'a>>,
|
|
||||||
|
|
||||||
/// The explicitly configured language, if any
|
/// The explicitly configured language, if any
|
||||||
pub language: Option<&'a str>,
|
pub language: Option<&'a str>,
|
||||||
|
|
||||||
@@ -47,14 +58,15 @@ pub struct Config<'a> {
|
|||||||
/// Style elements (grid, line numbers, ...)
|
/// Style elements (grid, line numbers, ...)
|
||||||
pub style_components: StyleComponents,
|
pub style_components: StyleComponents,
|
||||||
|
|
||||||
/// Text wrapping mode
|
/// If and how text should be wrapped
|
||||||
pub output_wrap: OutputWrap,
|
pub wrapping_mode: WrappingMode,
|
||||||
|
|
||||||
/// Pager or STDOUT
|
/// Pager or STDOUT
|
||||||
|
#[cfg(feature = "paging")]
|
||||||
pub paging_mode: PagingMode,
|
pub paging_mode: PagingMode,
|
||||||
|
|
||||||
/// Specifies the lines that should be printed
|
/// Specifies which lines should be printed
|
||||||
pub line_ranges: LineRanges,
|
pub visible_lines: VisibleLines,
|
||||||
|
|
||||||
/// The syntax highlighting theme
|
/// The syntax highlighting theme
|
||||||
pub theme: String,
|
pub theme: String,
|
||||||
@@ -76,10 +88,7 @@ pub struct Config<'a> {
|
|||||||
fn default_config_should_include_all_lines() {
|
fn default_config_should_include_all_lines() {
|
||||||
use crate::line_range::RangeCheckResult;
|
use crate::line_range::RangeCheckResult;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(LineRanges::default().check(17), RangeCheckResult::InRange);
|
||||||
Config::default().line_ranges.check(17),
|
|
||||||
RangeCheckResult::InRange
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
+136
-47
@@ -1,12 +1,17 @@
|
|||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
use crate::assets::HighlightingAssets;
|
use crate::assets::HighlightingAssets;
|
||||||
use crate::config::{Config, PagingMode};
|
use crate::config::{Config, VisibleLines};
|
||||||
use crate::errors::*;
|
#[cfg(feature = "git")]
|
||||||
use crate::inputfile::{InputFile, InputFileReader};
|
use crate::diff::{get_git_diff, LineChanges};
|
||||||
|
use crate::error::*;
|
||||||
|
use crate::input::{Input, InputReader, OpenedInput};
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
use crate::line_range::LineRange;
|
||||||
use crate::line_range::{LineRanges, RangeCheckResult};
|
use crate::line_range::{LineRanges, RangeCheckResult};
|
||||||
use crate::output::OutputType;
|
use crate::output::OutputType;
|
||||||
|
#[cfg(feature = "paging")]
|
||||||
|
use crate::paging::PagingMode;
|
||||||
use crate::printer::{InteractivePrinter, Printer, SimplePrinter};
|
use crate::printer::{InteractivePrinter, Printer, SimplePrinter};
|
||||||
|
|
||||||
pub struct Controller<'a> {
|
pub struct Controller<'a> {
|
||||||
@@ -19,54 +24,120 @@ impl<'b> Controller<'b> {
|
|||||||
Controller { config, assets }
|
Controller { config, assets }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(&self) -> Result<bool> {
|
pub fn run(&self, inputs: Vec<Input>) -> Result<bool> {
|
||||||
self.run_with_error_handler(default_error_handler)
|
self.run_with_error_handler(inputs, default_error_handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_with_error_handler(&self, handle_error: impl Fn(&Error)) -> Result<bool> {
|
pub fn run_with_error_handler(
|
||||||
// Do not launch the pager if NONE of the input files exist
|
&self,
|
||||||
let mut paging_mode = self.config.paging_mode;
|
inputs: Vec<Input>,
|
||||||
if self.config.paging_mode != PagingMode::Never {
|
handle_error: impl Fn(&Error, &mut dyn Write),
|
||||||
let call_pager = self.config.files.iter().any(|file| {
|
) -> Result<bool> {
|
||||||
if let InputFile::Ordinary(path) = file {
|
let mut output_type;
|
||||||
return Path::new(path).exists();
|
|
||||||
} else {
|
#[cfg(feature = "paging")]
|
||||||
return true;
|
{
|
||||||
|
use crate::input::InputKind;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
// Do not launch the pager if NONE of the input files exist
|
||||||
|
let mut paging_mode = self.config.paging_mode;
|
||||||
|
if self.config.paging_mode != PagingMode::Never {
|
||||||
|
let call_pager = inputs.iter().any(|ref input| {
|
||||||
|
if let InputKind::OrdinaryFile(ref path) = input.kind {
|
||||||
|
Path::new(path).exists()
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if !call_pager {
|
||||||
|
paging_mode = PagingMode::Never;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
if !call_pager {
|
|
||||||
paging_mode = PagingMode::Never;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let wrapping_mode = self.config.wrapping_mode;
|
||||||
|
|
||||||
|
output_type = OutputType::from_mode(paging_mode, wrapping_mode, self.config.pager)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut output_type = OutputType::from_mode(paging_mode, self.config.pager)?;
|
#[cfg(not(feature = "paging"))]
|
||||||
|
{
|
||||||
|
output_type = OutputType::stdout();
|
||||||
|
}
|
||||||
|
|
||||||
|
let attached_to_pager = output_type.is_pager();
|
||||||
let writer = output_type.handle()?;
|
let writer = output_type.handle()?;
|
||||||
let mut no_errors: bool = true;
|
let mut no_errors: bool = true;
|
||||||
|
|
||||||
let stdin = io::stdin();
|
let stderr = io::stderr();
|
||||||
|
let print_error = |error: &Error, write: &mut dyn Write| {
|
||||||
|
if attached_to_pager {
|
||||||
|
handle_error(error, write);
|
||||||
|
} else {
|
||||||
|
handle_error(error, &mut stderr.lock());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
for input_file in &self.config.files {
|
for (index, input) in inputs.into_iter().enumerate() {
|
||||||
match input_file.get_reader(&stdin) {
|
match input.open(io::stdin().lock()) {
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
handle_error(&error);
|
print_error(&error, writer);
|
||||||
no_errors = false;
|
no_errors = false;
|
||||||
}
|
}
|
||||||
Ok(mut reader) => {
|
Ok(mut opened_input) => {
|
||||||
let result = if self.config.loop_through {
|
#[cfg(feature = "git")]
|
||||||
let mut printer = SimplePrinter::new();
|
let line_changes = if self.config.visible_lines.diff_mode()
|
||||||
self.print_file(reader, &mut printer, writer, *input_file)
|
|| (!self.config.loop_through && self.config.style_components.changes())
|
||||||
|
{
|
||||||
|
match opened_input.kind {
|
||||||
|
crate::input::OpenedInputKind::OrdinaryFile(ref path) => {
|
||||||
|
let diff = get_git_diff(path);
|
||||||
|
|
||||||
|
// Skip files without Git modifications
|
||||||
|
if self.config.visible_lines.diff_mode()
|
||||||
|
&& diff
|
||||||
|
.as_ref()
|
||||||
|
.map(|changes| changes.is_empty())
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff
|
||||||
|
}
|
||||||
|
_ if self.config.visible_lines.diff_mode() => {
|
||||||
|
// Skip non-file inputs in diff mode
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let mut printer = InteractivePrinter::new(
|
None
|
||||||
&self.config,
|
|
||||||
&self.assets,
|
|
||||||
*input_file,
|
|
||||||
&mut reader,
|
|
||||||
);
|
|
||||||
self.print_file(reader, &mut printer, writer, *input_file)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut printer: Box<dyn Printer> = if self.config.loop_through {
|
||||||
|
Box::new(SimplePrinter::new(&self.config))
|
||||||
|
} else {
|
||||||
|
Box::new(InteractivePrinter::new(
|
||||||
|
&self.config,
|
||||||
|
&self.assets,
|
||||||
|
&mut opened_input,
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
&line_changes,
|
||||||
|
)?)
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = self.print_file(
|
||||||
|
&mut *printer,
|
||||||
|
writer,
|
||||||
|
&mut opened_input,
|
||||||
|
index != 0,
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
&line_changes,
|
||||||
|
);
|
||||||
|
|
||||||
if let Err(error) = result {
|
if let Err(error) = result {
|
||||||
handle_error(&error);
|
print_error(&error, writer);
|
||||||
no_errors = false;
|
no_errors = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,30 +147,48 @@ impl<'b> Controller<'b> {
|
|||||||
Ok(no_errors)
|
Ok(no_errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_file<'a, P: Printer>(
|
fn print_file(
|
||||||
&self,
|
&self,
|
||||||
reader: InputFileReader,
|
printer: &mut dyn Printer,
|
||||||
printer: &mut P,
|
|
||||||
writer: &mut dyn Write,
|
writer: &mut dyn Write,
|
||||||
input_file: InputFile<'a>,
|
input: &mut OpenedInput,
|
||||||
|
add_header_padding: bool,
|
||||||
|
#[cfg(feature = "git")] line_changes: &Option<LineChanges>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
if !reader.first_line.is_empty() || self.config.style_components.header() {
|
if !input.reader.first_line.is_empty() || self.config.style_components.header() {
|
||||||
printer.print_header(writer, input_file)?;
|
printer.print_header(writer, input, add_header_padding)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !reader.first_line.is_empty() {
|
if !input.reader.first_line.is_empty() {
|
||||||
self.print_file_ranges(printer, writer, reader, &self.config.line_ranges)?;
|
let line_ranges = match self.config.visible_lines {
|
||||||
|
VisibleLines::Ranges(ref line_ranges) => line_ranges.clone(),
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
VisibleLines::DiffContext(context) => {
|
||||||
|
let mut line_ranges: Vec<LineRange> = vec![];
|
||||||
|
|
||||||
|
if let Some(line_changes) = line_changes {
|
||||||
|
for line in line_changes.keys() {
|
||||||
|
let line = *line as usize;
|
||||||
|
line_ranges.push(LineRange::new(line - context, line + context));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LineRanges::from(line_ranges)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.print_file_ranges(printer, writer, &mut input.reader, &line_ranges)?;
|
||||||
}
|
}
|
||||||
printer.print_footer(writer)?;
|
printer.print_footer(writer, input)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_file_ranges<P: Printer>(
|
fn print_file_ranges(
|
||||||
&self,
|
&self,
|
||||||
printer: &mut P,
|
printer: &mut dyn Printer,
|
||||||
writer: &mut dyn Write,
|
writer: &mut dyn Write,
|
||||||
mut reader: InputFileReader,
|
reader: &mut InputReader,
|
||||||
line_ranges: &LineRanges,
|
line_ranges: &LineRanges,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut line_buffer = Vec::new();
|
let mut line_buffer = Vec::new();
|
||||||
|
|||||||
+12
-8
@@ -1,14 +1,15 @@
|
|||||||
|
#[cfg(feature = "git")]
|
||||||
use crate::diff::LineChange;
|
use crate::diff::LineChange;
|
||||||
use crate::printer::{Colors, InteractivePrinter};
|
use crate::printer::{Colors, InteractivePrinter};
|
||||||
use ansi_term::Style;
|
use ansi_term::Style;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct DecorationText {
|
pub(crate) struct DecorationText {
|
||||||
pub width: usize,
|
pub width: usize,
|
||||||
pub text: String,
|
pub text: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Decoration {
|
pub(crate) trait Decoration {
|
||||||
fn generate(
|
fn generate(
|
||||||
&self,
|
&self,
|
||||||
line_number: usize,
|
line_number: usize,
|
||||||
@@ -18,14 +19,14 @@ pub trait Decoration {
|
|||||||
fn width(&self) -> usize;
|
fn width(&self) -> usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct LineNumberDecoration {
|
pub(crate) struct LineNumberDecoration {
|
||||||
color: Style,
|
color: Style,
|
||||||
cached_wrap: DecorationText,
|
cached_wrap: DecorationText,
|
||||||
cached_wrap_invalid_at: usize,
|
cached_wrap_invalid_at: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LineNumberDecoration {
|
impl LineNumberDecoration {
|
||||||
pub fn new(colors: &Colors) -> Self {
|
pub(crate) fn new(colors: &Colors) -> Self {
|
||||||
LineNumberDecoration {
|
LineNumberDecoration {
|
||||||
color: colors.line_number,
|
color: colors.line_number,
|
||||||
cached_wrap_invalid_at: 10000,
|
cached_wrap_invalid_at: 10000,
|
||||||
@@ -68,7 +69,8 @@ impl Decoration for LineNumberDecoration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct LineChangesDecoration {
|
#[cfg(feature = "git")]
|
||||||
|
pub(crate) struct LineChangesDecoration {
|
||||||
cached_none: DecorationText,
|
cached_none: DecorationText,
|
||||||
cached_added: DecorationText,
|
cached_added: DecorationText,
|
||||||
cached_removed_above: DecorationText,
|
cached_removed_above: DecorationText,
|
||||||
@@ -76,6 +78,7 @@ pub struct LineChangesDecoration {
|
|||||||
cached_modified: DecorationText,
|
cached_modified: DecorationText,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "git")]
|
||||||
impl LineChangesDecoration {
|
impl LineChangesDecoration {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn generate_cached(style: Style, text: &str) -> DecorationText {
|
fn generate_cached(style: Style, text: &str) -> DecorationText {
|
||||||
@@ -85,7 +88,7 @@ impl LineChangesDecoration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(colors: &Colors) -> Self {
|
pub(crate) fn new(colors: &Colors) -> Self {
|
||||||
LineChangesDecoration {
|
LineChangesDecoration {
|
||||||
cached_none: Self::generate_cached(Style::default(), " "),
|
cached_none: Self::generate_cached(Style::default(), " "),
|
||||||
cached_added: Self::generate_cached(colors.git_added, "+"),
|
cached_added: Self::generate_cached(colors.git_added, "+"),
|
||||||
@@ -96,6 +99,7 @@ impl LineChangesDecoration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "git")]
|
||||||
impl Decoration for LineChangesDecoration {
|
impl Decoration for LineChangesDecoration {
|
||||||
fn generate(
|
fn generate(
|
||||||
&self,
|
&self,
|
||||||
@@ -123,12 +127,12 @@ impl Decoration for LineChangesDecoration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct GridBorderDecoration {
|
pub(crate) struct GridBorderDecoration {
|
||||||
cached: DecorationText,
|
cached: DecorationText,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GridBorderDecoration {
|
impl GridBorderDecoration {
|
||||||
pub fn new(colors: &Colors) -> Self {
|
pub(crate) fn new(colors: &Colors) -> Self {
|
||||||
GridBorderDecoration {
|
GridBorderDecoration {
|
||||||
cached: DecorationText {
|
cached: DecorationText {
|
||||||
text: colors.grid.paint("│").to_string(),
|
text: colors.grid.paint("│").to_string(),
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user