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 4aff907523
Better mount control (issue #12; pr #24)
Mountpoints are typically inferred/generated from filenames with a -m/--mount flag for when reading from STDIN or to manually specify a mountpoint.
2021-06-24 07:06:38 -07:00
.github/workflows run tests in parallel, collect logs 2021-06-21 21:10:29 -04:00
binary Support other formats. (#11) 2021-06-20 18:20:06 -07:00
json Support other formats. (#11) 2021-06-20 18:20:06 -07:00
src Better mount control (issue #12; pr #24) 2021-06-24 07:06:38 -07:00
tests Better mount control (issue #12; pr #24) 2021-06-24 07:06:38 -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 Yaml support (#14) 2021-06-21 17:36:15 -07:00
LICENSE GPLv3 2021-06-07 08:23:14 -07:00
README.md migrate TODO to issues [ci skip] 2021-06-15 15:34:56 -04:00
run_tests.sh Implement setattr (#22) 2021-06-23 17:36:12 -07:00

ffs: the file filesystem

Main workflow

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 [mountpoint] [file] to mount a file at a given mountpoint.

$ ffs mnt json_eg1.json  &
[1] 80762
$ tree mnt
mnt
└── glossary
    ├── GlossDiv
    │   ├── GlossList
    │   │   └── GlossEntry
    │   │       ├── Abbrev
    │   │       ├── Acronym
    │   │       ├── GlossDef
    │   │       │   ├── GlossSeeAlso
    │   │       │   │   ├── 0
    │   │       │   │   └── 1
    │   │       │   └── para
    │   │       ├── GlossSee
    │   │       ├── GlossTerm
    │   │       ├── ID
    │   │       └── SortAs
    │   └── title
    └── title

6 directories, 11 files
$ cat mnt/glossary/GlossDiv/GlossList/GlossEntry/Abbrev
ISO 8879:1986$ cat mnt/glossary/GlossDiv/GlossList/GlossEntry/Acronym 
SGML$ cat mnt/glossary/title 
example glossary$ cat json_eg1.json 
{
    "glossary": {
        "title": "example glossary",
		"GlossDiv": {
            "title": "S",
			"GlossList": {
                "GlossEntry": {
                    "ID": "SGML",
					"SortAs": "SGML",
					"GlossTerm": "Standard Generalized Markup Language",
					"Acronym": "SGML",
					"Abbrev": "ISO 8879:1986",
					"GlossDef": {
                        "para": "A meta-markup language, used to create markup languages such as DocBook.",
						"GlossSeeAlso": ["GML", "XML"]
                    },
					"GlossSee": "markup"
                }
            }
        }
    }
}
$ ps | grep ffs
80762 ttys001    0:00.03 ffs mnt json_eg1.json
80843 ttys001    0:00.00 grep ffs
$ umount mnt
[1]+  Done                    ffs mnt json_eg1.json
$

External dependencies

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

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