{"id":19876406,"url":"https://github.com/foo-dogsquared/hantemcli","last_synced_at":"2026-05-12T11:38:07.892Z","repository":{"id":115061809,"uuid":"235113264","full_name":"foo-dogsquared/hantemcli","owner":"foo-dogsquared","description":"A simple Handlebars renderer in the command line. ","archived":false,"fork":false,"pushed_at":"2020-03-08T21:43:58.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T17:22:17.385Z","etag":null,"topics":["handlebars","handlebars-application","rust","rust-cli"],"latest_commit_sha":null,"homepage":null,"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/foo-dogsquared.png","metadata":{"files":{"readme":"README.adoc","changelog":"CHANGELOG.adoc","contributing":null,"funding":null,"license":"LICENSE","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":"2020-01-20T13:55:47.000Z","updated_at":"2020-03-08T21:43:38.000Z","dependencies_parsed_at":"2023-03-13T13:04:05.897Z","dependency_job_id":null,"html_url":"https://github.com/foo-dogsquared/hantemcli","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo-dogsquared%2Fhantemcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo-dogsquared%2Fhantemcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo-dogsquared%2Fhantemcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo-dogsquared%2Fhantemcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foo-dogsquared","download_url":"https://codeload.github.com/foo-dogsquared/hantemcli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241304296,"owners_count":19941101,"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":["handlebars","handlebars-application","rust","rust-cli"],"created_at":"2024-11-12T16:32:56.861Z","updated_at":"2026-05-12T11:38:02.870Z","avatar_url":"https://github.com/foo-dogsquared.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Hantemcli\n:toc:\n\n:program: Hantemcli\n\n{program} (Handlebars templating CLI) is a small application for rendering https://handlebarsjs.com/[Handlebars] templates with data files. \nUtilizing the https://crates.io/crates/config[`config` Rust library], it is possible to merge the data files to create the template (as long as it result in a top-level hash table anyway). \n\n\n\n\n== Design rationale \n\n* Make the full use of the underlying https://crates.io/crates/handlebars[Handlebars library] while providing a smooth user experience using it in the command line. \n\n* Mainly include the support for https://handlebarsjs.com/guide/#partials[partials] and custom helpers (not yet possible for the latter). \n\n* Make use of more than one data files and include support for more data formats. \n\n* Enforce certain conventions for rendering with Handlebars (or something BS). \n\n\n\n\n== Non-goals \n\n* High performance is not a priority especially with a large number of templates and/or data files. \n\n* Provide a way of granular level of control for interacting with the program — i.e., filtering certain files, setting a minimum and maximum depth of the folder to search for the templates. \nIt'll be an interesting challenge anyhow on how to provide certain scale of control while making it stupidly simple. \n(Though, it'll be some form of bikeshedding at that point.)\n\n\n\n\n== Getting started \n\nTo get started with using {program}. \nJust have the plain text files and your data formats ready. \n\nThen execute Hantemcli similar to the following command. \n\n[source, shell]\n----\nhantemcli TEMPLATE_FILES... -- DATA_FILES...\n----\n\nThe templates files are then stored in a key-value registry with the relative path without the file extension as the key. \nThe template files should have `.hbs` as the file extension. \n\n[source, shell]\n----\nhantemcli tests/template.hbs tests/base.hbs -- tests/default.toml tests/dev.toml\n\n# Will result in a template registry with the templates `tests/template` and `tests/base`. \n----\n\nYou can also give a directory that will register all of the valid template files in the directory and its subdirectories. \nThe multiple templates is particularly for https://handlebarsjs.com/guide/#partials[partials] making rendering skeleton templates possible. \nThe key of the templates in the directory is also set relative to the path of the directory — e.g., 'tests/template.hbs' will be set as 'template', 'tests/base' as 'base', etc. \n\nThat said, to set the root template (the template to be rendered), you can explicitly set the template name stored in the registry with the `-r`/`--root` option. \nIf the root template flag is not set, it will get the alphabetically first template name in the registry. \n\nThe data from the data files (e.g., JSON, YAML, TOML) are then merged starting from the first data file in the command. \nThen it will be used for the template string from the template files and print it out to `stdout`. \n\nIf you want to store it in a file, you can simply use the `-o`/`--output` option with the location of the output file. \nOr simply redirect the `stdout` stream to the output file. \n\n[source, shell]\n----\nhantemcli TEMPLATE_FILE -- DATA_FILES... \u003e output.txt\n----\n\nAside from data files, you can also render a template with environment variables. \n\nGiven the simple Handlebars template stored in a file named `base.hbs`. \n\n[source, handlebars]\n----\nThe logger level is set at {{ logger_lvl }}.\n\n{{~# if debug ~}}\nDebug mode is on.\n{{~/ if ~}}\n----\n\nAnd execute the shell with the following command. \n\n[source, shell]\n----\nLOGGER_LVL=\"debug\" DEBUG=1 hantemcli base.hbs\n----\n\nWill result in the following string. \n\n[source]\n----\nThe logger level is set at debug.\n\nDebug mode is on.\n----\n\nFor detailed information about the program, you can read the link:docs/manual.adoc[manual]. \n\n\n\n\n== Building the project \n\nYou can build an executable of the program simply by cloning this repo (`git clone GIT_REPO_LINK`), setting the current directory to the cloned repo, and running `cargo build --release`. \n\n\n\n\n== Conventions \n\n{program} has some conventions that strictly enforces. \n\nFirst, it only accepts files with certain file extensions. \nThe default file extension to be searched is `.hbs`. \nThis can be configured by the user with the `--extension`/`-e` option. \nThis is to make using {program} a bit easier by narrowing the files to be searched. \n\n{program} also makes use of a template registry that stores the content of the files. \n\nDue to the (intended future) support for other data formats (looking at https://dhall-lang.org/[Dhall] for example) and its bias for the https://github.com/toml-lang/toml[TOML format], Hantemcli strictly enforces the root to be a hash table/object. \nTop-level lists/arrays and primitives are not allowed. \n\n\n\n\n== Dependencies \n\n* https://crates.io/crates/config[config] (as well as all of the library implementations of the TOML, JSON, HJSON, INI, and YAML)\n* https://crates.io/crates/handlebars[Handlebars]\n* https://crates.io/crates/structopt[structopt] (on top of https://crates.io/crates/clap[clap])\n* https://crates.io/crates/toml[toml]\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo-dogsquared%2Fhantemcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoo-dogsquared%2Fhantemcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo-dogsquared%2Fhantemcli/lists"}