1
1
mirror of https://github.com/mgree/ffs.git synced 2024-08-17 07:10:35 +03:00
the file filesystem: mount semi-structured data (like JSON) as a Unix filesystem
Go to file
Michael Greenberg a1d5718ac9
--new flag for creating files from empty (#38)
Running `--new FILE.EXT` will:

- infer the output format form `EXT`
- use `FILE.EXT` as the output
- start with a single, empty, named directory (but allocate a bit more space)

In implementing this, I realized that introducing metadata (fad45bed4b) meant we no longer inferred types automatically. I added a type `Typ::Auto` and some inference code.
2021-07-04 18:19:31 -07:00
.github/workflows add attr dep to pre-release build action, so we can pass tests on linux 2021-07-01 22:07:13 -04:00
binary Support other formats. (#11) 2021-06-20 18:20:06 -07:00
completions Completions (#27) 2021-06-25 17:14:34 -07:00
docs --new flag for creating files from empty (#38) 2021-07-04 18:19:31 -07:00
json Support other formats. (#11) 2021-06-20 18:20:06 -07:00
man --new flag for creating files from empty (#38) 2021-07-04 18:19:31 -07:00
src --new flag for creating files from empty (#38) 2021-07-04 18:19:31 -07:00
tests --new flag for creating files from empty (#38) 2021-07-04 18:19:31 -07:00
toml Support other formats. (#11) 2021-06-20 18:20:06 -07:00
yaml Yaml support (#14) 2021-06-21 17:36:15 -07:00
.gitignore deps building 2021-06-07 11:22:07 -04:00
Cargo.lock Yaml support (#14) 2021-06-21 17:36:15 -07:00
Cargo.toml fix metadata 2021-06-26 11:30:03 -04:00
CHANGELOG.md --new flag for creating files from empty (#38) 2021-07-04 18:19:31 -07:00
INSTALL.md Add INSTALL.md to document installation procedures. 2021-07-02 10:08:54 -04:00
LICENSE GPLv3 2021-06-07 08:23:14 -07:00
README.md cleanup crate description (no markdown on crates.io, apparently). add crates.io badge 2021-06-25 20:52:11 -04:00
run_tests.sh cleaner path handling 2021-06-25 14:41:17 -04:00

ffs: the file filesystem

Main workflow Crates.io

ffs, the file filessytem, let's you mount semi-structured data as a fileystem---a tree structure you already know how to work with!

Working with semi-structured data using command-line tools is hard. Tools like jq help a lot, but learning a new language for simple manipulations is a big ask. By mapping hard-to-parse trees into a filesystem, you can keep using the tools you know.

Example

Run ffs [file] to mount file.blah at the mountpoint file. The final, updated version of the file will be outputted on stdout.

$ cat object.json 
{ "name": "Michael Greenberg", "eyes": 2, "fingernails": 10, "human": true }
$ ffs -o object_edited.json object.json &
[1] 60182
$ tree object
object
├── eyes
├── fingernails
├── human
└── name

0 directories, 4 files
$ echo Mikey Indiana >object/name
$ echo 1 >object/nose
$ mkdir object/pockets
$ cd object/pockets/
$ echo keys >pants
$ echo pen >shirt
$ cd ..
$ cd ..
$ umount object
$ 
[1]+  Done                    ffs -o object_edited.json object.json
$ cat object_edited.json 
{"eyes":2,"fingernails":10,"human":true,"name":"Mikey Indiana","nose":1,"pockets":{"pants":"keys","shirt":"pen"}}

You can specify an explicit mountpoint by running ffs -m MOUNT file; you can specify an output file with -o OUTPUT. You can edit a file in place by running ffs -i file---when the volume is unmounted, the resulting output will be written back to file.

External dependencies

You need an appropriate FUSE or macFUSE along with pkg-config.

See the GitHub build workflow for examples of external dependency installation.