@enjoys/context-engine 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (424) hide show
  1. package/data/codeLens/awk.json +1 -1
  2. package/data/codeLens/azcli.json +10 -10
  3. package/data/codeLens/c.json +1 -1
  4. package/data/codeLens/caddy.json +1 -1
  5. package/data/codeLens/crontab.json +1 -1
  6. package/data/codeLens/doctest.json +10 -10
  7. package/data/codeLens/hcl.json +1 -1
  8. package/data/codeLens/html.json +1 -1
  9. package/data/codeLens/lua.json +1 -1
  10. package/data/codeLens/nginx.json +1 -1
  11. package/data/codeLens/pla.json +10 -10
  12. package/data/codeLens/xml.json +1 -1
  13. package/data/commands/angular.json +670 -312
  14. package/data/commands/c.json +30 -30
  15. package/data/commands/cpp.json +30 -30
  16. package/data/commands/crontab.json +25 -30
  17. package/data/commands/cypher.json +26 -30
  18. package/data/commands/dockerfile.json +26 -2
  19. package/data/commands/doctest.json +23 -24
  20. package/data/commands/dotenv.json +24 -11
  21. package/data/commands/ecl.json +26 -30
  22. package/data/commands/flow9.json +24 -24
  23. package/data/commands/freemarker2.json +24 -18
  24. package/data/commands/graphql.json +25 -11
  25. package/data/commands/html.json +25 -11
  26. package/data/commands/ini.json +26 -12
  27. package/data/commands/javascript.json +29 -30
  28. package/data/commands/less.json +25 -29
  29. package/data/commands/lexon.json +23 -11
  30. package/data/commands/liquid.json +26 -11
  31. package/data/commands/m3.json +26 -12
  32. package/data/commands/manifest.json +35 -731
  33. package/data/commands/markdown.json +26 -12
  34. package/data/commands/mdx.json +23 -10
  35. package/data/commands/mips.json +26 -18
  36. package/data/commands/msdax.json +23 -11
  37. package/data/commands/nestjs.json +516 -273
  38. package/data/commands/nextjs.json +250 -123
  39. package/data/commands/objective-c.json +26 -24
  40. package/data/commands/pascal.json +27 -24
  41. package/data/commands/pascaligo.json +26 -24
  42. package/data/commands/perl.json +30 -30
  43. package/data/commands/pla.json +23 -11
  44. package/data/commands/postiats.json +26 -24
  45. package/data/commands/powerquery.json +23 -11
  46. package/data/commands/powershell.json +28 -30
  47. package/data/commands/protobuf.json +27 -30
  48. package/data/commands/qsharp.json +26 -30
  49. package/data/commands/razor.json +25 -29
  50. package/data/commands/react.json +244 -210
  51. package/data/commands/redshift.json +27 -18
  52. package/data/commands/restructuredtext.json +29 -30
  53. package/data/commands/sb.json +23 -11
  54. package/data/commands/scheme.json +25 -18
  55. package/data/commands/scss.json +26 -29
  56. package/data/commands/shadcn.json +564 -410
  57. package/data/commands/sol.json +27 -30
  58. package/data/commands/sparql.json +25 -11
  59. package/data/commands/sql.json +16 -2
  60. package/data/commands/ssh_config.json +31 -30
  61. package/data/commands/st.json +23 -11
  62. package/data/commands/systemverilog.json +26 -24
  63. package/data/commands/tailwindcss.json +60 -53
  64. package/data/commands/tcl.json +23 -18
  65. package/data/commands/toml.json +25 -11
  66. package/data/commands/twig.json +23 -10
  67. package/data/commands/vb.json +27 -24
  68. package/data/commands/wgsl.json +24 -11
  69. package/data/commands/yaml.json +29 -30
  70. package/data/completion/awk.json +906 -202
  71. package/data/completion/azcli.json +886 -237
  72. package/data/completion/bicep.json +862 -367
  73. package/data/completion/crontab.json +906 -202
  74. package/data/completion/dotenv.json +895 -169
  75. package/data/completion/graphql.json +895 -180
  76. package/data/completion/hcl.json +906 -191
  77. package/data/completion/ini.json +906 -136
  78. package/data/completion/json.json +895 -169
  79. package/data/completion/lexon.json +856 -295
  80. package/data/completion/makefile.json +906 -202
  81. package/data/completion/markdown.json +906 -224
  82. package/data/completion/mdx.json +895 -87
  83. package/data/completion/mips.json +872 -377
  84. package/data/completion/perl.json +961 -202
  85. package/data/completion/pla.json +895 -154
  86. package/data/completion/powershell.json +906 -224
  87. package/data/completion/protobuf.json +884 -180
  88. package/data/completion/ssh_config.json +906 -158
  89. package/data/completion/xml.json +906 -158
  90. package/data/definition/abap.json +127 -1
  91. package/data/definition/apex.json +97 -1
  92. package/data/definition/coffee.json +51 -1
  93. package/data/definition/dart.json +105 -1
  94. package/data/definition/elixir.json +115 -1
  95. package/data/definition/flow9.json +208 -1
  96. package/data/definition/freemarker2.json +283 -1
  97. package/data/definition/html.json +853 -558
  98. package/data/definition/java.json +1127 -183
  99. package/data/definition/kotlin.json +72 -1
  100. package/data/definition/r.json +692 -83
  101. package/data/definition/ruby.json +789 -669
  102. package/data/definition/rust.json +852 -206
  103. package/data/definition/sb.json +339 -1
  104. package/data/definition/st.json +367 -1
  105. package/data/documentRangeFormatting/nestjs.json +57 -17
  106. package/data/documentRangeFormatting/nextjs.json +57 -17
  107. package/data/documentRangeFormatting/react.json +82 -78
  108. package/data/documentSymbol/abap.json +54 -12
  109. package/data/documentSymbol/apex.json +40 -10
  110. package/data/documentSymbol/awk.json +15 -1
  111. package/data/documentSymbol/bicep.json +39 -39
  112. package/data/documentSymbol/c.json +1 -1
  113. package/data/documentSymbol/clojure.json +46 -46
  114. package/data/documentSymbol/css.json +96 -96
  115. package/data/documentSymbol/dart.json +109 -19
  116. package/data/documentSymbol/dockerfile.json +1 -1
  117. package/data/documentSymbol/elixir.json +39 -39
  118. package/data/documentSymbol/go.json +1 -1
  119. package/data/documentSymbol/graphql.json +1 -1
  120. package/data/documentSymbol/hcl.json +1 -1
  121. package/data/documentSymbol/html.json +29 -1
  122. package/data/documentSymbol/java.json +1 -1
  123. package/data/documentSymbol/javascript.json +1 -1
  124. package/data/documentSymbol/julia.json +46 -46
  125. package/data/documentSymbol/kotlin.json +74 -14
  126. package/data/documentSymbol/less.json +25 -25
  127. package/data/documentSymbol/lua.json +22 -1
  128. package/data/documentSymbol/makefile.json +15 -1
  129. package/data/documentSymbol/markdown.json +36 -1
  130. package/data/documentSymbol/mysql.json +32 -32
  131. package/data/documentSymbol/nginx.json +1 -1
  132. package/data/documentSymbol/pascal.json +46 -46
  133. package/data/documentSymbol/perl.json +1 -1
  134. package/data/documentSymbol/pgsql.json +39 -39
  135. package/data/documentSymbol/php.json +1 -1
  136. package/data/documentSymbol/powershell.json +1 -1
  137. package/data/documentSymbol/protobuf.json +1 -1
  138. package/data/documentSymbol/python.json +1 -1
  139. package/data/documentSymbol/r.json +67 -67
  140. package/data/documentSymbol/redshift.json +60 -18
  141. package/data/documentSymbol/ruby.json +1 -1
  142. package/data/documentSymbol/rust.json +1 -1
  143. package/data/documentSymbol/scala.json +116 -20
  144. package/data/documentSymbol/scheme.json +25 -25
  145. package/data/documentSymbol/scss.json +39 -39
  146. package/data/documentSymbol/shell.json +1 -1
  147. package/data/documentSymbol/sql.json +1 -1
  148. package/data/documentSymbol/swift.json +88 -16
  149. package/data/documentSymbol/typescript.json +1 -1
  150. package/data/documentSymbol/vb.json +53 -53
  151. package/data/documentSymbol/yaml.json +1 -1
  152. package/data/foldingRange/angular.json +100 -99
  153. package/data/foldingRange/nestjs.json +94 -26
  154. package/data/foldingRange/nextjs.json +94 -26
  155. package/data/foldingRange/react.json +118 -120
  156. package/data/foldingRange/shadcn.json +94 -93
  157. package/data/formatting/abap.json +19 -11
  158. package/data/formatting/angular.json +63 -21
  159. package/data/formatting/apex.json +19 -11
  160. package/data/formatting/awk.json +1 -1
  161. package/data/formatting/azcli.json +18 -18
  162. package/data/formatting/bicep.json +18 -18
  163. package/data/formatting/c.json +1 -1
  164. package/data/formatting/caddy.json +1 -1
  165. package/data/formatting/cameligo.json +18 -18
  166. package/data/formatting/clojure.json +18 -18
  167. package/data/formatting/coffee.json +18 -18
  168. package/data/formatting/cpp.json +1 -1
  169. package/data/formatting/crontab.json +1 -1
  170. package/data/formatting/csharp.json +1 -1
  171. package/data/formatting/css.json +73 -73
  172. package/data/formatting/cypher.json +18 -18
  173. package/data/formatting/dart.json +43 -15
  174. package/data/formatting/docker-compose.json +24 -24
  175. package/data/formatting/dockerfile.json +1 -1
  176. package/data/formatting/doctest.json +18 -18
  177. package/data/formatting/dotenv.json +1 -1
  178. package/data/formatting/ecl.json +18 -18
  179. package/data/formatting/elixir.json +43 -18
  180. package/data/formatting/flow9.json +18 -18
  181. package/data/formatting/freemarker2.json +18 -18
  182. package/data/formatting/go.json +1 -1
  183. package/data/formatting/graphql.json +1 -1
  184. package/data/formatting/hcl.json +26 -1
  185. package/data/formatting/html.json +26 -1
  186. package/data/formatting/ini.json +1 -1
  187. package/data/formatting/java.json +1 -1
  188. package/data/formatting/javascript.json +1 -1
  189. package/data/formatting/julia.json +18 -18
  190. package/data/formatting/kotlin.json +33 -13
  191. package/data/formatting/less.json +48 -18
  192. package/data/formatting/lexon.json +18 -18
  193. package/data/formatting/liquid.json +18 -18
  194. package/data/formatting/lua.json +1 -1
  195. package/data/formatting/m3.json +18 -18
  196. package/data/formatting/makefile.json +1 -1
  197. package/data/formatting/markdown.json +26 -1
  198. package/data/formatting/mdx.json +18 -18
  199. package/data/formatting/mips.json +18 -18
  200. package/data/formatting/msdax.json +18 -18
  201. package/data/formatting/mysql.json +43 -18
  202. package/data/formatting/nginx.json +1 -1
  203. package/data/formatting/objective-c.json +18 -18
  204. package/data/formatting/pascal.json +18 -18
  205. package/data/formatting/pascaligo.json +18 -18
  206. package/data/formatting/perl.json +1 -1
  207. package/data/formatting/pgsql.json +43 -18
  208. package/data/formatting/php.json +1 -1
  209. package/data/formatting/pla.json +18 -18
  210. package/data/formatting/postiats.json +18 -18
  211. package/data/formatting/powerquery.json +18 -18
  212. package/data/formatting/powershell.json +1 -1
  213. package/data/formatting/protobuf.json +1 -1
  214. package/data/formatting/python.json +1 -1
  215. package/data/formatting/qsharp.json +18 -18
  216. package/data/formatting/r.json +32 -32
  217. package/data/formatting/razor.json +18 -18
  218. package/data/formatting/redis-cli.json +1 -1
  219. package/data/formatting/redis.json +18 -18
  220. package/data/formatting/redshift.json +43 -18
  221. package/data/formatting/restructuredtext.json +18 -18
  222. package/data/formatting/ruby.json +1 -1
  223. package/data/formatting/rust.json +1 -1
  224. package/data/formatting/sb.json +18 -18
  225. package/data/formatting/scala.json +48 -16
  226. package/data/formatting/scheme.json +18 -18
  227. package/data/formatting/scss.json +48 -18
  228. package/data/formatting/shadcn.json +63 -61
  229. package/data/formatting/shell.json +1 -1
  230. package/data/formatting/sol.json +18 -18
  231. package/data/formatting/sparql.json +18 -18
  232. package/data/formatting/sql.json +1 -1
  233. package/data/formatting/ssh_config.json +1 -1
  234. package/data/formatting/st.json +18 -18
  235. package/data/formatting/swift.json +58 -18
  236. package/data/formatting/systemd.json +1 -1
  237. package/data/formatting/systemverilog.json +18 -18
  238. package/data/formatting/tcl.json +18 -18
  239. package/data/formatting/toml.json +1 -1
  240. package/data/formatting/twig.json +18 -18
  241. package/data/formatting/typescript.json +1 -1
  242. package/data/formatting/vb.json +18 -18
  243. package/data/formatting/wgsl.json +18 -18
  244. package/data/formatting/xml.json +26 -1
  245. package/data/formatting/yaml.json +1 -1
  246. package/data/hover/apex.json +281 -6
  247. package/data/hover/awk.json +251 -6
  248. package/data/hover/crontab.json +251 -6
  249. package/data/hover/dotenv.json +242 -4
  250. package/data/hover/graphql.json +251 -6
  251. package/data/hover/lexon.json +250 -5
  252. package/data/hover/markdown.json +226 -9
  253. package/data/hover/mdx.json +250 -5
  254. package/data/hover/perl.json +251 -6
  255. package/data/hover/pla.json +264 -5
  256. package/data/hover/powershell.json +252 -7
  257. package/data/hover/protobuf.json +251 -6
  258. package/data/hover/redis.json +355 -40
  259. package/data/hover/ssh_config.json +251 -6
  260. package/data/hover/xml.json +231 -7
  261. package/data/inlineCompletions/c.json +49 -1
  262. package/data/inlineCompletions/cpp.json +61 -1
  263. package/data/inlineCompletions/csharp.json +73 -1
  264. package/data/inlineCompletions/css.json +125 -125
  265. package/data/inlineCompletions/dart.json +136 -26
  266. package/data/inlineCompletions/elixir.json +34 -34
  267. package/data/inlineCompletions/go.json +67 -1
  268. package/data/inlineCompletions/html.json +1 -1
  269. package/data/inlineCompletions/java.json +67 -1
  270. package/data/inlineCompletions/javascript.json +97 -1
  271. package/data/inlineCompletions/kotlin.json +88 -18
  272. package/data/inlineCompletions/less.json +76 -28
  273. package/data/inlineCompletions/lua.json +37 -1
  274. package/data/inlineCompletions/mysql.json +34 -34
  275. package/data/inlineCompletions/pgsql.json +34 -34
  276. package/data/inlineCompletions/php.json +43 -1
  277. package/data/inlineCompletions/python.json +73 -1
  278. package/data/inlineCompletions/ruby.json +49 -1
  279. package/data/inlineCompletions/rust.json +61 -1
  280. package/data/inlineCompletions/scala.json +130 -25
  281. package/data/inlineCompletions/scss.json +34 -34
  282. package/data/inlineCompletions/shell.json +1 -1
  283. package/data/inlineCompletions/sql.json +43 -1
  284. package/data/inlineCompletions/swift.json +112 -22
  285. package/data/inlineCompletions/typescript.json +97 -1
  286. package/data/linkedEditingRange/azcli.json +6 -6
  287. package/data/linkedEditingRange/crontab.json +6 -6
  288. package/data/linkedEditingRange/docker-compose.json +6 -6
  289. package/data/linkedEditingRange/doctest.json +6 -6
  290. package/data/linkedEditingRange/dotenv.json +13 -6
  291. package/data/linkedEditingRange/ini.json +13 -6
  292. package/data/linkedEditingRange/json.json +13 -6
  293. package/data/linkedEditingRange/lexon.json +6 -6
  294. package/data/linkedEditingRange/mips.json +6 -6
  295. package/data/linkedEditingRange/msdax.json +6 -6
  296. package/data/linkedEditingRange/nestjs.json +18 -10
  297. package/data/linkedEditingRange/nextjs.json +24 -11
  298. package/data/linkedEditingRange/pla.json +6 -6
  299. package/data/linkedEditingRange/react.json +74 -75
  300. package/data/linkedEditingRange/redis-cli.json +6 -6
  301. package/data/linkedEditingRange/redis.json +6 -6
  302. package/data/linkedEditingRange/ssh_config.json +6 -6
  303. package/data/linkedEditingRange/systemd.json +6 -6
  304. package/data/linkedEditingRange/toml.json +13 -6
  305. package/data/linkedEditingRange/wgsl.json +6 -6
  306. package/data/linkedEditingRange/xml.json +13 -13
  307. package/data/linkedEditingRange/yaml.json +13 -6
  308. package/data/onTypeFormatting/angular.json +63 -14
  309. package/data/onTypeFormatting/nestjs.json +64 -16
  310. package/data/onTypeFormatting/nextjs.json +72 -17
  311. package/data/onTypeFormatting/react.json +148 -127
  312. package/data/onTypeFormatting/shadcn.json +63 -54
  313. package/data/rangeSemanticTokens/angular.json +196 -140
  314. package/data/rangeSemanticTokens/nestjs.json +195 -27
  315. package/data/rangeSemanticTokens/nextjs.json +199 -28
  316. package/data/rangeSemanticTokens/react.json +77 -216
  317. package/data/rangeSemanticTokens/shadcn.json +203 -140
  318. package/data/rename/angular.json +121 -131
  319. package/data/rename/nestjs.json +122 -32
  320. package/data/rename/nextjs.json +116 -31
  321. package/data/rename/react.json +133 -88
  322. package/data/rename/shadcn.json +73 -79
  323. package/data/selectionRange/abap.json +58 -34
  324. package/data/selectionRange/angular.json +126 -95
  325. package/data/selectionRange/apex.json +58 -34
  326. package/data/selectionRange/awk.json +56 -34
  327. package/data/selectionRange/azcli.json +43 -24
  328. package/data/selectionRange/bicep.json +56 -34
  329. package/data/selectionRange/c.json +62 -39
  330. package/data/selectionRange/caddy.json +53 -34
  331. package/data/selectionRange/cameligo.json +56 -34
  332. package/data/selectionRange/clojure.json +57 -34
  333. package/data/selectionRange/coffee.json +59 -34
  334. package/data/selectionRange/cpp.json +73 -44
  335. package/data/selectionRange/crontab.json +39 -29
  336. package/data/selectionRange/csharp.json +69 -39
  337. package/data/selectionRange/css.json +95 -55
  338. package/data/selectionRange/cypher.json +57 -34
  339. package/data/selectionRange/dart.json +65 -34
  340. package/data/selectionRange/docker-compose.json +54 -34
  341. package/data/selectionRange/dockerfile.json +56 -34
  342. package/data/selectionRange/doctest.json +47 -24
  343. package/data/selectionRange/dotenv.json +33 -24
  344. package/data/selectionRange/ecl.json +58 -34
  345. package/data/selectionRange/elixir.json +63 -34
  346. package/data/selectionRange/flow9.json +57 -34
  347. package/data/selectionRange/freemarker2.json +58 -34
  348. package/data/selectionRange/go.json +64 -39
  349. package/data/selectionRange/graphql.json +58 -34
  350. package/data/selectionRange/hcl.json +56 -34
  351. package/data/selectionRange/html.json +63 -34
  352. package/data/selectionRange/ini.json +38 -24
  353. package/data/selectionRange/java.json +68 -39
  354. package/data/selectionRange/javascript.json +65 -39
  355. package/data/selectionRange/julia.json +65 -39
  356. package/data/selectionRange/kotlin.json +68 -39
  357. package/data/selectionRange/less.json +58 -34
  358. package/data/selectionRange/lexon.json +38 -24
  359. package/data/selectionRange/liquid.json +58 -34
  360. package/data/selectionRange/lua.json +59 -34
  361. package/data/selectionRange/m3.json +57 -34
  362. package/data/selectionRange/makefile.json +53 -34
  363. package/data/selectionRange/markdown.json +57 -34
  364. package/data/selectionRange/mdx.json +63 -34
  365. package/data/selectionRange/mips.json +43 -29
  366. package/data/selectionRange/msdax.json +52 -34
  367. package/data/selectionRange/mysql.json +51 -34
  368. package/data/selectionRange/nestjs.json +35 -21
  369. package/data/selectionRange/nextjs.json +35 -22
  370. package/data/selectionRange/nginx.json +53 -34
  371. package/data/selectionRange/objective-c.json +64 -39
  372. package/data/selectionRange/pascal.json +53 -34
  373. package/data/selectionRange/pascaligo.json +57 -34
  374. package/data/selectionRange/perl.json +59 -34
  375. package/data/selectionRange/pgsql.json +50 -34
  376. package/data/selectionRange/php.json +65 -39
  377. package/data/selectionRange/pla.json +52 -29
  378. package/data/selectionRange/postiats.json +61 -34
  379. package/data/selectionRange/powerquery.json +56 -34
  380. package/data/selectionRange/powershell.json +65 -39
  381. package/data/selectionRange/protobuf.json +58 -34
  382. package/data/selectionRange/python.json +66 -39
  383. package/data/selectionRange/qsharp.json +62 -39
  384. package/data/selectionRange/r.json +57 -34
  385. package/data/selectionRange/razor.json +63 -34
  386. package/data/selectionRange/react.json +103 -87
  387. package/data/selectionRange/redis-cli.json +38 -24
  388. package/data/selectionRange/redis.json +38 -24
  389. package/data/selectionRange/redshift.json +49 -34
  390. package/data/selectionRange/restructuredtext.json +58 -34
  391. package/data/selectionRange/ruby.json +65 -39
  392. package/data/selectionRange/rust.json +73 -44
  393. package/data/selectionRange/sb.json +43 -29
  394. package/data/selectionRange/scala.json +65 -39
  395. package/data/selectionRange/scheme.json +52 -34
  396. package/data/selectionRange/scss.json +58 -34
  397. package/data/selectionRange/shadcn.json +120 -89
  398. package/data/selectionRange/shell.json +1 -1
  399. package/data/selectionRange/sol.json +63 -39
  400. package/data/selectionRange/sparql.json +58 -34
  401. package/data/selectionRange/sql.json +50 -34
  402. package/data/selectionRange/ssh_config.json +37 -29
  403. package/data/selectionRange/st.json +49 -29
  404. package/data/selectionRange/swift.json +73 -44
  405. package/data/selectionRange/systemd.json +47 -34
  406. package/data/selectionRange/systemverilog.json +62 -39
  407. package/data/selectionRange/tailwindcss.json +49 -34
  408. package/data/selectionRange/tcl.json +57 -34
  409. package/data/selectionRange/toml.json +49 -29
  410. package/data/selectionRange/twig.json +58 -34
  411. package/data/selectionRange/typescript.json +75 -44
  412. package/data/selectionRange/vb.json +59 -39
  413. package/data/selectionRange/wgsl.json +61 -34
  414. package/data/selectionRange/xml.json +51 -34
  415. package/data/selectionRange/yaml.json +54 -34
  416. package/data/semanticTokens/angular.json +269 -198
  417. package/data/semanticTokens/nestjs.json +245 -35
  418. package/data/semanticTokens/nextjs.json +265 -38
  419. package/data/semanticTokens/react.json +230 -215
  420. package/data/semanticTokens/shadcn.json +235 -180
  421. package/data/signatureHelp/nestjs.json +201 -128
  422. package/data/signatureHelp/nextjs.json +185 -127
  423. package/data/signatureHelp/react.json +285 -281
  424. package/package.json +1 -1
@@ -4,42 +4,287 @@
4
4
  "fields": {
5
5
  "contents": [
6
6
  {
7
- "value": "```awk\n# input: \"John 30 Engineer\"\n# $0 = \"John 30 Engineer\" (whole line)\n# $1 = \"John\" (1st field)\n# $2 = \"30\" (2nd field)\n# $NF = \"Engineer\" (last field)\n# NF = 3 (field count)\n```\n**Fields** - Awk splits each line into fields by FS (default: whitespace). Access with `$1`, `$2`, etc."
7
+ "value": "```awk\n# input: \"John 30 Engineer\"\n# $0 = \"John 30 Engineer\" (whole line)\n# $1 = \"John\" (1st field)\n# $NF = \"Engineer\" (last field)\n# NF = 3 (field count)\n```\n**Fields** Awk splits lines by FS (default: whitespace). Access with `$1`, `$2`, etc."
8
8
  }
9
9
  ]
10
10
  },
11
11
  "pattern_action": {
12
12
  "contents": [
13
13
  {
14
- "value": "```awk\n/error/ { print } # regex match\n$3 > 100 { print $1, $3 } # field condition\nNR == 1 { print \"Header:\", $0 }\nNR > 1 { sum += $2 } # skip header\nEND { print sum } # final output\n```\n**pattern { action }** is the fundamental awk structure. If pattern matches, action executes. Omit pattern to match all lines."
14
+ "value": "```awk\n/error/ { print } # regex match\n$3 > 100 { print $1, $3 } # field condition\nNR == 1 { print \"Header:\", $0 }\nEND { print sum } # final output\n```\n**pattern { action }** is the fundamental awk structure."
15
15
  }
16
16
  ]
17
17
  },
18
18
  "arrays": {
19
19
  "contents": [
20
20
  {
21
- "value": "```awk\n# Associative arrays (like hash maps)\n{ count[$1]++ } # count occurrences\n{ total[$1] += $2 } # sum by group\nEND {\n for (k in count)\n print k, count[k]\n}\n\n# Check existence:\nif (\"key\" in arr) ...\ndelete arr[\"key\"]\n```\n**Arrays** are associative (string-indexed). No declaration needed. Use `for (k in arr)` to iterate."
21
+ "value": "```awk\n{ count[$1]++ }\n{ total[$1] += $2 }\nEND {\n for (k in count)\n print k, count[k]\n}\nif (\"key\" in arr) ...\ndelete arr[\"key\"]\n```\n**Arrays** are associative (hash maps). No declaration needed."
22
22
  }
23
23
  ]
24
24
  },
25
25
  "one_liners": {
26
26
  "contents": [
27
27
  {
28
- "value": "```bash\n# Print 2nd column:\nawk '{print $2}' file.txt\n\n# Sum column:\nawk '{s+=$1} END{print s}' data.txt\n\n# CSV with header skip:\nawk -F, 'NR>1 {print $1}' data.csv\n\n# Unique values:\nawk '!seen[$0]++' file.txt\n\n# Replace text:\nawk '{gsub(/old/,\"new\")}1' file.txt\n```\n**One-liners** - awk excels as a command-line data processor. `-F` sets field separator."
28
+ "value": "```bash\nawk '{print $2}' file.txt # print 2nd column\nawk '{s+=$1} END{print s}' data.txt # sum column\nawk -F, 'NR>1 {print $1}' data.csv # CSV skip header\nawk '!seen[$0]++' file.txt # unique lines\n```\n**One-liners** awk excels as a command-line data processor."
29
29
  }
30
30
  ]
31
31
  },
32
32
  "printf": {
33
33
  "contents": [
34
34
  {
35
- "value": "```awk\nprintf \"%-20s %5d %8.2f\\n\", $1, $2, $3\n\n# Format specifiers:\n# %s string %-20s left-aligned, 20 wide\n# %d integer %5d right-aligned, 5 wide\n# %f float %8.2f 8 wide, 2 decimal\n# %x hex %o octal\n```\n**printf** provides C-style formatted output. Unlike print, it does NOT add a newline automatically."
35
+ "value": "```awk\nprintf \"%-20s %5d %8.2f\\n\", $1, $2, $3\n# %s string %d integer %f float\n# %x hex %o octal %e scientific\n```\n**printf** provides C-style formatted output. No automatic newline."
36
36
  }
37
37
  ]
38
38
  },
39
39
  "built_in_vars": {
40
40
  "contents": [
41
41
  {
42
- "value": "```awk\nNR # total record (line) number\nFNR # record number in current file\nNF # number of fields in current line\nFS # input field separator (default: space)\nOFS # output field separator (default: space)\nRS # input record separator (default: newline)\nORS # output record separator (default: newline)\nFILENAME # current input filename\n```\n**Built-in variables** control how awk reads and writes data."
42
+ "value": "```awk\nNR # total record (line) number\nFNR # record number in current file\nNF # number of fields in current line\nFS # input field separator (default: space)\nOFS # output field separator\nRS # input record separator (default: newline)\nORS # output record separator\nFILENAME # current input filename\n```\n**Built-in variables** control how awk reads and writes data."
43
+ }
44
+ ]
45
+ },
46
+ "BEGIN": {
47
+ "contents": [
48
+ {
49
+ "value": "```awk\nBEGIN {\n FS = \",\"\n OFS = \"\\t\"\n print \"Name\\tAge\\tCity\"\n}\n{ print $1, $2, $3 }\n```\n**BEGIN** runs once before any input is processed. Use for initialization and headers."
50
+ }
51
+ ]
52
+ },
53
+ "END": {
54
+ "contents": [
55
+ {
56
+ "value": "```awk\n{ sum += $1; count++ }\nEND {\n print \"Total:\", sum\n print \"Average:\", sum/count\n}\n```\n**END** runs once after all input is processed. Use for summaries and final output."
57
+ }
58
+ ]
59
+ },
60
+ "FS": {
61
+ "contents": [
62
+ {
63
+ "value": "```awk\nBEGIN { FS = \",\" } # CSV\nBEGIN { FS = \"\\t\" } # TSV\nBEGIN { FS = \":\" } # /etc/passwd\n# Or from command line:\n# awk -F, '{print $1}' file.csv\n```\n**FS** (field separator) controls how lines are split into fields. Default is whitespace."
64
+ }
65
+ ]
66
+ },
67
+ "OFS": {
68
+ "contents": [
69
+ {
70
+ "value": "```awk\nBEGIN { OFS = \",\" }\n{ print $1, $2, $3 } # output: field1,field2,field3\n\n# Force recalculation:\n{ $1 = $1; print } # rebuild $0 with OFS\n```\n**OFS** (output field separator) is used between fields in print. Set `$1=$1` to rebuild `$0`."
71
+ }
72
+ ]
73
+ },
74
+ "RS": {
75
+ "contents": [
76
+ {
77
+ "value": "```awk\nBEGIN { RS = \"\" } # paragraph mode (blank line separates records)\nBEGIN { RS = \";\" } # semicolon-separated records\n```\n**RS** (record separator) controls how input is split into records. Default is newline."
78
+ }
79
+ ]
80
+ },
81
+ "NR": {
82
+ "contents": [
83
+ {
84
+ "value": "```awk\n{ print NR, $0 } # line numbers\nNR == 5 { print } # print 5th line\nNR >= 10 && NR <= 20 # lines 10-20\nEND { print NR, \"lines\" }\n```\n**NR** is the total number of records (lines) read so far across all files."
85
+ }
86
+ ]
87
+ },
88
+ "FNR": {
89
+ "contents": [
90
+ {
91
+ "value": "```awk\n# FNR resets for each file, NR doesn't:\nFNR == 1 { print \"--- New file:\", FILENAME }\n{ print FNR, $0 }\n```\n**FNR** is the record number in the current file. Resets to 1 for each new input file."
92
+ }
93
+ ]
94
+ },
95
+ "NF": {
96
+ "contents": [
97
+ {
98
+ "value": "```awk\n{ print NF } # count fields per line\nNF > 0 { print } # skip blank lines\n{ print $NF } # print last field\n{ print $(NF-1) } # print second-to-last\n```\n**NF** is the number of fields in the current record. `$NF` accesses the last field."
99
+ }
100
+ ]
101
+ },
102
+ "FILENAME": {
103
+ "contents": [
104
+ {
105
+ "value": "```awk\n{ print FILENAME, NR, $0 }\n```\n**FILENAME** is the name of the current input file."
106
+ }
107
+ ]
108
+ },
109
+ "getline": {
110
+ "contents": [
111
+ {
112
+ "value": "```awk\n# Read next line:\ngetline line\n\n# Read from file:\ngetline line < \"file.txt\"\n\n# Read from command:\n\"date\" | getline today\nclose(\"date\")\n```\n**getline** reads the next line. Can read from current input, a file, or a command pipe."
113
+ }
114
+ ]
115
+ },
116
+ "gsub": {
117
+ "contents": [
118
+ {
119
+ "value": "```awk\n{ gsub(/old/, \"new\") } # replace all in $0\n{ gsub(/,/, \"\\t\", $0) } # CSV to TSV\nn = gsub(/pattern/, \"rep\") # returns replacement count\n```\n**gsub** globally substitutes pattern matches. Modifies the target in place. Returns count."
120
+ }
121
+ ]
122
+ },
123
+ "sub": {
124
+ "contents": [
125
+ {
126
+ "value": "```awk\n{ sub(/^[ \\t]+/, \"\") } # trim leading whitespace\n{ sub(/pattern/, \"rep\") } # replace first match only\n```\n**sub** substitutes the first occurrence only. Use `gsub` for all occurrences."
127
+ }
128
+ ]
129
+ },
130
+ "match": {
131
+ "contents": [
132
+ {
133
+ "value": "```awk\nif (match($0, /[0-9]+/)) {\n print substr($0, RSTART, RLENGTH)\n}\n```\n**match** finds a regex in a string. Sets `RSTART` and `RLENGTH`. Returns position or 0."
134
+ }
135
+ ]
136
+ },
137
+ "substr": {
138
+ "contents": [
139
+ {
140
+ "value": "```awk\nsubstr($0, 1, 10) # first 10 characters\nsubstr($0, 5) # from position 5 to end\n```\n**substr(string, start, length)** extracts a substring. Position is 1-based."
141
+ }
142
+ ]
143
+ },
144
+ "split": {
145
+ "contents": [
146
+ {
147
+ "value": "```awk\nn = split($0, arr, \":\")\nfor (i = 1; i <= n; i++)\n print arr[i]\n```\n**split(string, array, separator)** splits a string into an array. Returns the number of elements."
148
+ }
149
+ ]
150
+ },
151
+ "length": {
152
+ "contents": [
153
+ {
154
+ "value": "```awk\nlength($0) # string length\nlength(arr) # array size (gawk)\n```\n**length** returns the number of characters in a string or elements in an array (gawk)."
155
+ }
156
+ ]
157
+ },
158
+ "tolower": {
159
+ "contents": [
160
+ {
161
+ "value": "```awk\n{ print tolower($0) }\n{ print toupper($1) }\n```\n**tolower/toupper** convert strings to lower/upper case."
162
+ }
163
+ ]
164
+ },
165
+ "sprintf": {
166
+ "contents": [
167
+ {
168
+ "value": "```awk\nresult = sprintf(\"%.2f\", $1 * 1.08)\nformatted = sprintf(\"%04d\", NR)\n```\n**sprintf** returns a formatted string (like printf but doesn't print)."
169
+ }
170
+ ]
171
+ },
172
+ "system": {
173
+ "contents": [
174
+ {
175
+ "value": "```awk\n{ system(\"mkdir -p \" $1) }\nsystem(\"echo done\")\n```\n**system(command)** executes a shell command. Returns the exit status."
176
+ }
177
+ ]
178
+ },
179
+ "pipe": {
180
+ "contents": [
181
+ {
182
+ "value": "```awk\n{ print $0 | \"sort\" }\n{ print $0 | \"sort -u > output.txt\" }\nEND { close(\"sort\") }\n```\n**Pipe** sends output to a command. Always `close()` pipes to flush output."
183
+ }
184
+ ]
185
+ },
186
+ "print_to_file": {
187
+ "contents": [
188
+ {
189
+ "value": "```awk\n{ print $0 > \"output.txt\" } # overwrite\n{ print $0 >> \"append.txt\" } # append\n{ print $1 > ($2 \".txt\") } # dynamic filename\n```\n**Output redirection** — `>` overwrites, `>>` appends. Close files when done."
190
+ }
191
+ ]
192
+ },
193
+ "ternary": {
194
+ "contents": [
195
+ {
196
+ "value": "```awk\n{ print ($1 > 0 ? \"positive\" : \"non-positive\") }\n{ max = ($1 > $2 ? $1 : $2) }\n```\n**Ternary operator** `condition ? true_val : false_val` for inline conditionals."
197
+ }
198
+ ]
199
+ },
200
+ "string_concat": {
201
+ "contents": [
202
+ {
203
+ "value": "```awk\n{ result = $1 \" \" $2 } # space concatenation\n{ name = first \"_\" last } # with separator\n{ s = s $0 \"\\n\" } # accumulate lines\n```\n**String concatenation** is done by juxtaposition (placing strings next to each other)."
204
+ }
205
+ ]
206
+ },
207
+ "regex_match": {
208
+ "contents": [
209
+ {
210
+ "value": "```awk\n$0 ~ /pattern/ { print } # line matches\n$1 !~ /^[0-9]/ { print } # field doesn't match\n/^#/ { next } # skip comments\n```\n**Regex operators** — `~` matches, `!~` doesn't match. Bare `/regex/` matches against `$0`."
211
+ }
212
+ ]
213
+ },
214
+ "next": {
215
+ "contents": [
216
+ {
217
+ "value": "```awk\n/^#/ { next } # skip comment lines\nNR == 1 { next } # skip header\n{ process($0) }\n```\n**next** skips to the next input line, bypassing remaining rules for the current line."
218
+ }
219
+ ]
220
+ },
221
+ "exit": {
222
+ "contents": [
223
+ {
224
+ "value": "```awk\nNR == 100 { exit } # stop after 100 lines\n/STOP/ { exit 1 } # exit with error code\nEND { print \"done\" } # END still runs after exit\n```\n**exit** stops processing input. Optional status code. END block still executes."
225
+ }
226
+ ]
227
+ },
228
+ "function": {
229
+ "contents": [
230
+ {
231
+ "value": "```awk\nfunction max(a, b) {\n return (a > b ? a : b)\n}\n\nfunction trim(s) {\n gsub(/^[ \\t]+|[ \\t]+$/, \"\", s)\n return s\n}\n\n{ print max($1, $2) }\n```\n**function** defines user functions. Parameters are local. Extra params after actual args are local variables."
232
+ }
233
+ ]
234
+ },
235
+ "ARGV": {
236
+ "contents": [
237
+ {
238
+ "value": "```awk\nBEGIN {\n print \"Program:\", ARGV[0]\n print \"Files:\", ARGC - 1\n for (i = 1; i < ARGC; i++)\n print ARGV[i]\n}\n```\n**ARGV/ARGC** — command-line arguments. ARGV[0] is `awk`, subsequent entries are input files."
239
+ }
240
+ ]
241
+ },
242
+ "multiple_files": {
243
+ "contents": [
244
+ {
245
+ "value": "```bash\n# Process multiple files:\nawk '{print FILENAME, FNR, $0}' file1.txt file2.txt\n\n# Join two files (like paste):\nawk 'FNR==NR {a[FNR]=$0; next} {print a[FNR], $0}' file1 file2\n```\n**Multiple files** — FNR resets per file, NR keeps counting. `FNR==NR` trick processes first file only."
246
+ }
247
+ ]
248
+ },
249
+ "csv_parsing": {
250
+ "contents": [
251
+ {
252
+ "value": "```awk\n# Simple CSV:\nBEGIN { FS = \",\" }\n{ print $1, $3 }\n\n# Quoted CSV (gawk with FPAT):\nBEGIN { FPAT = \"([^,]*)|\\\"([^\\\"]*)\\\"\" }\n{ print $1, $2 }\n```\n**CSV parsing** — Simple with `-F,` but quoted fields need FPAT (gawk) or a proper CSV parser."
253
+ }
254
+ ]
255
+ },
256
+ "OFMT": {
257
+ "contents": [
258
+ {
259
+ "value": "```awk\nBEGIN { OFMT = \"%.2f\" }\n{ print $1 + 0 } # outputs with 2 decimal places\n```\n**OFMT** controls the output format for numbers converted to strings. Default is `%.6g`."
260
+ }
261
+ ]
262
+ },
263
+ "SUBSEP": {
264
+ "contents": [
265
+ {
266
+ "value": "```awk\n{ count[$1, $2]++ } # multi-dimensional array key\nfor (key in count) {\n split(key, parts, SUBSEP)\n print parts[1], parts[2], count[key]\n}\n```\n**SUBSEP** (subscript separator, `\\034`) joins multi-dimensional array indices. Split with `SUBSEP` to recover keys."
267
+ }
268
+ ]
269
+ },
270
+ "delete_array": {
271
+ "contents": [
272
+ {
273
+ "value": "```awk\ndelete arr[\"key\"] # delete one element\ndelete arr # delete entire array (gawk)\n\nfor (k in arr) delete arr[k] # portable delete all\n```\n**delete** removes array elements. `delete arr` clears entire array (gawk extension)."
274
+ }
275
+ ]
276
+ },
277
+ "ERRNO": {
278
+ "contents": [
279
+ {
280
+ "value": "```awk\nif ((getline line < \"file.txt\") < 0)\n print \"Error:\", ERRNO\n```\n**ERRNO** (gawk) contains the error message when I/O operations fail."
281
+ }
282
+ ]
283
+ },
284
+ "gawk_extensions": {
285
+ "contents": [
286
+ {
287
+ "value": "```awk\n# gawk-specific features:\n@include \"library.awk\" # include files\nBEGINFILE { print FILENAME } # per-file begin\nENDFILE { print FNR, \"lines\" } # per-file end\nswitch ($1) { case /pat/: ...; default: ... }\n```\n**gawk extensions** add includes, BEGINFILE/ENDFILE, switch/case, and more."
43
288
  }
44
289
  ]
45
290
  }
@@ -4,42 +4,287 @@
4
4
  "format": {
5
5
  "contents": [
6
6
  {
7
- "value": "```\n# .---------------- minute (0-59)\n# | .------------- hour (0-23)\n# | | .---------- day of month (1-31)\n# | | | .------- month (1-12 or jan-dec)\n# | | | | .---- day of week (0-7 or sun-sat)\n# | | | | |\n * * * * * command\n```\n**Cron expression** has 5 time fields followed by the command. Fields support `*`, ranges (`1-5`), lists (`1,3,5`), and steps (`*/5`)."
7
+ "value": "```cron\n# .---- minute (0-59)\n# | .---- hour (0-23)\n# | | .---- day of month (1-31)\n# | | | .---- month (1-12 or jan-dec)\n# | | | | .---- day of week (0-7 or sun-sat)\n# | | | | |\n * * * * * command\n```\n**Cron expression** has 5 time fields plus a command. Supports `*`, ranges, lists, and steps."
8
8
  }
9
9
  ]
10
10
  },
11
11
  "examples": {
12
12
  "contents": [
13
13
  {
14
- "value": "```cron\n*/5 * * * * # every 5 minutes\n0 */2 * * * # every 2 hours\n0 9 * * 1-5 # weekdays at 9 AM\n0 0 1 * * # monthly (1st at midnight)\n0 0 * * 0 # weekly (Sunday midnight)\n30 2 * * * # daily at 2:30 AM\n```\n**Common schedules** - The most frequently used cron patterns for server tasks."
14
+ "value": "```cron\n*/5 * * * * # every 5 minutes\n0 */2 * * * # every 2 hours\n0 9 * * 1-5 # weekdays at 9 AM\n0 0 1 * * # monthly (1st at midnight)\n0 0 * * 0 # weekly (Sunday midnight)\n30 2 * * * # daily at 2:30 AM\n```\n**Common schedules** the most frequently used cron patterns."
15
15
  }
16
16
  ]
17
17
  },
18
18
  "special": {
19
19
  "contents": [
20
20
  {
21
- "value": "```cron\n@reboot command # run once at startup\n@hourly command # 0 * * * *\n@daily command # 0 0 * * *\n@weekly command # 0 0 * * 0\n@monthly command # 0 0 1 * *\n@yearly command # 0 0 1 1 *\n```\n**Special strings** are shortcuts for common schedules. `@reboot` is particularly useful for startup tasks."
21
+ "value": "```cron\n@reboot command # run once at startup\n@hourly command # 0 * * * *\n@daily command # 0 0 * * *\n@weekly command # 0 0 * * 0\n@monthly command # 0 0 1 * *\n@yearly command # 0 0 1 1 *\n```\n**Special strings** are shortcuts for common schedules."
22
22
  }
23
23
  ]
24
24
  },
25
25
  "logging": {
26
26
  "contents": [
27
27
  {
28
- "value": "```cron\n# Log stdout and stderr to file:\n0 2 * * * /opt/backup.sh >> /var/log/backup.log 2>&1\n\n# Silence output:\n0 * * * * /opt/check.sh > /dev/null 2>&1\n\n# Email output:\nMAILTO=admin@example.com\n```\n**Logging** - Redirect output to files. Without redirection, cron emails output to MAILTO."
28
+ "value": "```cron\n# Log stdout and stderr:\n0 2 * * * /opt/backup.sh >> /var/log/backup.log 2>&1\n\n# Silence output:\n0 * * * * /opt/check.sh > /dev/null 2>&1\n\n# Email output:\nMAILTO=admin@example.com\n```\n**Logging** Redirect output to files. Without redirection, cron emails output to MAILTO."
29
29
  }
30
30
  ]
31
31
  },
32
32
  "PATH": {
33
33
  "contents": [
34
34
  {
35
- "value": "```cron\n# Cron has minimal PATH by default!\n# Always set PATH or use absolute paths:\nPATH=/usr/local/bin:/usr/bin:/bin\n\n# Or use absolute command paths:\n0 * * * * /usr/local/bin/node /opt/app/task.js\n```\n**PATH** - Cron's default PATH is minimal. Commands that work in your shell may fail in cron without setting PATH."
35
+ "value": "```cron\n# Cron has minimal PATH!\nPATH=/usr/local/bin:/usr/bin:/bin\n\n# Or use absolute paths:\n0 * * * * /usr/local/bin/node /opt/app/task.js\n```\n**PATH** Cron's default PATH is minimal. Set PATH or use absolute command paths."
36
36
  }
37
37
  ]
38
38
  },
39
39
  "flock": {
40
40
  "contents": [
41
41
  {
42
- "value": "```cron\n# Prevent overlapping runs:\n*/5 * * * * flock -n /tmp/myjob.lock /opt/slow-task.sh\n\n# With timeout:\n*/5 * * * * flock -w 10 /tmp/myjob.lock /opt/task.sh\n```\n**flock** prevents concurrent execution. Use `-n` to skip if locked, `-w N` to wait up to N seconds."
42
+ "value": "```cron\n# Prevent overlapping runs:\n*/5 * * * * flock -n /tmp/myjob.lock /opt/slow-task.sh\n\n# With timeout:\n*/5 * * * * flock -w 10 /tmp/myjob.lock /opt/task.sh\n```\n**flock** prevents concurrent execution. `-n` to skip if locked, `-w N` to wait."
43
+ }
44
+ ]
45
+ },
46
+ "minute": {
47
+ "contents": [
48
+ {
49
+ "value": "```cron\n# Minute field (0-59):\n0 # at minute 0 (top of hour)\n*/5 # every 5 minutes\n5,10,15 # at minutes 5, 10, and 15\n0-30 # every minute from 0 to 30\n```\n**Minute** is the first field (0-59). Determines which minute(s) of the hour the job runs."
50
+ }
51
+ ]
52
+ },
53
+ "hour": {
54
+ "contents": [
55
+ {
56
+ "value": "```cron\n# Hour field (0-23):\n0 # midnight\n9 # 9 AM\n*/6 # every 6 hours\n9-17 # 9 AM to 5 PM\n```\n**Hour** is the second field (0-23). Uses 24-hour format."
57
+ }
58
+ ]
59
+ },
60
+ "day_of_month": {
61
+ "contents": [
62
+ {
63
+ "value": "```cron\n# Day of month field (1-31):\n1 # first of month\n15 # 15th\n1,15 # 1st and 15th\n```\n**Day of month** is the third field (1-31). If month has fewer days, job won't run on invalid dates."
64
+ }
65
+ ]
66
+ },
67
+ "month": {
68
+ "contents": [
69
+ {
70
+ "value": "```cron\n# Month field (1-12 or jan-dec):\n1 # January\n*/3 # every 3 months\n6-8 # June through August\njan,jul # January and July\n```\n**Month** is the fourth field (1-12 or names). Names are case-insensitive."
71
+ }
72
+ ]
73
+ },
74
+ "day_of_week": {
75
+ "contents": [
76
+ {
77
+ "value": "```cron\n# Day of week (0-7 or sun-sat, 0 and 7 = Sunday):\n0 # Sunday\n1-5 # Monday through Friday\n6,0 # weekends\nmon,wed,fri\n```\n**Day of week** is the fifth field. Both 0 and 7 represent Sunday."
78
+ }
79
+ ]
80
+ },
81
+ "asterisk": {
82
+ "contents": [
83
+ {
84
+ "value": "```cron\n* * * * * # every minute\n```\n**Asterisk** `*` matches every possible value for that field."
85
+ }
86
+ ]
87
+ },
88
+ "step": {
89
+ "contents": [
90
+ {
91
+ "value": "```cron\n*/5 * * * * # every 5 minutes\n0 */2 * * * # every 2 hours\n* * */3 * * # every 3 days\n```\n**Step values** `*/N` run every N units. Can combine with ranges: `1-30/5` = 1,6,11,16,21,26."
92
+ }
93
+ ]
94
+ },
95
+ "range": {
96
+ "contents": [
97
+ {
98
+ "value": "```cron\n0 9-17 * * * # every hour 9 AM to 5 PM\n0 0 * * 1-5 # weekdays at midnight\n```\n**Ranges** `N-M` match all values from N to M inclusive."
99
+ }
100
+ ]
101
+ },
102
+ "list": {
103
+ "contents": [
104
+ {
105
+ "value": "```cron\n0 0 1,15 * * # 1st and 15th\n0 9 * * mon,wed # Monday and Wednesday\n```\n**Lists** `A,B,C` match specific values. Combine with ranges: `1-5,10,15`."
106
+ }
107
+ ]
108
+ },
109
+ "MAILTO": {
110
+ "contents": [
111
+ {
112
+ "value": "```cron\nMAILTO=admin@example.com\n# Multiple recipients:\nMAILTO=admin@example.com,ops@example.com\n# Disable email:\nMAILTO=\"\"\n```\n**MAILTO** sets the email recipient for job output. Empty string disables email."
113
+ }
114
+ ]
115
+ },
116
+ "SHELL": {
117
+ "contents": [
118
+ {
119
+ "value": "```cron\nSHELL=/bin/bash\n# or\nSHELL=/bin/sh\n```\n**SHELL** sets the shell used to run commands. Default is `/bin/sh`. Set to `/bin/bash` for bash features."
120
+ }
121
+ ]
122
+ },
123
+ "HOME": {
124
+ "contents": [
125
+ {
126
+ "value": "```cron\nHOME=/opt/app\n0 * * * * ./run.sh\n```\n**HOME** sets the working directory for cron jobs. Affects relative paths in commands."
127
+ }
128
+ ]
129
+ },
130
+ "crontab_commands": {
131
+ "contents": [
132
+ {
133
+ "value": "```bash\ncrontab -e # edit your crontab\ncrontab -l # list your crontab\ncrontab -r # remove your crontab\ncrontab -u user -l # list another user's crontab\n```\n**crontab commands** manage per-user cron schedules."
134
+ }
135
+ ]
136
+ },
137
+ "system_crontab": {
138
+ "contents": [
139
+ {
140
+ "value": "```cron\n# /etc/crontab has an extra USER field:\n* * * * * root /usr/local/bin/check.sh\n0 2 * * * www-data /opt/cleanup.sh\n```\n**System crontab** (`/etc/crontab`) includes a username field between the time spec and command."
141
+ }
142
+ ]
143
+ },
144
+ "cron_d": {
145
+ "contents": [
146
+ {
147
+ "value": "```bash\n# Drop-in files: /etc/cron.d/myapp\n# Same format as /etc/crontab (with user field)\n0 * * * * appuser /opt/myapp/hourly.sh\n```\n**/etc/cron.d/** directory holds per-application cron files. Same format as system crontab."
148
+ }
149
+ ]
150
+ },
151
+ "cron_directories": {
152
+ "contents": [
153
+ {
154
+ "value": "```bash\n/etc/cron.hourly/ # scripts run hourly\n/etc/cron.daily/ # scripts run daily\n/etc/cron.weekly/ # scripts run weekly\n/etc/cron.monthly/ # scripts run monthly\n```\n**Periodic directories** run scripts at fixed intervals. Place executable scripts (no extension) in these dirs."
155
+ }
156
+ ]
157
+ },
158
+ "environment": {
159
+ "contents": [
160
+ {
161
+ "value": "```cron\n# Set variables at the top:\nPATH=/usr/local/bin:/usr/bin:/bin\nSHELL=/bin/bash\nMAILTO=admin@example.com\nHOME=/opt/app\n\n0 * * * * ./my-script.sh\n```\n**Environment variables** set at the top of crontab apply to all jobs below. Only simple `KEY=value` syntax."
162
+ }
163
+ ]
164
+ },
165
+ "anacron": {
166
+ "contents": [
167
+ {
168
+ "value": "```bash\n# /etc/anacrontab:\n# period delay identifier command\n1 5 daily-task /opt/daily.sh\n7 10 weekly-task /opt/weekly.sh\n```\n**anacron** runs missed jobs after system wake/boot. Useful for laptops and machines that aren't always on."
169
+ }
170
+ ]
171
+ },
172
+ "two_am_problem": {
173
+ "contents": [
174
+ {
175
+ "value": "```cron\n# DST problem: 2 AM may occur twice or not at all\n# Safer: use UTC in crontab\nTZ=UTC\n0 7 * * * /opt/task.sh # 7 AM UTC\n```\n**DST/timezone** — Jobs at 2-3 AM may be skipped or run twice during DST changes. Use UTC to avoid this."
176
+ }
177
+ ]
178
+ },
179
+ "random_delay": {
180
+ "contents": [
181
+ {
182
+ "value": "```cron\n# Add random delay to avoid thundering herd:\n*/5 * * * * sleep $((RANDOM % 60)) && /opt/task.sh\n\n# Or use systemd timer RandomizedDelaySec\n```\n**Random delay** prevents many servers from hitting a service simultaneously."
183
+ }
184
+ ]
185
+ },
186
+ "timeout": {
187
+ "contents": [
188
+ {
189
+ "value": "```cron\n# Kill job if it runs too long:\n0 2 * * * timeout 3600 /opt/long-task.sh\n\n# timeout with signal:\n0 2 * * * timeout --signal=SIGKILL 3600 /opt/task.sh\n```\n**timeout** kills a cron job if it exceeds the specified duration. Prevents jobs from running indefinitely."
190
+ }
191
+ ]
192
+ },
193
+ "nice": {
194
+ "contents": [
195
+ {
196
+ "value": "```cron\n# Run with lower priority:\n0 2 * * * nice -n 19 /opt/heavy-task.sh\n\n# Also limit I/O:\n0 2 * * * ionice -c 3 nice -n 19 /opt/task.sh\n```\n**nice/ionice** reduce CPU and I/O priority for resource-intensive cron jobs."
197
+ }
198
+ ]
199
+ },
200
+ "chronic": {
201
+ "contents": [
202
+ {
203
+ "value": "```cron\n# chronic: only show output on error\n*/5 * * * * chronic /opt/check.sh\n\n# From moreutils package\n```\n**chronic** (from moreutils) suppresses output unless the command fails. Eliminates noisy success emails."
204
+ }
205
+ ]
206
+ },
207
+ "backup_pattern": {
208
+ "contents": [
209
+ {
210
+ "value": "```cron\n# Daily backup at 2 AM\n0 2 * * * /opt/backup.sh daily\n# Weekly backup Sunday at 3 AM\n0 3 * * 0 /opt/backup.sh weekly\n# Monthly backup 1st at 4 AM\n0 4 1 * * /opt/backup.sh monthly\n```\n**Backup pattern** — stagger daily, weekly, and monthly backups at different times."
211
+ }
212
+ ]
213
+ },
214
+ "logrotate": {
215
+ "contents": [
216
+ {
217
+ "value": "```cron\n# Rotate logs daily at midnight:\n0 0 * * * /usr/sbin/logrotate /etc/logrotate.conf\n\n# Or rely on system cron.daily\n```\n**Log rotation** is commonly scheduled via cron to prevent log files from filling disk."
218
+ }
219
+ ]
220
+ },
221
+ "certbot": {
222
+ "contents": [
223
+ {
224
+ "value": "```cron\n# Renew Let's Encrypt certificates twice daily:\n0 0,12 * * * certbot renew --quiet\n```\n**certbot renewal** — Check twice daily. Certbot only renews if expiry is within 30 days."
225
+ }
226
+ ]
227
+ },
228
+ "health_check": {
229
+ "contents": [
230
+ {
231
+ "value": "```cron\n# Check service health every minute:\n* * * * * curl -sf http://localhost:3000/health || systemctl restart myapp\n```\n**Health checks** use cron to monitor services and auto-restart on failure."
232
+ }
233
+ ]
234
+ },
235
+ "at_vs_cron": {
236
+ "contents": [
237
+ {
238
+ "value": "```bash\n# cron: recurring schedule\n0 9 * * * /opt/daily.sh\n\n# at: one-time execution\nat 9:00 AM tomorrow <<< '/opt/once.sh'\n```\n**cron vs at** — `cron` for recurring jobs, `at` for one-time scheduled tasks."
239
+ }
240
+ ]
241
+ },
242
+ "monitoring": {
243
+ "contents": [
244
+ {
245
+ "value": "```cron\n# Heartbeat monitoring with healthchecks.io:\n*/5 * * * * /opt/task.sh && curl -fsS --retry 3 https://hc-ping.com/uuid > /dev/null\n```\n**Monitoring** — Ping a health check URL after each run to detect failed or missed jobs."
246
+ }
247
+ ]
248
+ },
249
+ "cron_alternatives": {
250
+ "contents": [
251
+ {
252
+ "value": "```bash\n# systemd timer (modern Linux alternative):\n# /etc/systemd/system/mytask.timer\n# [Timer]\n# OnCalendar=*-*-* 02:00:00\n# Persistent=true\n```\n**systemd timers** are the modern alternative to cron on systemd-based systems. Support better logging and dependencies."
253
+ }
254
+ ]
255
+ },
256
+ "day_conflict": {
257
+ "contents": [
258
+ {
259
+ "value": "```cron\n# Day of month AND day of week: OR logic!\n0 0 1 * 5 # runs on 1st AND every Friday\n# NOT: 1st if it's a Friday\n```\n**Day conflict** — When both day-of-month and day-of-week are specified, the job runs when EITHER matches (OR logic)."
260
+ }
261
+ ]
262
+ },
263
+ "database_backup": {
264
+ "contents": [
265
+ {
266
+ "value": "```cron\n# PostgreSQL backup:\n0 2 * * * pg_dump -U postgres mydb | gzip > /backup/mydb_$(date +\\%Y\\%m\\%d).sql.gz\n\n# MySQL backup:\n0 2 * * * mysqldump -u root mydb | gzip > /backup/mydb_$(date +\\%Y\\%m\\%d).sql.gz\n```\n**Database backups** — Use `pg_dump`/`mysqldump` with gzip compression. Note: escape `%` as `\\%` in crontab."
267
+ }
268
+ ]
269
+ },
270
+ "percent_escape": {
271
+ "contents": [
272
+ {
273
+ "value": "```cron\n# % has special meaning in crontab (newline/stdin)\n# Must escape with backslash:\n0 2 * * * echo $(date +\\%Y-\\%m-\\%d) >> /var/log/date.log\n\n# Unescaped % splits command:\n0 * * * * /cmd%stdin data # sends 'stdin data' as input\n```\n**Percent sign** `%` in crontab means newline and stdin. Always escape as `\\%` in date formats."
274
+ }
275
+ ]
276
+ },
277
+ "cleanup": {
278
+ "contents": [
279
+ {
280
+ "value": "```cron\n# Delete files older than 30 days:\n0 3 * * * find /tmp -type f -mtime +30 -delete\n\n# Delete old log files:\n0 3 * * * find /var/log/app -name '*.log' -mtime +7 -delete\n```\n**Cleanup jobs** use `find -mtime -delete` to remove old files. Always test the find command first."
281
+ }
282
+ ]
283
+ },
284
+ "user_permissions": {
285
+ "contents": [
286
+ {
287
+ "value": "```bash\n# Edit root's crontab:\nsudo crontab -e\n\n# Restrict cron access:\n# /etc/cron.allow - only listed users can use cron\n# /etc/cron.deny - listed users are denied cron\n```\n**Permissions** — `/etc/cron.allow` and `/etc/cron.deny` control who can use crontab."
43
288
  }
44
289
  ]
45
290
  }