diff --git a/README.md b/README.md index 8041327..16d015e 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Every chat instance exposes the following methods: The handler accepts two parameters: a message and a state object, and returns the response and the new state object. If the returned state object is `None`, then the chat loop exits. Non-command handler (i.e. what should be done on any user input that doesn't start with a registered command) is registered under the `default` command. -### `deck.fs` (WIP) +### `deck.fs` FS helper librаry. @@ -72,6 +72,22 @@ Exports the following functions: - `unlock_rootfs()`: make the device root filesystem read-write (does nothing on desktop) - `lock_rootfs()`: make the device root filesystem read-only (does nothing on desktop) +- `stat(path)` (aka `du(path)`): alias to `os.stat` but returning the stats as a dictionary +- `statvfs(path)` (aka `df(path)`): alias to `os.statvfs` but returning the stats as a dictionary + +The following `deck.fs` functions are direct aliases to the corresponding `os` call counterparts: + +- `sep` = `pathsep` = `os.sep` +- `cwd` = `pwd` = `os.getcwd` +- `ls` = `listdir` = `os.listdir` +- `md` = `mkdir` = `os.mkdir` +- `cd` = `chdir` = `os.chdir` +- `rd` = `rmdir` = `os.rmdir` +- `rm` = `remove` = `os.remove` +- `mv` = `rename` = `move` = `os.rename` +- `sync` = `os.sync` (where supported) +- `env` = `getenv` = `os.getenv` +- `rnd` = `urandom` = `os.urandom` ### `deck.net` diff --git a/deck/fs.py b/deck/fs.py index 1ed3292..970bf86 100644 --- a/deck/fs.py +++ b/deck/fs.py @@ -19,7 +19,6 @@ def lock_rootfs(): storage.remount("/", readonly=True) # Some shortcut export bindings to corresponding os functions -# ['mount', 'putenv', 'stat', 'statvfs', 'system', 'umount', 'unlink', 'unsetenv', 'urandom'] sep = pathsep = os.sep cwd = pwd = os.getcwd