⭐
Log in to mark this repository.
logo and some more clippy
fde3995 · gmorell · 2026-01-18 23:02
Files changed
added
.github/workflows/rust-ci.yml
+282
−0
@@ -0,0 +1,282 @@
| 1 | +name: Rust CI and Docker Build | |
| 2 | + | |
| 3 | +on: | |
| 4 | + push: | |
| 5 | + branches: [ master ] | |
| 6 | + tags: [ 'v*' ] | |
| 7 | + pull_request: | |
| 8 | + branches: [ master ] | |
| 9 | + | |
| 10 | +env: | |
| 11 | + CARGO_TERM_COLOR: always | |
| 12 | + REGISTRY: ghcr.io | |
| 13 | + IMAGE_NAME: ${{ github.repository }} | |
| 14 | + | |
| 15 | +jobs: | |
| 16 | + build: | |
| 17 | + strategy: | |
| 18 | + matrix: | |
| 19 | + include: | |
| 20 | + - runner: ubuntu-latest | |
| 21 | + arch: x86_64 | |
| 22 | + - runner: ubuntu-24.04-arm | |
| 23 | + arch: aarch64 | |
| 24 | + runs-on: ${{ matrix.runner }} | |
| 25 | + permissions: | |
| 26 | + contents: read | |
| 27 | + packages: write | |
| 28 | + | |
| 29 | + steps: | |
| 30 | + - uses: actions/checkout@v4 | |
| 31 | + | |
| 32 | + - name: Install system dependencies (Linux) | |
| 33 | + if: runner.os == 'Linux' | |
| 34 | + run: | | |
| 35 | + if command -v apt-get &> /dev/null; then | |
| 36 | + sudo apt-get update | |
| 37 | + sudo apt-get install -y pkg-config libssl-dev libgtk-3-dev libgdk-pixbuf2.0-dev libpango1.0-dev | |
| 38 | + elif command -v yum &> /dev/null; then | |
| 39 | + sudo yum install -y pkgconfig openssl-devel gtk3-devel gdk-pixbuf-devel pango-devel | |
| 40 | + elif command -v dnf &> /dev/null; then | |
| 41 | + sudo dnf install -y pkgconfig openssl-devel | |
| 42 | + elif command -v pacman &> /dev/null; then | |
| 43 | + sudo pacman -Sy --noconfirm pkgconf openssl | |
| 44 | + elif command -v apk &> /dev/null; then | |
| 45 | + sudo apk add --no-cache pkgconfig openssl-dev | |
| 46 | + else | |
| 47 | + echo "Package manager not found. Please install pkg-config and openssl-dev manually." | |
| 48 | + exit 1 | |
| 49 | + fi | |
| 50 | + | |
| 51 | + - name: Install Rust | |
| 52 | + uses: dtolnay/rust-toolchain@stable | |
| 53 | + with: | |
| 54 | + toolchain: "1.92" | |
| 55 | + components: rustfmt, clippy | |
| 56 | + | |
| 57 | + - name: Setup Rust cache | |
| 58 | + uses: Swatinem/rust-cache@v2 | |
| 59 | + | |
| 60 | + - name: Build | |
| 61 | + run: cargo build --verbose | |
| 62 | + | |
| 63 | + - name: Run tests | |
| 64 | + run: cargo test --verbose | |
| 65 | + | |
| 66 | + - name: Check formatting | |
| 67 | + run: cargo fmt -- --check | |
| 68 | + | |
| 69 | + - name: Run clippy | |
| 70 | + run: cargo clippy -- -D warnings | |
| 71 | + | |
| 72 | + - name: Check | |
| 73 | + run: cargo check | |
| 74 | + | |
| 75 | + - name: Build release artifact | |
| 76 | + run: cargo build --release --verbose | |
| 77 | + | |
| 78 | + - name: Strip binary | |
| 79 | + run: strip target/release/koco | |
| 80 | + | |
| 81 | + - name: Install cargo-deb | |
| 82 | + run: cargo install cargo-deb | |
| 83 | + | |
| 84 | + - name: Install cargo-generate-rpm | |
| 85 | + run: cargo install cargo-generate-rpm | |
| 86 | + | |
| 87 | + - name: Build test Debian package | |
| 88 | + run: cargo deb --no-build --no-strip | |
| 89 | + | |
| 90 | + - name: Build RPM package | |
| 91 | + run: cargo generate-rpm | |
| 92 | + | |
| 93 | + - name: Upload test artifact | |
| 94 | + uses: actions/upload-artifact@v4 | |
| 95 | + with: | |
| 96 | + name: koco-test-${{ matrix.arch }}-linux | |
| 97 | + path: target/release/koco | |
| 98 | + | |
| 99 | + - name: Upload test Debian package | |
| 100 | + uses: actions/upload-artifact@v4 | |
| 101 | + with: | |
| 102 | + name: koco-test-${{ matrix.arch }}-linux.deb | |
| 103 | + path: target/debian/*.deb | |
| 104 | + | |
| 105 | + - name: Upload test RPM package | |
| 106 | + uses: actions/upload-artifact@v4 | |
| 107 | + with: | |
| 108 | + name: koco-test-${{ matrix.arch }}-linux.rpm | |
| 109 | + path: target/generate-rpm/*.rpm | |
| 110 | + | |
| 111 | + | |
| 112 | + release: | |
| 113 | + name: Release | |
| 114 | + if: startsWith(github.ref, 'refs/tags/v') | |
| 115 | + needs: build | |
| 116 | + permissions: | |
| 117 | + contents: write | |
| 118 | + packages: write | |
| 119 | + strategy: | |
| 120 | + matrix: | |
| 121 | + include: | |
| 122 | + - os: ubuntu-latest | |
| 123 | + name: koco-x86_64-linux-gnu.tar.gz | |
| 124 | + archive_cmd: tar -czf | |
| 125 | + binary_ext: "" | |
| 126 | + rust: "1.92" | |
| 127 | + - os: ubuntu-24.04-arm | |
| 128 | + name: koco-aarch64-linux-gnu.tar.gz | |
| 129 | + archive_cmd: tar -czf | |
| 130 | + binary_ext: "" | |
| 131 | + rust: "1.92" | |
| 132 | + - os: macos-latest | |
| 133 | + name: koco-aarch64-macos.tar.gz | |
| 134 | + archive_cmd: tar -czf | |
| 135 | + binary_ext: "" | |
| 136 | + rust: "1.92" | |
| 137 | + - os: windows-latest | |
| 138 | + name: koco-x86_64-windows.zip | |
| 139 | + archive_cmd: 7z a | |
| 140 | + binary_ext: ".exe" | |
| 141 | + rust: "1.92" | |
| 142 | + runs-on: ${{ matrix.os }} | |
| 143 | + | |
| 144 | + steps: | |
| 145 | + - uses: actions/checkout@v4 | |
| 146 | + | |
| 147 | + - name: Install system dependencies (self-hosted Linux) | |
| 148 | + if: runner.os == 'Linux' | |
| 149 | + run: | | |
| 150 | + if command -v apt-get &> /dev/null; then | |
| 151 | + sudo apt-get update | |
| 152 | + sudo apt-get install -y pkg-config libssl-dev libgtk-3-dev libgdk-pixbuf2.0-dev libpango1.0-dev libglib2.0-dev | |
| 153 | + elif command -v yum &> /dev/null; then | |
| 154 | + sudo yum install -y pkgconfig openssl-devel gtk3-devel gdk-pixbuf-devel pango-devel | |
| 155 | + elif command -v dnf &> /dev/null; then | |
| 156 | + sudo dnf install -y pkgconfig openssl-devel | |
| 157 | + elif command -v pacman &> /dev/null; then | |
| 158 | + sudo pacman -Sy --noconfirm pkgconf openssl | |
| 159 | + elif command -v apk &> /dev/null; then | |
| 160 | + sudo apk add --no-cache pkgconfig openssl-dev | |
| 161 | + else | |
| 162 | + echo "Package manager not found. Please install pkg-config and openssl-dev manually." | |
| 163 | + exit 1 | |
| 164 | + fi | |
| 165 | + | |
| 166 | + - name: Install Rust | |
| 167 | + uses: dtolnay/rust-toolchain@stable | |
| 168 | + with: | |
| 169 | + toolchain: ${{ matrix.rust }} | |
| 170 | + | |
| 171 | + - name: Setup Rust cache | |
| 172 | + uses: Swatinem/rust-cache@v2 | |
| 173 | + with: | |
| 174 | + key: ${{ matrix.os }}-${{ matrix.rust }} | |
| 175 | + | |
| 176 | + - name: Build release binary | |
| 177 | + run: cargo build --release --verbose | |
| 178 | + | |
| 179 | + - name: Strip binary (Unix) | |
| 180 | + if: matrix.os != 'windows-latest' | |
| 181 | + run: | | |
| 182 | + strip target/release/koco${{ matrix.binary_ext }} | |
| 183 | + | |
| 184 | + - name: Create release archive (Unix) | |
| 185 | + if: matrix.os != 'windows-latest' | |
| 186 | + run: | | |
| 187 | + cd target/release | |
| 188 | + tar -czf ../../${{ matrix.name }} koco | |
| 189 | + cd ../.. | |
| 190 | + | |
| 191 | + - name: Create release archive (Windows) | |
| 192 | + if: matrix.os == 'windows-latest' | |
| 193 | + run: | | |
| 194 | + cd target/release | |
| 195 | + 7z a ../../${{ matrix.name }} koco.exe | |
| 196 | + cd ../.. | |
| 197 | + | |
| 198 | + - name: Install cargo-deb (Linux) | |
| 199 | + if: runner.os == 'Linux' | |
| 200 | + run: cargo install cargo-deb | |
| 201 | + | |
| 202 | + - name: Build Debian package (Linux) | |
| 203 | + if: runner.os == 'Linux' | |
| 204 | + run: cargo deb --no-build --no-strip | |
| 205 | + | |
| 206 | + - name: Install cargo-generate-rpm (Linux) | |
| 207 | + if: runner.os == 'Linux' | |
| 208 | + run: cargo install cargo-generate-rpm | |
| 209 | + | |
| 210 | + - name: Build RPM package (Linux) | |
| 211 | + if: runner.os == 'Linux' | |
| 212 | + run: cargo generate-rpm | |
| 213 | + | |
| 214 | + - name: Upload release archive | |
| 215 | + uses: actions/upload-artifact@v4 | |
| 216 | + with: | |
| 217 | + name: ${{ matrix.name }} | |
| 218 | + path: ${{ matrix.name }} | |
| 219 | + | |
| 220 | + - name: Upload Debian package | |
| 221 | + if: runner.os == 'Linux' | |
| 222 | + uses: actions/upload-artifact@v4 | |
| 223 | + with: | |
| 224 | + name: koco-${{ matrix.os }}.deb | |
| 225 | + path: target/debian/*.deb | |
| 226 | + | |
| 227 | + - name: Upload RPM package | |
| 228 | + if: runner.os == 'Linux' | |
| 229 | + uses: actions/upload-artifact@v4 | |
| 230 | + with: | |
| 231 | + name: koco-${{ matrix.os }}.rpm | |
| 232 | + path: target/generate-rpm/*.rpm | |
| 233 | + | |
| 234 | + create-release: | |
| 235 | + name: Create Release | |
| 236 | + runs-on: ubuntu-latest | |
| 237 | + if: startsWith(github.ref, 'refs/tags/v') | |
| 238 | + needs: release | |
| 239 | + permissions: | |
| 240 | + contents: write | |
| 241 | + steps: | |
| 242 | + - uses: actions/checkout@v4 | |
| 243 | + | |
| 244 | + - name: Download all artifacts | |
| 245 | + uses: actions/download-artifact@v4 | |
| 246 | + with: | |
| 247 | + path: artifacts | |
| 248 | + | |
| 249 | + - name: Create release notes | |
| 250 | + run: | | |
| 251 | + echo "# koco Release ${GITHUB_REF_NAME}" > release_notes.md | |
| 252 | + echo "" >> release_notes.md | |
| 253 | + echo "## Changes in this release" >> release_notes.md | |
| 254 | + echo "" >> release_notes.md | |
| 255 | + echo "## Supported Platforms" >> release_notes.md | |
| 256 | + echo "" >> release_notes.md | |
| 257 | + echo "- Linux (x86_64)" >> release_notes.md | |
| 258 | + echo "- Linux (aarch64)" >> release_notes.md | |
| 259 | + echo "- Windows (x86_64)" >> release_notes.md | |
| 260 | + echo "- macOS (x86_64 and Apple Silicon)" >> release_notes.md | |
| 261 | + echo "" >> release_notes.md | |
| 262 | + echo "## Installation" >> release_notes.md | |
| 263 | + echo "" >> release_notes.md | |
| 264 | + echo "1. Download the appropriate archive for your platform" >> release_notes.md | |
| 265 | + echo "2. Extract the binaries" >> release_notes.md | |
| 266 | + echo "3. Place them in your PATH" >> release_notes.md | |
| 267 | + echo "" >> release_notes.md | |
| 268 | + | |
| 269 | + - name: Create GitHub Release | |
| 270 | + uses: softprops/action-gh-release@v1 | |
| 271 | + with: | |
| 272 | + files: | | |
| 273 | + artifacts/*/*.tar.gz | |
| 274 | + artifacts/*/*.zip | |
| 275 | + artifacts/*/*.deb | |
| 276 | + artifacts/*/*.rpm | |
| 277 | + body_path: release_notes.md | |
| 278 | + draft: false | |
| 279 | + prerelease: ${{ contains(github.ref_name, '-') }} | |
| 280 | + generate_release_notes: true | |
| 281 | + env: | |
| 282 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
modified
Cargo.toml
+5
−1
@@ -59,4 +59,8 @@ serde_json = "1.0.149"
| 59 | 59 | [lints.clippy] |
| 60 | 60 | upper_case_acronyms = "allow" |
| 61 | 61 | large_enum_variant = "allow" |
| 62 | −too_many_arguments = "allow" | |
| 62 | +too_many_arguments = "allow" | |
| 63 | +cmp_owned = "allow" | |
| 64 | + | |
| 65 | +[lints.rust] | |
| 66 | +unused = "allow" |
modified
?
+0
−0
Binary file — not rendered.
added
assets/logo.svg
+87
−0
@@ -0,0 +1,87 @@
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
| 2 | +<!-- Created with Inkscape (http://www.inkscape.org/) --> | |
| 3 | + | |
| 4 | +<svg | |
| 5 | + width="256" | |
| 6 | + height="256" | |
| 7 | + viewBox="0 0 67.733332 67.733333" | |
| 8 | + version="1.1" | |
| 9 | + id="svg1" | |
| 10 | + inkscape:version="1.4.3 (unknown)" | |
| 11 | + sodipodi:docname="logo.svg" | |
| 12 | + inkscape:export-filename="logo.png" | |
| 13 | + inkscape:export-xdpi="96" | |
| 14 | + inkscape:export-ydpi="96" | |
| 15 | + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |
| 16 | + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |
| 17 | + xmlns="http://www.w3.org/2000/svg" | |
| 18 | + xmlns:svg="http://www.w3.org/2000/svg"> | |
| 19 | + <sodipodi:namedview | |
| 20 | + id="namedview1" | |
| 21 | + pagecolor="#505050" | |
| 22 | + bordercolor="#eeeeee" | |
| 23 | + borderopacity="1" | |
| 24 | + inkscape:showpageshadow="0" | |
| 25 | + inkscape:pageopacity="0" | |
| 26 | + inkscape:pagecheckerboard="0" | |
| 27 | + inkscape:deskcolor="#505050" | |
| 28 | + inkscape:document-units="mm" | |
| 29 | + inkscape:zoom="2.1981187" | |
| 30 | + inkscape:cx="147.62624" | |
| 31 | + inkscape:cy="131.70353" | |
| 32 | + inkscape:window-width="2880" | |
| 33 | + inkscape:window-height="1814" | |
| 34 | + inkscape:window-x="0" | |
| 35 | + inkscape:window-y="66" | |
| 36 | + inkscape:window-maximized="1" | |
| 37 | + inkscape:current-layer="layer1" | |
| 38 | + showguides="true"> | |
| 39 | + <sodipodi:guide | |
| 40 | + position="57.394497,15.106532" | |
| 41 | + orientation="1,0" | |
| 42 | + id="guide10" | |
| 43 | + inkscape:locked="false" /> | |
| 44 | + <sodipodi:guide | |
| 45 | + position="9.8202082,26.643208" | |
| 46 | + orientation="1,0" | |
| 47 | + id="guide11" | |
| 48 | + inkscape:locked="false" /> | |
| 49 | + </sodipodi:namedview> | |
| 50 | + <defs | |
| 51 | + id="defs1" /> | |
| 52 | + <g | |
| 53 | + inkscape:label="Layer 1" | |
| 54 | + inkscape:groupmode="layer" | |
| 55 | + id="layer1"> | |
| 56 | + <rect | |
| 57 | + style="fill:#651d1d;fill-opacity:1;stroke-width:0.225777" | |
| 58 | + id="rect1-5" | |
| 59 | + width="67.73333" | |
| 60 | + height="67.73333" | |
| 61 | + x="0" | |
| 62 | + y="0" | |
| 63 | + rx="7.5810843" | |
| 64 | + ry="8.6536465" /> | |
| 65 | + <text | |
| 66 | + xml:space="preserve" | |
| 67 | + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:39.5111px;line-height:0.2;font-family:'Berkeley Mono';-inkscape-font-specification:'Berkeley Mono Bold';text-align:center;letter-spacing:-5.29167px;word-spacing:0px;text-anchor:middle;fill:#fdf2c6;fill-opacity:1;stroke:none;stroke-width:0.264583" | |
| 68 | + x="53.06572" | |
| 69 | + y="41.210495" | |
| 70 | + id="text7702-6-3-9-3-2-5-9-9"><tspan | |
| 71 | + sodipodi:role="line" | |
| 72 | + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:39.5111px;line-height:0.2;font-family:'B612 Mono';-inkscape-font-specification:'B612 Mono Bold';letter-spacing:-5.29167px;fill:#fdf2c6;fill-opacity:1;stroke-width:0.264583" | |
| 73 | + x="53.06572" | |
| 74 | + y="41.210495" | |
| 75 | + id="tspan1">P </tspan><tspan | |
| 76 | + sodipodi:role="line" | |
| 77 | + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:39.5111px;line-height:0.2;font-family:'B612 Mono';-inkscape-font-specification:'B612 Mono Bold';letter-spacing:-5.29167px;fill:#fdf2c6;fill-opacity:1;stroke-width:0.264583" | |
| 78 | + x="53.06572" | |
| 79 | + y="49.208649" | |
| 80 | + id="tspan3">P </tspan><tspan | |
| 81 | + sodipodi:role="line" | |
| 82 | + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:39.5111px;line-height:0.2;font-family:'B612 Mono';-inkscape-font-specification:'B612 Mono Bold';letter-spacing:-5.29167px;fill:#fdf2c6;fill-opacity:1;stroke-width:0.264583" | |
| 83 | + x="60.61515" | |
| 84 | + y="57.206799" | |
| 85 | + id="tspan4">L </tspan></text> | |
| 86 | + </g> | |
| 87 | +</svg> |
modified
src/do_init.rs
+1
−1
@@ -1019,7 +1019,7 @@ fn render(f: &mut Frame, app: &mut Init) {
| 1019 | 1019 | const TEXT_FG_COLOR: Color = SLATE.c200; |
| 1020 | 1020 | const COMPLETED_TEXT_FG_COLOR: Color = GREEN.c500; |
| 1021 | 1021 | |
| 1022 | −pub fn lcolor(input: &String) -> Color { | |
| 1022 | +pub fn lcolor(input: &str) -> Color { | |
| 1023 | 1023 | match input.to_lowercase().as_str() { |
| 1024 | 1024 | "red" => RED.c500, |
| 1025 | 1025 | "gold" => AMBER.c500, |
modified
src/do_tui.rs
+2
−2
@@ -80,7 +80,7 @@ pub struct Editable {
| 80 | 80 | pub third: Option<String>, |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | −fn key_in_tier(key: String, tiers: &Vec<tier_defaults::Model>) -> bool { | |
| 83 | +fn key_in_tier(key: String, tiers: &[tier_defaults::Model]) -> bool { | |
| 84 | 84 | let t = tiers |
| 85 | 85 | .iter() |
| 86 | 86 | .map(|t| t.key.to_string()) |
@@ -88,7 +88,7 @@ fn key_in_tier(key: String, tiers: &Vec<tier_defaults::Model>) -> bool {
| 88 | 88 | t.contains(&key) |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | −fn get_key_in_tier(key: String, tiers: &Vec<tier_defaults::Model>) -> bool { | |
| 91 | +fn get_key_in_tier(key: String, tiers: &[tier_defaults::Model]) -> bool { | |
| 92 | 92 | let t = tiers |
| 93 | 93 | .iter() |
| 94 | 94 | .map(|t| t.key.to_string()) |
Parents: 43c1e4a