{"id":27305383,"url":"https://github.com/krtab/ssccpp","last_synced_at":"2025-04-12T03:28:37.475Z","repository":{"id":57668419,"uuid":"187878459","full_name":"krtab/ssccpp","owner":"krtab","description":"The Simple Switch Cases Configuration PreProcessor","archived":false,"fork":false,"pushed_at":"2020-03-04T19:14:34.000Z","size":12,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-06T02:14:40.845Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krtab.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}},"created_at":"2019-05-21T16:48:26.000Z","updated_at":"2021-05-14T18:28:39.000Z","dependencies_parsed_at":"2022-09-07T15:50:54.203Z","dependency_job_id":null,"html_url":"https://github.com/krtab/ssccpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krtab%2Fssccpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krtab%2Fssccpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krtab%2Fssccpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krtab%2Fssccpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krtab","download_url":"https://codeload.github.com/krtab/ssccpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755588,"owners_count":20990626,"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":[],"created_at":"2025-04-12T03:28:36.904Z","updated_at":"2025-04-12T03:28:37.467Z","avatar_url":"https://github.com/krtab.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"SSCCPP, the Simple Switch Cases Configuration PreProcessor\n==========================================================\n\n[![Build Status](https://travis-ci.org/krtab/ssccpp.svg?branch=master)](https://travis-ci.org/krtab/ssccpp)\n[![Version badge](https://img.shields.io/crates/v/ssccpp.svg)](https://crates.io/crates/ssccpp)\n\nThis small utility makes it easy to have a single file that can be adapted to different cases.\n\nTypical use is to **manage dotfiles, by allowing to have only one git branch where each file clearly shows its variation between your different machines.**\n\nIt is written in Rust and provides a library as well as two binaries: `ssccpp` and `ssccpp-batch`. `ssccpp`  processes a single file while `ssccpp-batch` process all files in a directory, copying its structure to an other one.\n\n### Table of Content\n\n - [Concept](#concept)\n - [Examples](#examples)\n - [Install](#install)\n\nConcept\n--------\n\n`ssccpp` works on a file where some lines have been turned into switch statements.\nThese switch statements are recognized by looking for a delimiter (by default `\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e` ie. 8 times the '\u003e' character).\n\nA switch block is composed of, in order:\n\n1. One or more \"specfic\" case(s): `\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e ident1, ident2, ...`\n2. One \"otherwise\" case: `\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e *`\n3. And ending delimiter: `\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e`\n\nWhen reaching such a block, ssccpp will check, for each *specific* case if one of the `ident` matches the searched ident (by default the hostname), and if yes, will emit the text that follows.\nWhen reaching the *otherwise* block, it will emit the text that follows if none of the *specific* statements before were entered. Finally, when reaching the ending delimiter, it will print all following text, until a new block is encountered.\n\nExamples\n--------\n\n### First example\n\n```\nThis line will be displayed everywhere.\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e foo, bar\nThis line will be displayed on foo and bar only.\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e ga, bu, zo\nThis line will be displayed on ga, bu and zo, but not foo or bar.\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e foo, zo\nThis line will be displayed on foo and zo.\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e *\nThis line will be displayed on anything that is not foo, bar, ga, bu or zo.\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\nThis line will be displayed everywhere.\n```\n\n### Configuration files example\n\nIn this example, the user has a `dotfiles` directory that mimics the structure of their `/home/user` directory:\n\n```\ndotfiles/\n├── scripts/\n│   └── wallpaper.sh\n└── .xinitrc\n```\n\nThe file content is as follow:\n\n**wallpaper.sh**\n\n```\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e laptop\nfeh --bg-scale 'Images/WallpaperLaptop.png'\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e *\nfeh --bg-scale 'Images/DefaultWallpaper.png'\n```\n\n**.xinitrc**\n\n```\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e desktop\nxrandr --dpi 166\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e laptop\nxrandr --dpi 96\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\n\nexec i3\n```\n\nUpon executing `ssccpp-batch dotfiles/ /home/user --ident laptop` the files will be placed with the same structure in their home directory and become:\n\n**wallpaper.sh**\n\n```\nfeh --bg-scale 'Images/WallpaperLaptop.png'\n```\n\n**.xinitrc**\n\n```\nxrandr --dpi 96\n\nexec i3\n```\n\nand upon executing `ssccpp-batch dotfiles/ /home/user --ident desktop` the files will become:\n\n**wallpaper.sh**\n\n```\nfeh --bg-scale 'Images/DefaultWallpaper.png'\n```\n\n**.xinitrc**\n\n```\nxrandr --dpi 166\n\nexec i3\n```\n\nInstall\n-------\n\n### Cargo\n\nBuild from the sources using cargo\n\n```bash\ncargo install ssccpp\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrtab%2Fssccpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrtab%2Fssccpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrtab%2Fssccpp/lists"}