{"id":16688477,"url":"https://github.com/hoijui/osh-dir-std-rs","last_synced_at":"2025-03-28T08:44:21.086Z","repository":{"id":136305071,"uuid":"570632854","full_name":"hoijui/osh-dir-std-rs","owner":"hoijui","description":"Code that helps humans and machines deal with the OSH directory standard","archived":false,"fork":false,"pushed_at":"2024-06-03T11:42:44.000Z","size":165,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T13:40:02.488Z","etag":null,"topics":["cli","interfacer-project-eu","interfacer-project-eu-wp4-3","library","open-source-hardware","oseg","standard"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoijui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-25T17:10:01.000Z","updated_at":"2024-06-03T11:42:47.000Z","dependencies_parsed_at":"2025-02-02T09:25:55.957Z","dependency_job_id":"3915a48d-800d-4954-b135-88aeabe77d9d","html_url":"https://github.com/hoijui/osh-dir-std-rs","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoijui%2Fosh-dir-std-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoijui%2Fosh-dir-std-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoijui%2Fosh-dir-std-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoijui%2Fosh-dir-std-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoijui","download_url":"https://codeload.github.com/hoijui/osh-dir-std-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245999318,"owners_count":20707554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","interfacer-project-eu","interfacer-project-eu-wp4-3","library","open-source-hardware","oseg","standard"],"created_at":"2024-10-12T15:43:53.557Z","updated_at":"2025-03-28T08:44:21.054Z","avatar_url":"https://github.com/hoijui.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nSPDX-FileCopyrightText: 2022 - 2023 Robin Vobruba \u003choijui.quaero@gmail.com\u003e\n\nSPDX-License-Identifier: CC0-1.0\n--\u003e\n\n# OSH directory standard - Rust library\n\n[![License: AGPL-3.0-or-later](\n    https://img.shields.io/badge/License-AGPL%203.0+-blue.svg)](\n    LICENSE.txt)\n[![REUSE status](\n    https://api.reuse.software/badge/github.com/hoijui/osh-dir-std-rs)](\n    https://api.reuse.software/info/github.com/hoijui/osh-dir-std-rs)\n[![Repo](\n    https://img.shields.io/badge/Repo-GitHub-555555\u0026logo=github.svg)](\n    https://github.com/hoijui/osh-dir-std-rs)\n[![Package Releases](\n    https://img.shields.io/crates/v/osh_dir_std.svg)](\n    https://crates.io/crates/osh_dir_std)\n[![Documentation Releases](\n    https://docs.rs/osh_dir_std/badge.svg)](\n    https://docs.rs/osh_dir_std)\n[![Dependency Status](\n    https://deps.rs/repo/github/hoijui/osh-dir-std-rs/status.svg)](\n    https://deps.rs/repo/github/hoijui/osh-dir-std-rs)\n[![Build Status](\n    https://github.com/hoijui/osh-dir-std-rs/workflows/build/badge.svg)](\n    https://github.com/hoijui/osh-dir-std-rs/actions)\n\n[![In cooperation with FabCity Hamburg](\n    https://raw.githubusercontent.com/osegermany/tiny-files/master/res/media/img/badge-fchh.svg)](\n    https://fabcity.hamburg)\n[![In cooperation with Open Source Ecology Germany](\n    https://raw.githubusercontent.com/osegermany/tiny-files/master/res/media/img/badge-oseg.svg)](\n    https://opensourceecology.de)\n\n* OSH: _**O**pen **S**ource **H**ardware_\n\nCode that helps humans and machines deal with\nthe [OSH directory standard](\nhttps://github.com/hoijui/osh-dir-std).\n\nThis consists of two parts:\n\n1. `osh_dir_std` - a (Rust) library to parse the specification(s)\n    into easily usable structures \u0026 accompanying utilities\n2. `osh-dir-std` - a CLI tool that helps checking a given projects file listing\n    against one or multiple specifications.\n\n**NOTE** \\\nThis only checks the paths of files and directories\nagainst a set of presets (aka \"standards\").\nIt does _not_ check the content of any files in any way.\n\n## Example Usage\n\n### CLI\n\n#### Installation\n\n##### From Source\n\n###### Fetch \u0026 Compile\n\n```shell\ncargo install osh-dir-std\n```\n\n###### Local Sources\n\n```shell\ncargo install --path bin\n```\n\n#### Usage\n\nThe tool expects a new-line separated listing of files\n(and optionally directories) of the project,\neither on [`stdin`](\nhttps://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)),\nor in a file given as the first argument.\nThis list might come from git\n(or any other [version control system (VCS)](\nhttps://en.wikipedia.org/wiki/Version_control) used),\nthe file-system directly,\na ZIP file or even a web-site that lists the files.\n\nA few examples of how to list files in different scenarios,\nto rate the project against the known directory standards:\n\n[git](https://git-scm.com/):\n\n```shell\ngit ls-files --recurse-submodules | sed -e 's/^\"\\(.*\\)\"$/\\1/' | osh-dir-std rate\n```\n\n[SVN](https://subversion.apache.org/):\n\n```shell\nsvn ls | osh-dir-std rate\n```\n\n[Mercurial (`hg`)](https://www.mercurial-scm.org/):\n\n```shell\nhg status --all | osh-dir-std rate\n```\n\n[pijul](https://pijul.org/):\n\n```shell\npijul list | osh-dir-std rate\n```\n\nfile-system:\n\n```shell\nls -r1 | osh-dir-std rate\n```\n\nsample output:\n\n```json\n[\n  {\n    \"name\": \"unixish\",\n    \"factor\": 0.62724684\n  },\n]\n```\n\nA factor of `1.0` would mean that the projects file- and directory structure\nadheres 100% to the respective standard.\n`unixish` is the name of the default directory standard.\n\n### Library\n\n#### Setup\n\n_Cargo.toml_:\n\n```toml\n[dependencies]\nosh_dir_std = \"0.7.2\"\n```\n\n#### Code\n\n```rust\nuse osh_dir_std::{self, format::Rec};\n\nfn find_rec(std: \u0026str, record_path: \u0026str) -\u003e Result\u003c\u0026'static Rec\u003c'static\u003e, String\u003e {\n    for rec in \u0026osh_dir_std::data::STDS.get(std).unwrap().records {\n        if rec.path == record_path {\n            return Ok(rec);\n        }\n    }\n    Err(format!(\n        \"Failed to find record with path '{record_path}' in the '{std}' dir standard\"\n    ))\n}\n\n/// Checks whether the dir std \"unixish\" contains the record \"res/\",\n/// and whether that record is a _fixed_ one. See [the definition](\n/// https://github.com/hoijui/osh-dir-std/blob/main/definition_format.csv)\n/// for an explanation of what _fixed_ means.\n#[test]\nfn unixish_res_fixed() -\u003e Result\u003c(), Error\u003e {\n    let rec = find_rec(\"unixish\", \"res/\")?;\n    assert!(rec.fixed);\n    Ok(())\n}\n```\n\n## Related Projects\n\n* [`osh`-tool](https://github.com/hoijui/osh-tool) -\n  Checks an OSH project against a set of predefined checks,\n  to try to assess its overall machine-readability and openness. \\\n  (also uses this tool internally)\n\n## Funding\n\nThis project was funded by the European Regional Development Fund (ERDF)\nin the context of the [INTERFACER Project](https://www.interfacerproject.eu/),\nfrom November 2022 (project start)\nuntil March 2023.\n\n![Logo of the EU ERDF program](\n    https://cloud.fabcity.hamburg/s/TopenKEHkWJ8j5P/download/logo-eu-erdf.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoijui%2Fosh-dir-std-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoijui%2Fosh-dir-std-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoijui%2Fosh-dir-std-rs/lists"}