diff --git a/.github/steps/setup/action.yml b/.github/steps/setup/action.yml new file mode 100644 index 0000000..fd8ea5e --- /dev/null +++ b/.github/steps/setup/action.yml @@ -0,0 +1,29 @@ +name: "Workflow Setup" +description: "Workflow Setup" + +inputs: + token: + description: "GitHub Token" + required: true + rust_targets: + description: "Targets for rust-toolchain" + default: "" + +runs: + using: composite + steps: + - uses: arduino/setup-task@v2 + with: + version: 3.x + repo-token: ${{ inputs.token }} + + # rust toolchain + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ inputs.rust_targets }} + - uses: Swatinem/rust-cache@v2 # useblacksmith/rust-cache@v3 + + # cargo tools + - uses: baptiste0928/cargo-install@v3 + with: + crate: txtpp diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 25c25c9..c046ae5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -8,21 +8,18 @@ on: - main jobs: - build: - name: Check, Build, Test + check: + name: Check strategy: { matrix: { os: [ ubuntu-latest, macos-latest, windows-latest ] } } runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - uses: arduino/setup-task@v1 - with: - version: 3.x - repo-token: ${{ secrets.GITHUB_TOKEN }} - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - - uses: baptiste0928/cargo-install@v2 - with: - crate: txtpp - - run: task check - - run: cargo build --release - - run: cargo test --release + - uses: actions/checkout@v4 + with: + persist-credentials: false + submodules: true + - uses: ./.github/steps/setup + with: + token: ${{ secrets.GITHUB_TOKEN }} + - run: task install + - run: task check + - run: task test diff --git a/.gitignore b/.gitignore index 87a3ca5..dda142c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target /temp +/mono-dev diff --git a/Cargo.lock b/Cargo.lock index b808150..ef161a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,12 +1,12 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -19,49 +19,50 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.3" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", - "windows-sys", + "once_cell", + "windows-sys 0.59.0", ] [[package]] name = "bitflags" -version = "2.5.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "clap" -version = "4.5.4" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000" dependencies = [ "clap_builder", "clap_derive", @@ -69,9 +70,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120" dependencies = [ "anstream", "anstyle", @@ -81,9 +82,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" dependencies = [ "heck", "proc-macro2", @@ -93,40 +94,46 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "either" -version = "1.12.0" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "env_home" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "fs4" -version = "0.8.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73969b81e8bc90a3828d913dd3973d80771bfb9d7fbe1a78a79122aad456af15" +checksum = "8640e34b88f7652208ce9e88b1a37a2ae95227d84abec377ccd3c5cfeb141ed4" dependencies = [ "rustix", - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -135,36 +142,27 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys", -] - [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "magoo" -version = "0.2.1" +version = "0.2.2" dependencies = [ "clap", "fs4", @@ -175,48 +173,54 @@ dependencies = [ "which", ] +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + [[package]] name = "pathdiff" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "proc-macro2" -version = "1.0.84" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] [[package]] name = "rustix" -version = "0.38.34" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "semver" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "strsim" @@ -226,9 +230,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.66" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -246,18 +250,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.61" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", @@ -266,24 +270,24 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "which" -version = "6.0.1" +version = "7.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8211e4f58a2b2805adfbefbc07bab82958fc91e3836339b1ab7ae32465dce0d7" +checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762" dependencies = [ "either", - "home", + "env_home", "rustix", "winsafe", ] @@ -294,7 +298,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -306,11 +310,20 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -324,51 +337,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winsafe" diff --git a/Cargo.toml b/Cargo.toml index aace21d..212e88b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "magoo" -version = "0.2.1" -edition = "2021" +version = "0.2.2" +edition = "2024" description = "A wrapper for git submodule that simplifies the workflows" repository = "https://github.com/Pistonite/magoo" license = "MIT" -authors = ["Pistonight "] +authors = ["Pistonight "] keywords = ["git", "tool", "submodule", "cli"] categories = ["development-tools", "command-line-utilities"] exclude = [ @@ -17,13 +17,13 @@ exclude = [ ] [dependencies] -clap = { version = "4.5.4", features = ["derive"], optional = true } -fs4 = "0.8.2" -pathdiff = "0.2.1" -semver = "1.0.23" +clap = { version = "4.5.38", features = ["derive"], optional = true } +fs4 = "0.13.1" +pathdiff = "0.2.3" +semver = "1.0.26" termcolor = "1.4.1" -thiserror = "1.0.59" -which = "6.0.1" +thiserror = "2.0.12" +which = "7.0.3" [features] default = ["cli"] diff --git a/LICENSE b/LICENSE index eb906c5..d5b9926 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Pistonite +Copyright (c) 2025 Michael Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Taskfile.yml b/Taskfile.yml index f28c1d0..e3e6137 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,20 +1,33 @@ version: '3' +includes: + cargo: + taskfile: ./mono-dev/task/cargo.yaml + optional: true + internal: true + tasks: + install-cargo-extra-tools: + aliases: [icets] + cmds: + - cargo install txtpp + + install: + cmds: + - rm -rf mono-dev + - git clone https://github.com/Pistonight/mono-dev + check: - desc: Check for issues cmds: - - cargo clippy --all-features --all-targets -- -D warnings -D clippy::todo - - cargo fmt --check - - txtpp verify README.md + - task: cargo:clippy-all + - task: cargo:fmt-check + - txtpp verify README.md fix: - desc: Run formatter cmds: - - cargo fmt --all - - txtpp README.md + - task: cargo:fmt-fix + - txtpp README.md test: - desc: Run tests cmds: - - cargo test + - cargo test diff --git a/src/git.rs b/src/git.rs index 720fd31..77e44bb 100644 --- a/src/git.rs +++ b/src/git.rs @@ -7,7 +7,7 @@ use std::path::{Path, PathBuf}; use std::process::{Command, ExitStatus, Stdio}; use std::time::Duration; -use fs4::FileExt; +use fs4::fs_std::FileExt; use crate::print::{ self, println_error, println_hint, println_info, println_verbose, println_warn, @@ -69,7 +69,9 @@ impl GitContext { "Supported versions are: {}", version::get_supported_versions() ); - println_hint!("Please upgrade your git to a supported version or use `magoo --allow-unsupported COMMAND`"); + println_hint!( + "Please upgrade your git to a supported version or use `magoo --allow-unsupported COMMAND`" + ); return Err(GitError::UnsupportedVersion(version.to_string())); } if print { @@ -546,7 +548,10 @@ impl Guard { { let path = path.as_ref(); if path.exists() { - println_warn!("Waiting on file lock. If you are sure no other magoo processes are running, you can remove the lock file `{}`", path.to_cmd_arg()); + println_warn!( + "Waiting on file lock. If you are sure no other magoo processes are running, you can remove the lock file `{}`", + path.to_cmd_arg() + ); } while path.exists() { println_verbose!("Waiting for lock file..."); @@ -570,7 +575,7 @@ impl Drop for Guard { fn drop(&mut self) { let path = &self.1.to_cmd_arg(); println_verbose!("Releasing lock file `{path}`"); - if self.0.unlock().is_err() { + if ::unlock(&self.0).is_err() { println_verbose!("Failed to unlock file `{path}`"); } if std::fs::remove_file(&self.1).is_err() { diff --git a/src/lib.rs b/src/lib.rs index 6687fe9..e91561d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -408,8 +408,12 @@ impl UpdateCommand { if let Some(other_name) = submodule.name() { if let Some(path) = submodule.path() { if path == name { - println_hint!(" however, there is a submodule \"{other_name}\" with path \"{path}\""); - println_hint!(" if you meant to update this submodule, use `magoo update {other_name}`"); + println_hint!( + " however, there is a submodule \"{other_name}\" with path \"{path}\"" + ); + println_hint!( + " if you meant to update this submodule, use `magoo update {other_name}`" + ); break; } } @@ -422,8 +426,12 @@ impl UpdateCommand { if !submodule.is_healthy(&context)? { if !self.bypass { println_error!("Submodule `{name}` is not healthy!"); - println_hint!(" run `magoo status` to investigate. Some issues might be fixable with `magoo status --fix`."); - println_hint!(" alternatively, use the `--bypass` flag to ignore and continue anyway."); + println_hint!( + " run `magoo status` to investigate. Some issues might be fixable with `magoo status --fix`." + ); + println_hint!( + " alternatively, use the `--bypass` flag to ignore and continue anyway." + ); return Err(GitError::NeedFix(false)); } println_warn!("Bypassing warnings from unhealthy submodule `{name}`"); @@ -434,7 +442,9 @@ impl UpdateCommand { None => { println_error!("Submodule `{name}` does not have a path!"); println_hint!(" run `magoo status` to investigate."); - println_hint!(" if you are unsure of the problem, try hard removing the submodule with `magoo remove {name} --force` and then re-adding it"); + println_hint!( + " if you are unsure of the problem, try hard removing the submodule with `magoo remove {name} --force` and then re-adding it" + ); return Err(GitError::NeedFix(false)); } }; @@ -521,8 +531,12 @@ impl RemoveCommand { if let Some(other_name) = submodule.name() { if let Some(path) = submodule.path() { if path == name { - println_hint!(" however, there is a submodule \"{other_name}\" with path \"{path}\""); - println_hint!(" if you meant to remove this submodule, use `magoo remove {other_name}`"); + println_hint!( + " however, there is a submodule \"{other_name}\" with path \"{path}\"" + ); + println_hint!( + " if you meant to remove this submodule, use `magoo remove {other_name}`" + ); break; } } @@ -542,7 +556,9 @@ impl RemoveCommand { None => { println_error!("Submodule `{name}` does not have a path!"); println_hint!(" run `magoo status` to investigate."); - println_hint!(" if you are unsure of the problem, try hard removing the submodule with `magoo remove {name} --force`"); + println_hint!( + " if you are unsure of the problem, try hard removing the submodule with `magoo remove {name} --force`" + ); return Err(GitError::NeedFix(false)); } }; diff --git a/src/main.rs b/src/main.rs index 91adcc4..41d803d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,8 @@ use std::process::exit; use clap::Parser; -use magoo::git::GitError; use magoo::Magoo; +use magoo::git::GitError; fn main() { let cli = Magoo::parse(); diff --git a/src/status.rs b/src/status.rs index e6cbdcb..0fddf7d 100644 --- a/src/status.rs +++ b/src/status.rs @@ -134,7 +134,9 @@ impl Status { ) { Ok(entries) => entries, Err(e) => { - println_verbose!("Git error when reading submodules from .git/config, assuming no submodules: {e}"); + println_verbose!( + "Git error when reading submodules from .git/config, assuming no submodules: {e}" + ); return Ok(()); } }; diff --git a/src/submodule.rs b/src/submodule.rs index eab909f..8a465b7 100644 --- a/src/submodule.rs +++ b/src/submodule.rs @@ -2,7 +2,7 @@ use std::path::{Path, PathBuf}; -use crate::git::{quote_arg, GitCanonicalize, GitCmdPath, GitContext, GitError}; +use crate::git::{GitCanonicalize, GitCmdPath, GitContext, GitError, quote_arg}; use crate::print::{ print_info, print_warn, println_error, println_hint, println_info, println_verbose, println_warn, @@ -199,12 +199,16 @@ impl Submodule { None => "git".to_string(), }; - println_hint!(" run `{git_c} submodule update -- {path}` to revert this submodule to index (`magoo{dir_switch} install` to revert all)"); - println_hint!(" run `{git_c} add {path}` update the index to {head_commit_short}{describe}"); + println_hint!( + " run `{git_c} submodule update -- {path}` to revert this submodule to index (`magoo{dir_switch} install` to revert all)" + ); + println_hint!( + " run `{git_c} add {path}` update the index to {head_commit_short}{describe}" + ); } else { println_hint!( - " run `magoo{dir_switch} install` to revert all submodules to index" - ); + " run `magoo{dir_switch} install` to revert all submodules to index" + ); } } else { print_warn!(", checked out {head_commit_short}{describe}"); @@ -225,7 +229,9 @@ impl Submodule { println_hint!( " run `magoo{dir_switch} install` to initialize all submodules" ); - println_hint!(" run `{git_c} submodule update --init -- {path}` to initialize only this submodule"); + println_hint!( + " run `{git_c} submodule update --init -- {path}` to initialize only this submodule" + ); } else { print_warn!(", not initialized"); }