{"id":16278596,"url":"https://github.com/sigoden/xf","last_synced_at":"2025-08-03T03:32:33.075Z","repository":{"id":43177851,"uuid":"463117913","full_name":"sigoden/xf","owner":"sigoden","description":"File-aware dynamic command runner.","archived":false,"fork":false,"pushed_at":"2022-03-15T07:03:12.000Z","size":50,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-27T21:38:31.626Z","etag":null,"topics":["command-line","command-runner","dynamic-aliases","dynamic-commands","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sigoden.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-24T11:13:18.000Z","updated_at":"2024-05-18T14:50:19.000Z","dependencies_parsed_at":"2022-08-31T05:40:10.873Z","dependency_job_id":null,"html_url":"https://github.com/sigoden/xf","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigoden%2Fxf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigoden%2Fxf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigoden%2Fxf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigoden%2Fxf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sigoden","download_url":"https://codeload.github.com/sigoden/xf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228520981,"owners_count":17932663,"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":["command-line","command-runner","dynamic-aliases","dynamic-commands","rust"],"created_at":"2024-10-10T18:59:06.614Z","updated_at":"2024-12-06T20:17:18.681Z","avatar_url":"https://github.com/sigoden.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xf\n\n[![CI](https://github.com/sigoden/xf/actions/workflows/ci.yaml/badge.svg)](https://github.com/sigoden/xf/actions/workflows/ci.yaml)\n[![Crates](https://img.shields.io/crates/v/xf.svg)](https://crates.io/crates/xf)\n\nFile-aware dynamic command runner.\n\nXf try to find a file from the current directory and upwards, and execute different command according to the different file found.\n\n ## Install\n\n### With cargo\n\n```\ncargo install xf\n```\n\n### Binaries on macOS, Linux, Windows\n\nDownload from [Github Releases](https://github.com/sigoden/xf/releases), unzip and add xf to your $PATH.\n## Usage\n\nXf loads rules from configuration file.\n\n\u003e The default path of configuration file is `$HOME/.xf`, which can be specified with the `XF_CONFIG_PATH` environment variable.\n\nRule format is:\n\n```\n\u003cfile\u003e: \u003ccommand\u003e\n```\n\n`\u003cfile\u003e` tell `xf` what file to find, `\u003ccommand\u003e` tell `xf` what command to execute if found.\n\n\u003e `xf` has a built-in lowest priority rule: `Xfile: $file $@`\n\n\nConfigure the following rules:\n\n```\nTaskfile: bash $file $@\n```\n\nRun `xf foo`.\n\n`xf` try to find for `Taskfile` file in the current directory, and if found, execute `bash $file foo` .\n\nIf not found, continue finding for `Xfile` file in the current directory, if found, execute `Xfile foo` (built-in rule).\n\nIf not found, enter the parent directory to continue this process.\n \nFile matching rules:\n\n1. Ignore case. `Xfile` can match files `xfile`, `xFile`.\n\n2. Find the filename that contains the rule filename. `Xfile` can match the files `Xfile.sh`, `Xfile.cmd`.\n\n## Variables\n\nThe following built-in variables can be used in the command part of rule.\n\n- `$@` - pass-through command line parameters\n- `$file` - file path\n- `$fileDir` - file directory, process's cwd will be set to this value\n- `$currentDir` - the current directory\n\nThese variables(exclude `$@`) are also synced to environment variables:\n\n- `$file` =\u003e `XF_FILE`\n- `$fileDir` =\u003e `XF_FILE_DIR`\n- `$currentDir` =\u003e `XF_CURRENT_DIR`\n\n## Command Name\n\nActually, the command name affect builtin-rule and environment variable prefix.\n\nIf you rename executable file `xf`  to `task`:\n\n1. The built-in rule will be `Taskfile: $file $@`\n\n2. The default configuration file path will be `$HOME/.task`.\n\n3. The environment variable `XF_CONFIG_PATH` will be `TASK_CONFIG_PATH`.\n\n4. The environment variable for `$file` will be `TASK_FILE`。\n\n## License\n\nCopyright (c) 2022 xf-developers.\n\nargc is made available under the terms of either the MIT License or the Apache License 2.0, at your option.\n\nSee the LICENSE-APACHE and LICENSE-MIT files for license details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigoden%2Fxf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigoden%2Fxf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigoden%2Fxf/lists"}