implemented edurl and viewurl helpers

This commit is contained in:
Luxferre
2025-12-26 09:59:30 +02:00
parent a1ebcfcb4c
commit ab5c859cee
3 changed files with 30 additions and 10 deletions
+7 -2
View File
@@ -217,9 +217,14 @@ A simple line-oriented text editor and page-oriented text viewer for MicroPython
Exports the following functions:
- `edit(filename)`: start an `ed`-like text editor (see below)
- `edbuf()`: create an empty buffer, run the editor interface on it and return the result as a string (without creating any files)
- `edit(filename)`: start an `ed`-like text editor on a file (see below)
- `edbuf(bufstr='')`: create an empty buffer, fill it with the input string (if any), run the editor interface on it and return the result as a string (without creating any files)
- `edurl(url)`: download the URL contents via HTTP, run the editor interface on it and return the result as a string (without creating any files)
- `view(filename, lno=False)`: start a `more`-like pager for viewing a text file (pass an additional parameter to view it with line numbers)
- `viewbuf(text, lno=False)`: same as `view` but for string variables instead of files
- `viewurl(url, lno=False)`: download the URL contents via HTTP and run `viewbuf` method on the result
Note: with `edbuf` and `edurl` methods, you can always save the file locally while inside the editor interface. Use the `f` command to specify the name (see below).
The editor mode supports the following subset of POSIX ed commands in the standard `[range][command][param]` syntax: