├── .gitignore ├── .editorconfig ├── typos.toml ├── rust-toolchain.toml ├── .cargo └── config.toml ├── rustfmt.toml ├── template ├── src │ └── lib.rs └── Cargo.toml ├── licenserc.toml ├── xtask ├── Cargo.toml └── src │ └── main.rs ├── Cargo.toml ├── .github ├── semantic.yml └── workflows │ └── ci.yml ├── README.md ├── taplo.toml ├── rename-project.sh ├── rename-project.ps1 ├── Cargo.lock └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | indent_style = space 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | 9 | [*.toml] 10 | indent_size = tab 11 | tab_width = 2 12 | -------------------------------------------------------------------------------- /typos.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [default.extend-words] 16 | 17 | [files] 18 | extend-exclude = [] 19 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [toolchain] 16 | channel = "stable" 17 | components = ["cargo", "rustfmt", "clippy", "rust-analyzer"] 18 | -------------------------------------------------------------------------------- /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [alias] 16 | x = "run --package x --" 17 | 18 | [env] 19 | CARGO_WORKSPACE_DIR = { value = "", relative = true } 20 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | comment_width = 120 16 | format_code_in_doc_comments = true 17 | group_imports = "StdExternalCrate" 18 | imports_granularity = "Item" 19 | wrap_comments = true 20 | -------------------------------------------------------------------------------- /template/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 FastLabs Developers 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! A template library. 16 | 17 | #![cfg_attr(docsrs, feature(doc_cfg))] 18 | 19 | /// A placeholder function. 20 | pub fn hello() { 21 | println!("Hello, world!"); 22 | } 23 | -------------------------------------------------------------------------------- /licenserc.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | headerPath = "Apache-2.0.txt" 16 | 17 | includes = ['**/*.proto', '**/*.rs', '**/*.yml', '**/*.yaml', '**/*.toml'] 18 | 19 | [properties] 20 | copyrightOwner = "FastLabs Developers" 21 | inceptionYear = 2025 22 | -------------------------------------------------------------------------------- /template/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | name = "template" 17 | version = "0.1.0" 18 | 19 | edition.workspace = true 20 | homepage.workspace = true 21 | license.workspace = true 22 | readme.workspace = true 23 | repository.workspace = true 24 | rust-version.workspace = true 25 | 26 | [dependencies] 27 | 28 | [lints] 29 | workspace = true 30 | -------------------------------------------------------------------------------- /xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | name = "x" 17 | publish = false 18 | 19 | edition.workspace = true 20 | homepage.workspace = true 21 | license.workspace = true 22 | readme.workspace = true 23 | repository.workspace = true 24 | rust-version.workspace = true 25 | 26 | [package.metadata.release] 27 | release = false 28 | 29 | [dependencies] 30 | clap = { version = "4.5.49", features = ["derive"] } 31 | which = { version = "8.0.0" } 32 | 33 | [lints] 34 | workspace = true 35 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [workspace] 16 | members = ["template", "xtask"] 17 | resolver = "3" 18 | 19 | [workspace.package] 20 | edition = "2024" 21 | homepage = "https://github.com/fast/template" 22 | license = "Apache-2.0" 23 | readme = "README.md" 24 | repository = "https://github.com/fast/template" 25 | rust-version = "1.85.0" 26 | 27 | [workspace.lints.rust] 28 | missing_docs = "deny" 29 | unknown_lints = "deny" 30 | unused_must_use = "deny" 31 | 32 | [workspace.lints.clippy] 33 | dbg_macro = "deny" 34 | 35 | [workspace.metadata.release] 36 | pre-release-commit-message = "chore: release v{{version}}" 37 | shared-version = true 38 | sign-tag = true 39 | tag-name = "v{{version}}" 40 | -------------------------------------------------------------------------------- /.github/semantic.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # The pull request's title should be fulfilled the following pattern: 16 | # 17 | # [optional scope]: 18 | # 19 | # ... where valid types and scopes can be found below; for example: 20 | # 21 | # build(maven): One level down for native profile 22 | # 23 | # More about configurations on https://github.com/Ezard/semantic-prs#configuration 24 | 25 | enabled: true 26 | 27 | titleOnly: true 28 | 29 | types: 30 | - feat 31 | - fix 32 | - docs 33 | - style 34 | - refactor 35 | - perf 36 | - test 37 | - build 38 | - ci 39 | - chore 40 | - revert 41 | 42 | targetUrl: https://github.com/fast/template/blob/main/.github/semantic.yml 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fast template for developing a new Rust project 2 | 3 | [![Crates.io][crates-badge]][crates-url] 4 | [![Documentation][docs-badge]][docs-url] 5 | [![MSRV 1.85][msrv-badge]](https://www.whatrustisit.com) 6 | [![Apache 2.0 licensed][license-badge]][license-url] 7 | [![Build Status][actions-badge]][actions-url] 8 | 9 | [crates-badge]: https://img.shields.io/crates/v/template.svg 10 | [crates-url]: https://crates.io/crates/template 11 | [docs-badge]: https://docs.rs/template/badge.svg 12 | [msrv-badge]: https://img.shields.io/badge/MSRV-1.85-green?logo=rust 13 | [docs-url]: https://docs.rs/template 14 | [license-badge]: https://img.shields.io/crates/l/template 15 | [license-url]: LICENSE 16 | [actions-badge]: https://github.com/fast/template/workflows/CI/badge.svg 17 | [actions-url]:https://github.com/fast/template/actions?query=workflow%3ACI 18 | 19 | Use this repository as a GitHub template to quickly start a new Rust project. 20 | 21 | ## Getting Started 22 | 23 | 1. Create a new repository using this template 24 | 2. Clone your repository and run the rename script: 25 | - **Linux/macOS:** `./rename-project.sh` 26 | - **Windows:** `.\rename-project.ps1` 27 | 3. Follow the prompts, review changes, and commit 28 | 4. Start building your project! 29 | 30 | ## Minimum Rust version policy 31 | 32 | This crate is built against the latest stable release, and its minimum supported rustc version is 1.85.0. 33 | 34 | The policy is that the minimum Rust version required to use this crate can be increased in minor version updates. For example, if Template 1.0 requires Rust 1.60.0, then Template 1.0.z for all values of z will also require Rust 1.60.0 or newer. However, Template 1.y for y > 0 may require a newer minimum version of Rust. 35 | 36 | ## License 37 | 38 | This project is licensed under [Apache License, Version 2.0](LICENSE). 39 | -------------------------------------------------------------------------------- /taplo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include = ["Cargo.toml", "**/*.toml"] 16 | 17 | [formatting] 18 | # Align consecutive entries vertically. 19 | align_entries = false 20 | # Append trailing commas for multi-line arrays. 21 | array_trailing_comma = true 22 | # Expand arrays to multiple lines that exceed the maximum column width. 23 | array_auto_expand = true 24 | # Collapse arrays that don't exceed the maximum column width and don't contain comments. 25 | array_auto_collapse = true 26 | # Omit white space padding from single-line arrays 27 | compact_arrays = true 28 | # Omit white space padding from the start and end of inline tables. 29 | compact_inline_tables = false 30 | # Maximum column width in characters, affects array expansion and collapse, this doesn't take whitespace into account. 31 | # Note that this is not set in stone, and works on a best-effort basis. 32 | column_width = 80 33 | # Indent based on tables and arrays of tables and their subtables, subtables out of order are not indented. 34 | indent_tables = false 35 | # The substring that is used for indentation, should be tabs or spaces (but technically can be anything). 36 | indent_string = ' ' 37 | # Add trailing newline at the end of the file if not present. 38 | trailing_newline = true 39 | # Alphabetically reorder keys that are not separated by empty lines. 40 | reorder_keys = true 41 | # Maximum amount of allowed consecutive blank lines. This does not affect the whitespace at the end of the document, as it is always stripped. 42 | allowed_blank_lines = 1 43 | # Use CRLF for line endings. 44 | crlf = false 45 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: CI 16 | on: 17 | pull_request: 18 | branches: [ main ] 19 | push: 20 | branches: [ main ] 21 | 22 | # Concurrency strategy: 23 | # github.workflow: distinguish this workflow from others 24 | # github.event_name: distinguish `push` event from `pull_request` event 25 | # github.event.number: set to the number of the pull request if `pull_request` event 26 | # github.run_id: otherwise, it's a `push` event, only cancel if we rerun the workflow 27 | # 28 | # Reference: 29 | # https://docs.github.com/en/actions/using-jobs/using-concurrency 30 | # https://docs.github.com/en/actions/learn-github-actions/contexts#github-context 31 | concurrency: 32 | group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.number || github.run_id }} 33 | cancel-in-progress: true 34 | 35 | jobs: 36 | check: 37 | name: Check 38 | runs-on: ubuntu-22.04 39 | steps: 40 | - uses: actions/checkout@v4 41 | - name: Install toolchain 42 | uses: dtolnay/rust-toolchain@nightly 43 | with: 44 | components: rustfmt,clippy 45 | - uses: Swatinem/rust-cache@v2 46 | - uses: taiki-e/install-action@v2 47 | with: 48 | tool: typos-cli,taplo-cli,hawkeye 49 | - run: cargo +nightly x lint 50 | 51 | test: 52 | name: Run tests 53 | strategy: 54 | matrix: 55 | os: [ ubuntu-24.04, macos-14, windows-2022 ] 56 | rust-version: [ "1.85.0", "stable" ] 57 | runs-on: ${{ matrix.os }} 58 | steps: 59 | - uses: actions/checkout@v5 60 | - uses: Swatinem/rust-cache@v2 61 | - name: Delete rust-toolchain.toml 62 | run: rm rust-toolchain.toml 63 | - name: Install toolchain 64 | uses: dtolnay/rust-toolchain@master 65 | with: 66 | toolchain: ${{ matrix.rust-version }} 67 | - name: Run unit tests 68 | run: cargo x test --no-capture 69 | shell: bash 70 | 71 | required: 72 | name: Required 73 | runs-on: ubuntu-24.04 74 | if: ${{ always() }} 75 | needs: 76 | - check 77 | - test 78 | steps: 79 | - name: Guardian 80 | run: | 81 | if [[ ! ( \ 82 | "${{ needs.check.result }}" == "success" \ 83 | && "${{ needs.test.result }}" == "success" \ 84 | ) ]]; then 85 | echo "Required jobs haven't been completed successfully." 86 | exit -1 87 | fi 88 | -------------------------------------------------------------------------------- /rename-project.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2025 FastLabs Developers 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -euo pipefail 17 | 18 | # Colors for output 19 | RED='\033[0;31m' 20 | GREEN='\033[0;32m' 21 | YELLOW='\033[1;33m' 22 | BLUE='\033[0;34m' 23 | NC='\033[0m' # No Color 24 | 25 | echo -e "${BLUE}========================================${NC}" 26 | echo -e "${BLUE} Template Project Batch Renamer ${NC}" 27 | echo -e "${BLUE}========================================${NC}" 28 | echo "" 29 | 30 | if [[ ! -f "Cargo.toml" ]] || [[ ! -d "template" ]]; then 31 | echo -e "${RED}ERROR: This script must be run from the project root directory${NC}" 32 | exit 1 33 | fi 34 | 35 | echo -e "${YELLOW}Please provide the following information:${NC}" 36 | echo "" 37 | 38 | read -p "New project name (e.g., my-awesome-project): " PROJECT_NAME 39 | read -p "GitHub username/org (e.g., myname): " GITHUB_USER 40 | 41 | if [[ -z "$PROJECT_NAME" ]]; then 42 | echo -e "${RED}ERROR: Project name is required${NC}" 43 | exit 1 44 | fi 45 | 46 | if [[ -z "$GITHUB_USER" ]]; then 47 | echo -e "${RED}ERROR: GitHub username is required${NC}" 48 | exit 1 49 | fi 50 | 51 | # Validate project name format (Rust package naming convention) 52 | if [[ ! "$PROJECT_NAME" =~ ^[a-z][a-z0-9_-]*$ ]]; then 53 | echo -e "${RED}ERROR: Project name must start with a lowercase letter and contain only lowercase letters, numbers, hyphens, and underscores${NC}" 54 | exit 1 55 | fi 56 | 57 | echo "" 58 | echo -e "${BLUE}Summary:${NC}" 59 | echo -e " Project name: ${GREEN}$PROJECT_NAME${NC}" 60 | echo -e " GitHub repo: ${GREEN}$GITHUB_USER/$PROJECT_NAME${NC}" 61 | echo -e " Crates.io URL: ${GREEN}https://crates.io/crates/$PROJECT_NAME${NC}" 62 | echo "" 63 | read -p "Continue with renaming? (y/N): " CONFIRM 64 | 65 | CONFIRM_LOWER=$(echo "$CONFIRM" | tr '[:upper:]' '[:lower:]') 66 | 67 | if [[ "$CONFIRM_LOWER" != "y" ]] && [[ "$CONFIRM_LOWER" != "yes" ]]; then 68 | echo -e "${YELLOW}Cancelled.${NC}" 69 | exit 0 70 | fi 71 | 72 | echo "" 73 | echo -e "${BLUE}Starting batch rename...${NC}" 74 | echo "" 75 | 76 | update_file() { 77 | local file=$1 78 | local old=$2 79 | local new=$3 80 | 81 | if [[ "$OSTYPE" == "darwin"* ]]; then 82 | # macOS 83 | sed -i '' "s|$old|$new|g" "$file" 84 | else 85 | # Linux 86 | sed -i "s|$old|$new|g" "$file" 87 | fi 88 | } 89 | 90 | # 1. Update root Cargo.toml 91 | echo -e "${GREEN}[OK]${NC} Updating Cargo.toml..." 92 | update_file "Cargo.toml" "https://github.com/fast/template" "https://github.com/$GITHUB_USER/$PROJECT_NAME" 93 | update_file "Cargo.toml" '"template"' "\"$PROJECT_NAME\"" 94 | 95 | # 2. Update template/Cargo.toml 96 | echo -e "${GREEN}[OK]${NC} Updating template/Cargo.toml..." 97 | update_file "template/Cargo.toml" 'name = "template"' "name = \"$PROJECT_NAME\"" 98 | 99 | # 3. Update README.md 100 | echo -e "${GREEN}[OK]${NC} Updating README.md..." 101 | update_file "README.md" "crates.io/crates/template" "crates.io/crates/$PROJECT_NAME" 102 | update_file "README.md" "img.shields.io/crates/v/template.svg" "img.shields.io/crates/v/$PROJECT_NAME.svg" 103 | update_file "README.md" "img.shields.io/crates/l/template" "img.shields.io/crates/l/$PROJECT_NAME" 104 | update_file "README.md" "github.com/fast/template" "github.com/$GITHUB_USER/$PROJECT_NAME" 105 | update_file "README.md" "docs.rs/template" "docs.rs/$PROJECT_NAME" 106 | 107 | # 4. Update .github/semantic.yml 108 | echo -e "${GREEN}[OK]${NC} Updating .github/semantic.yml..." 109 | update_file ".github/semantic.yml" "github.com/fast/template" "github.com/$GITHUB_USER/$PROJECT_NAME" 110 | 111 | # 5. Rename template directory 112 | echo -e "${GREEN}[OK]${NC} Renaming template/ directory to $PROJECT_NAME/..." 113 | if [[ -d "template" ]]; then 114 | mv template "$PROJECT_NAME" 115 | fi 116 | 117 | # 6. Update Cargo.lock 118 | echo -e "${GREEN}[OK]${NC} Updating Cargo.lock..." 119 | update_file "Cargo.lock" 'name = "template"' "name = \"$PROJECT_NAME\"" 120 | 121 | echo "" 122 | echo -e "${GREEN}========================================${NC}" 123 | echo -e "${GREEN} SUCCESS: Renaming completed! ${NC}" 124 | echo -e "${GREEN}========================================${NC}" 125 | echo "" 126 | echo -e "${BLUE}Next steps:${NC}" 127 | echo "" 128 | echo -e " 1. Review the changes:" 129 | echo -e " ${YELLOW}git diff${NC}" 130 | echo "" 131 | echo -e " 2. Delete the rename scripts (no longer needed):" 132 | echo -e " ${YELLOW}rm rename-project.sh rename-project.ps1${NC}" 133 | echo "" 134 | echo -e " 3. Update the project description in README.md" 135 | echo "" 136 | echo -e " 4. Commit your changes:" 137 | echo -e " ${YELLOW}git add .${NC}" 138 | echo -e " ${YELLOW}git commit -m \"chore: initialize project as $PROJECT_NAME\"${NC}" 139 | echo "" 140 | echo -e " 5. Push to GitHub:" 141 | echo -e " ${YELLOW}git push${NC}" 142 | echo "" 143 | echo -e "${GREEN}Happy coding!${NC}" 144 | 145 | -------------------------------------------------------------------------------- /xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 FastLabs Developers 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! An xtask binary for managing workspace tasks. 16 | 17 | use std::process::Command as StdCommand; 18 | 19 | use clap::Parser; 20 | use clap::Subcommand; 21 | 22 | #[derive(Parser)] 23 | struct Command { 24 | #[clap(subcommand)] 25 | sub: SubCommand, 26 | } 27 | 28 | impl Command { 29 | fn run(self) { 30 | match self.sub { 31 | SubCommand::Build(cmd) => cmd.run(), 32 | SubCommand::Lint(cmd) => cmd.run(), 33 | SubCommand::Test(cmd) => cmd.run(), 34 | } 35 | } 36 | } 37 | 38 | #[derive(Subcommand)] 39 | enum SubCommand { 40 | #[clap(about = "Compile workspace packages.")] 41 | Build(CommandBuild), 42 | #[clap(about = "Run format and clippy checks.")] 43 | Lint(CommandLint), 44 | #[clap(about = "Run unit tests.")] 45 | Test(CommandTest), 46 | } 47 | 48 | #[derive(Parser)] 49 | struct CommandBuild { 50 | #[arg(long, help = "Assert that `Cargo.lock` will remain unchanged.")] 51 | locked: bool, 52 | } 53 | 54 | impl CommandBuild { 55 | fn run(self) { 56 | run_command(make_build_cmd(self.locked)); 57 | } 58 | } 59 | 60 | #[derive(Parser)] 61 | struct CommandTest { 62 | #[arg(long, help = "Run tests serially and do not capture output.")] 63 | no_capture: bool, 64 | } 65 | 66 | impl CommandTest { 67 | fn run(self) { 68 | run_command(make_test_cmd(self.no_capture, true, &[])); 69 | } 70 | } 71 | 72 | #[derive(Parser)] 73 | #[clap(name = "lint")] 74 | struct CommandLint { 75 | #[arg(long, help = "Automatically apply lint suggestions.")] 76 | fix: bool, 77 | } 78 | 79 | impl CommandLint { 80 | fn run(self) { 81 | run_command(make_clippy_cmd(self.fix)); 82 | run_command(make_format_cmd(self.fix)); 83 | run_command(make_taplo_cmd(self.fix)); 84 | run_command(make_typos_cmd()); 85 | run_command(make_hawkeye_cmd(self.fix)); 86 | } 87 | } 88 | 89 | fn find_command(cmd: &str) -> StdCommand { 90 | match which::which(cmd) { 91 | Ok(exe) => { 92 | let mut cmd = StdCommand::new(exe); 93 | cmd.current_dir(env!("CARGO_WORKSPACE_DIR")); 94 | cmd 95 | } 96 | Err(err) => { 97 | panic!("{cmd} not found: {err}"); 98 | } 99 | } 100 | } 101 | 102 | fn ensure_installed(bin: &str, crate_name: &str) { 103 | if which::which(bin).is_err() { 104 | let mut cmd = find_command("cargo"); 105 | cmd.args(["install", crate_name]); 106 | run_command(cmd); 107 | } 108 | } 109 | 110 | fn run_command(mut cmd: StdCommand) { 111 | println!("{cmd:?}"); 112 | let status = cmd.status().expect("failed to execute process"); 113 | assert!(status.success(), "command failed: {status}"); 114 | } 115 | 116 | fn make_build_cmd(locked: bool) -> StdCommand { 117 | let mut cmd = find_command("cargo"); 118 | cmd.args([ 119 | "build", 120 | "--workspace", 121 | "--all-features", 122 | "--tests", 123 | "--examples", 124 | "--benches", 125 | "--bins", 126 | ]); 127 | if locked { 128 | cmd.arg("--locked"); 129 | } 130 | cmd 131 | } 132 | 133 | fn make_test_cmd(no_capture: bool, default_features: bool, features: &[&str]) -> StdCommand { 134 | let mut cmd = find_command("cargo"); 135 | cmd.args(["test", "--workspace"]); 136 | if !default_features { 137 | cmd.arg("--no-default-features"); 138 | } 139 | if !features.is_empty() { 140 | cmd.args(["--features", features.join(",").as_str()]); 141 | } 142 | if no_capture { 143 | cmd.args(["--", "--nocapture"]); 144 | } 145 | cmd 146 | } 147 | 148 | fn make_format_cmd(fix: bool) -> StdCommand { 149 | let mut cmd = find_command("cargo"); 150 | cmd.args(["fmt", "--all"]); 151 | if !fix { 152 | cmd.arg("--check"); 153 | } 154 | cmd 155 | } 156 | 157 | fn make_clippy_cmd(fix: bool) -> StdCommand { 158 | let mut cmd = find_command("cargo"); 159 | cmd.args([ 160 | "clippy", 161 | "--tests", 162 | "--all-features", 163 | "--all-targets", 164 | "--workspace", 165 | ]); 166 | if fix { 167 | cmd.args(["--allow-staged", "--allow-dirty", "--fix"]); 168 | } else { 169 | cmd.args(["--", "-D", "warnings"]); 170 | } 171 | cmd 172 | } 173 | 174 | fn make_hawkeye_cmd(fix: bool) -> StdCommand { 175 | ensure_installed("hawkeye", "hawkeye"); 176 | let mut cmd = find_command("hawkeye"); 177 | if fix { 178 | cmd.args(["format", "--fail-if-updated=false"]); 179 | } else { 180 | cmd.args(["check"]); 181 | } 182 | cmd 183 | } 184 | 185 | fn make_typos_cmd() -> StdCommand { 186 | ensure_installed("typos", "typos-cli"); 187 | find_command("typos") 188 | } 189 | 190 | fn make_taplo_cmd(fix: bool) -> StdCommand { 191 | ensure_installed("taplo", "taplo-cli"); 192 | let mut cmd = find_command("taplo"); 193 | if fix { 194 | cmd.args(["format"]); 195 | } else { 196 | cmd.args(["format", "--check"]); 197 | } 198 | cmd 199 | } 200 | 201 | fn main() { 202 | let cmd = Command::parse(); 203 | cmd.run() 204 | } 205 | -------------------------------------------------------------------------------- /rename-project.ps1: -------------------------------------------------------------------------------- 1 | # Copyright 2025 FastLabs Developers 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | $ErrorActionPreference = "Stop" 16 | 17 | Write-Host "========================================" -ForegroundColor Blue 18 | Write-Host " Template Project Batch Renamer " -ForegroundColor Blue 19 | Write-Host "========================================" -ForegroundColor Blue 20 | Write-Host "" 21 | 22 | if (-not (Test-Path "Cargo.toml") -or -not (Test-Path "template" -PathType Container)) { 23 | Write-Host "ERROR: This script must be run from the project root directory" -ForegroundColor Red 24 | exit 1 25 | } 26 | 27 | Write-Host "Please provide the following information:" -ForegroundColor Yellow 28 | Write-Host "" 29 | 30 | $ProjectName = Read-Host "New project name (e.g., my-awesome-project)" 31 | $GitHubUser = Read-Host "GitHub username/org (e.g., myname)" 32 | 33 | if ([string]::IsNullOrWhiteSpace($ProjectName)) { 34 | Write-Host "ERROR: Project name is required" -ForegroundColor Red 35 | exit 1 36 | } 37 | 38 | if ([string]::IsNullOrWhiteSpace($GitHubUser)) { 39 | Write-Host "ERROR: GitHub username is required" -ForegroundColor Red 40 | exit 1 41 | } 42 | 43 | # Validate project name format (Rust package naming convention) 44 | if ($ProjectName -notmatch '^[a-z][a-z0-9_-]*$') { 45 | Write-Host "ERROR: Project name must start with a lowercase letter and contain only lowercase letters, numbers, hyphens, and underscores" -ForegroundColor Red 46 | exit 1 47 | } 48 | 49 | Write-Host "" 50 | Write-Host "Summary:" -ForegroundColor Blue 51 | Write-Host " Project name: $ProjectName" -ForegroundColor Green 52 | Write-Host " GitHub repo: $GitHubUser/$ProjectName" -ForegroundColor Green 53 | Write-Host " Crates.io URL: https://crates.io/crates/$ProjectName" -ForegroundColor Green 54 | Write-Host "" 55 | 56 | $Confirm = Read-Host "Continue with renaming? (y/N)" 57 | $ConfirmLower = $Confirm.ToLower() 58 | if ($ConfirmLower -ne "y" -and $ConfirmLower -ne "yes") { 59 | Write-Host "Cancelled." -ForegroundColor Yellow 60 | exit 0 61 | } 62 | 63 | Write-Host "" 64 | Write-Host "Starting batch rename..." -ForegroundColor Blue 65 | Write-Host "" 66 | 67 | function Update-FileContent { 68 | param( 69 | [string]$FilePath, 70 | [string]$OldValue, 71 | [string]$NewValue 72 | ) 73 | 74 | $content = Get-Content $FilePath -Raw 75 | $content = $content -replace [regex]::Escape($OldValue), $NewValue 76 | Set-Content $FilePath -Value $content -NoNewline 77 | } 78 | 79 | # 1. Update root Cargo.toml 80 | Write-Host "[OK] Updating Cargo.toml..." -ForegroundColor Green 81 | Update-FileContent "Cargo.toml" "https://github.com/fast/template" "https://github.com/$GitHubUser/$ProjectName" 82 | Update-FileContent "Cargo.toml" '"template"' "`"$ProjectName`"" 83 | 84 | # 2. Update template/Cargo.toml 85 | Write-Host "[OK] Updating template/Cargo.toml..." -ForegroundColor Green 86 | Update-FileContent "template/Cargo.toml" 'name = "template"' "name = `"$ProjectName`"" 87 | 88 | # 3. Update README.md 89 | Write-Host "[OK] Updating README.md..." -ForegroundColor Green 90 | Update-FileContent "README.md" "crates.io/crates/template" "crates.io/crates/$ProjectName" 91 | Update-FileContent "README.md" "img.shields.io/crates/v/template.svg" "img.shields.io/crates/v/$ProjectName.svg" 92 | Update-FileContent "README.md" "img.shields.io/crates/l/template" "img.shields.io/crates/l/$ProjectName" 93 | Update-FileContent "README.md" "github.com/fast/template" "github.com/$GitHubUser/$ProjectName" 94 | Update-FileContent "README.md" "docs.rs/template" "docs.rs/$ProjectName" 95 | 96 | # 4. Update .github/semantic.yml 97 | Write-Host "[OK] Updating .github/semantic.yml..." -ForegroundColor Green 98 | Update-FileContent ".github/semantic.yml" "github.com/fast/template" "github.com/$GitHubUser/$ProjectName" 99 | 100 | # 5. Rename template directory 101 | Write-Host "[OK] Renaming template/ directory to $ProjectName/..." -ForegroundColor Green 102 | if (Test-Path "template" -PathType Container) { 103 | Rename-Item "template" $ProjectName 104 | } 105 | 106 | # 6. Update Cargo.lock 107 | Write-Host "[OK] Updating Cargo.lock..." -ForegroundColor Green 108 | Update-FileContent "Cargo.lock" 'name = "template"' "name = `"$ProjectName`"" 109 | 110 | Write-Host "" 111 | Write-Host "========================================" -ForegroundColor Green 112 | Write-Host " SUCCESS: Renaming completed! " -ForegroundColor Green 113 | Write-Host "========================================" -ForegroundColor Green 114 | Write-Host "" 115 | Write-Host "Next steps:" -ForegroundColor Blue 116 | Write-Host "" 117 | Write-Host " 1. Review the changes:" 118 | Write-Host " git diff" -ForegroundColor Yellow 119 | Write-Host "" 120 | Write-Host " 2. Delete the rename scripts (no longer needed):" 121 | Write-Host " Remove-Item rename-project.sh, rename-project.ps1" -ForegroundColor Yellow 122 | Write-Host "" 123 | Write-Host " 3. Update the project description in README.md" 124 | Write-Host "" 125 | Write-Host " 4. Commit your changes:" 126 | Write-Host " git add ." -ForegroundColor Yellow 127 | Write-Host " git commit -m `"chore: initialize project as $ProjectName`"" -ForegroundColor Yellow 128 | Write-Host "" 129 | Write-Host " 5. Push to GitHub:" 130 | Write-Host " git push" -ForegroundColor Yellow 131 | Write-Host "" 132 | Write-Host "Happy coding!" -ForegroundColor Green 133 | 134 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 4 4 | 5 | [[package]] 6 | name = "anstream" 7 | version = "0.6.21" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" 10 | dependencies = [ 11 | "anstyle", 12 | "anstyle-parse", 13 | "anstyle-query", 14 | "anstyle-wincon", 15 | "colorchoice", 16 | "is_terminal_polyfill", 17 | "utf8parse", 18 | ] 19 | 20 | [[package]] 21 | name = "anstyle" 22 | version = "1.0.13" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" 25 | 26 | [[package]] 27 | name = "anstyle-parse" 28 | version = "0.2.7" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" 31 | dependencies = [ 32 | "utf8parse", 33 | ] 34 | 35 | [[package]] 36 | name = "anstyle-query" 37 | version = "1.1.5" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" 40 | dependencies = [ 41 | "windows-sys", 42 | ] 43 | 44 | [[package]] 45 | name = "anstyle-wincon" 46 | version = "3.0.11" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" 49 | dependencies = [ 50 | "anstyle", 51 | "once_cell_polyfill", 52 | "windows-sys", 53 | ] 54 | 55 | [[package]] 56 | name = "bitflags" 57 | version = "2.10.0" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" 60 | 61 | [[package]] 62 | name = "clap" 63 | version = "4.5.53" 64 | source = "registry+https://github.com/rust-lang/crates.io-index" 65 | checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" 66 | dependencies = [ 67 | "clap_builder", 68 | "clap_derive", 69 | ] 70 | 71 | [[package]] 72 | name = "clap_builder" 73 | version = "4.5.53" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" 76 | dependencies = [ 77 | "anstream", 78 | "anstyle", 79 | "clap_lex", 80 | "strsim", 81 | ] 82 | 83 | [[package]] 84 | name = "clap_derive" 85 | version = "4.5.49" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" 88 | dependencies = [ 89 | "heck", 90 | "proc-macro2", 91 | "quote", 92 | "syn", 93 | ] 94 | 95 | [[package]] 96 | name = "clap_lex" 97 | version = "0.7.6" 98 | source = "registry+https://github.com/rust-lang/crates.io-index" 99 | checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" 100 | 101 | [[package]] 102 | name = "colorchoice" 103 | version = "1.0.4" 104 | source = "registry+https://github.com/rust-lang/crates.io-index" 105 | checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" 106 | 107 | [[package]] 108 | name = "env_home" 109 | version = "0.1.0" 110 | source = "registry+https://github.com/rust-lang/crates.io-index" 111 | checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" 112 | 113 | [[package]] 114 | name = "errno" 115 | version = "0.3.14" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" 118 | dependencies = [ 119 | "libc", 120 | "windows-sys", 121 | ] 122 | 123 | [[package]] 124 | name = "heck" 125 | version = "0.5.0" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 128 | 129 | [[package]] 130 | name = "is_terminal_polyfill" 131 | version = "1.70.2" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" 134 | 135 | [[package]] 136 | name = "libc" 137 | version = "0.2.178" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" 140 | 141 | [[package]] 142 | name = "linux-raw-sys" 143 | version = "0.11.0" 144 | source = "registry+https://github.com/rust-lang/crates.io-index" 145 | checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" 146 | 147 | [[package]] 148 | name = "once_cell_polyfill" 149 | version = "1.70.2" 150 | source = "registry+https://github.com/rust-lang/crates.io-index" 151 | checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" 152 | 153 | [[package]] 154 | name = "proc-macro2" 155 | version = "1.0.103" 156 | source = "registry+https://github.com/rust-lang/crates.io-index" 157 | checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" 158 | dependencies = [ 159 | "unicode-ident", 160 | ] 161 | 162 | [[package]] 163 | name = "quote" 164 | version = "1.0.42" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" 167 | dependencies = [ 168 | "proc-macro2", 169 | ] 170 | 171 | [[package]] 172 | name = "rustix" 173 | version = "1.1.2" 174 | source = "registry+https://github.com/rust-lang/crates.io-index" 175 | checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" 176 | dependencies = [ 177 | "bitflags", 178 | "errno", 179 | "libc", 180 | "linux-raw-sys", 181 | "windows-sys", 182 | ] 183 | 184 | [[package]] 185 | name = "strsim" 186 | version = "0.11.1" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 189 | 190 | [[package]] 191 | name = "syn" 192 | version = "2.0.111" 193 | source = "registry+https://github.com/rust-lang/crates.io-index" 194 | checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" 195 | dependencies = [ 196 | "proc-macro2", 197 | "quote", 198 | "unicode-ident", 199 | ] 200 | 201 | [[package]] 202 | name = "template" 203 | version = "0.1.0" 204 | 205 | [[package]] 206 | name = "unicode-ident" 207 | version = "1.0.22" 208 | source = "registry+https://github.com/rust-lang/crates.io-index" 209 | checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" 210 | 211 | [[package]] 212 | name = "utf8parse" 213 | version = "0.2.2" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" 216 | 217 | [[package]] 218 | name = "which" 219 | version = "8.0.0" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "d3fabb953106c3c8eea8306e4393700d7657561cb43122571b172bbfb7c7ba1d" 222 | dependencies = [ 223 | "env_home", 224 | "rustix", 225 | "winsafe", 226 | ] 227 | 228 | [[package]] 229 | name = "windows-link" 230 | version = "0.2.1" 231 | source = "registry+https://github.com/rust-lang/crates.io-index" 232 | checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" 233 | 234 | [[package]] 235 | name = "windows-sys" 236 | version = "0.61.2" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" 239 | dependencies = [ 240 | "windows-link", 241 | ] 242 | 243 | [[package]] 244 | name = "winsafe" 245 | version = "0.0.19" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" 248 | 249 | [[package]] 250 | name = "x" 251 | version = "0.0.0" 252 | dependencies = [ 253 | "clap", 254 | "which", 255 | ] 256 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------