@@ -718,7 +718,7 @@ commit
718
718
<ul>
719
719
<li><strong>element</strong> - (optional) - the element which has focus during key-up or key-down</li>
720
720
<li><strong>key-code</strong> - the key code of the key to be monitored</li>
721
- <li><strong>key</strong> - (optional) - the key to be monitored; an alternative to key-code for a premade list of keys:
721
+ <li><strong>key</strong> - (optional) - the key to be monitored; an alternative to key-code for a pre-made list of keys:
722
722
<ul>
723
723
<li>"tab</li>
724
724
<li>"enter"</li>
@@ -1436,18 +1436,15 @@ The system library provides various system-level utilities for Eve.
1436
1436
<td>
1437
1437
<code>
1438
1438
Commits a timer that ticks every 1000 milliseconds
1439
-
1440
1439
```
1441
1440
commit
1442
1441
[ #system/timer resolution: 1000]
1443
1442
```
1444
1443
1445
1444
Displays the current time
1446
-
1447
1445
```
1448
1446
search
1449
1447
[ #system/timer hour minute second]
1450
-
1451
1448
bind
1452
1449
[ #ui/text text: "{{hour}}:{{minute}}:{{second}}"]
1453
1450
```
@@ -1456,4 +1453,180 @@ bind
1456
1453
</tr>
1457
1454
</table>
1458
1455
1456
+ ## File
1457
+
1458
+ Watchers that access the filesystem. These watchers only work in headless mode.
1459
+
1460
+ <table class="libitem">
1461
+ <tr>
1462
+ <td colspan="2">
1463
+ <b>#file/read</b> - read the specified file
1464
+ </td>
1465
+ </tr>
1466
+
1467
+ <tr>
1468
+ <td>
1469
+ <ul>
1470
+ <li><strong>path</strong> - The path of the file to be read.</li>
1471
+ <li><strong>encoding</strong> - (optional) - The encoding of the file. The default is utf-8.</li>
1472
+ <li><strong>error</strong> - (optional) - If an error is encountered when attempting to read the file, it will be stored here as a #file/error.</li>
1473
+ <li><strong>contents</strong> - The contents of the file. This attribute will have a value once the entire contents of the file are read.</li>
1474
+ </ul>
1475
+ </td>
1476
+ <td>
1477
+ <code>
1478
+ Read a file
1479
+ ```
1480
+ commit
1481
+ [ #file/read #my-file path: "test-file.txt"]
1482
+ ```
1483
+
1484
+ Display the contents of the file
1485
+ ```
1486
+ search
1487
+ [ #my-file contents]
1488
+ commit
1489
+ [ #console/log text: contents]
1490
+ ```
1491
+ </code>
1492
+ </td>
1493
+ </tr>
1494
+ </table>
1495
+
1496
+ <table class="libitem">
1497
+ <tr>
1498
+ <td colspan="2">
1499
+ <b>#file/read</b> - read the specified file
1500
+ </td>
1501
+ </tr>
1502
+
1503
+ <tr>
1504
+ <td>
1505
+ <ul>
1506
+ <li><strong>path</strong> - The path of the file to be written.</li>
1507
+ <li><strong>encoding</strong> - (optional) - The encoding of the file. The default is utf-8.</li>
1508
+ <li><strong>contents</strong> - The string that will be written to the file</li>
1509
+ <li><strong>error</strong> - (optional) - If an error is encountered when attempting to read the file, it will be stored here as a #file/error.</li>
1510
+ <li><strong>#file/complete</strong> - When the contents are written successfully, the record will be tagged #file/complete.</li>
1511
+ </ul>
1512
+ </td>
1513
+ <td>
1514
+ <code>
1515
+ Write a string to a file
1516
+ ```
1517
+ commit
1518
+ [ #file/write path: "test-file.txt" contents: "This will be in the file"]
1519
+ ```
1520
+ </code>
1521
+ </td>
1522
+ </tr>
1523
+ </table>
1524
+
1525
+ <table class="libitem">
1526
+ <tr>
1527
+ <td colspan="2">
1528
+ <b>#file/error</b> - stores information relating to file access errors
1529
+ </td>
1530
+ </tr>
1531
+
1532
+ <tr>
1533
+ <td>
1534
+ <ul>
1535
+ <li><strong>code</strong> - The error code</li>
1536
+ <li><strong>message</strong> - The error message</li>
1537
+ </ul>
1538
+ </td>
1539
+ <td>
1540
+ <code>
1541
+ Display a message when a file does not exist
1542
+ ```
1543
+ search
1544
+ [ #file/read path error: [ code: "ENOENT"]]
1545
+ commit
1546
+ [ #console/error text: "Could not file file {{path}}"]
1547
+ ```
1548
+ </code>
1549
+ </td>
1550
+ </tr>
1551
+ </table>
1552
+
1553
+ ## Console
1554
+
1555
+ Write text to the console
1556
+
1557
+ <table class="libitem">
1558
+ <tr>
1559
+ <td colspan="2">
1560
+ <b>#console/log</b> - write info to the console
1561
+ </td>
1562
+ </tr>
1563
+
1564
+ <tr>
1565
+ <td>
1566
+ <ul>
1567
+ <li><strong>text</strong> - The text to write to the console. Text will also be written to stdout.</li>
1568
+ </ul>
1569
+ </td>
1570
+ <td>
1571
+ <code>
1572
+ Write a message to the console.
1573
+ ```
1574
+ commit
1575
+ [ #console/log text: "Hello world!"]
1576
+ ```
1577
+ </code>
1578
+ </td>
1579
+ </tr>
1580
+ </table>
1581
+
1582
+ <table class="libitem">
1583
+ <tr>
1584
+ <td colspan="2">
1585
+ <b>#console/warn</b> - write a warning to the console
1586
+ </td>
1587
+ </tr>
1588
+
1589
+ <tr>
1590
+ <td>
1591
+ <ul>
1592
+ <li><strong>text</strong> - The text to write to the console.</li>
1593
+ </ul>
1594
+ </td>
1595
+ <td>
1596
+ <code>
1597
+ Write a warning to the console.
1598
+ ```
1599
+ commit
1600
+ [ #console/warn text: "Memory is running low."]
1601
+ ```
1602
+ </code>
1603
+ </td>
1604
+ </tr>
1605
+ </table>
1606
+
1607
+ <table class="libitem">
1608
+ <tr>
1609
+ <td colspan="2">
1610
+ <b>#console/error</b> - write an error to the console.
1611
+ </td>
1612
+ </tr>
1613
+
1614
+ <tr>
1615
+ <td>
1616
+ <ul>
1617
+ <li><strong>text</strong> - The text to write to the console. Text will also be written to stderr.</li>
1618
+ </ul>
1619
+ </td>
1620
+ <td>
1621
+ <code>
1622
+ Write an error in the console.
1623
+ ```
1624
+ commit
1625
+ [ #console/error text: "Access is Denied"]
1626
+ ```
1627
+ </code>
1628
+ </td>
1629
+ </tr>
1630
+ </table>
1631
+
1459
1632
{% endraw %}
0 commit comments