Compare commits
1 Commits
main
...
push-zposk
Author | SHA1 | Date | |
---|---|---|---|
0f72606dd0 |
20
CHANGELOG.md
20
CHANGELOG.md
@ -6,26 +6,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.3.4] - 2025-01-08
|
||||
|
||||
### Added
|
||||
- feat/add-post-clone-command
|
||||
|
||||
- add ability to specify custom command
|
||||
|
||||
### Fixed
|
||||
- use correct post clone command
|
||||
- tests for config
|
||||
|
||||
### Other
|
||||
- add ability to specify multiple commands
|
||||
|
||||
|
||||
## [0.3.3] - 2025-01-07
|
||||
|
||||
### Other
|
||||
- replace dotenv with dotenvy, a slightly more maintained version of the same library (#50)
|
||||
|
||||
## [0.3.2] - 2025-01-07
|
||||
|
||||
### Fixed
|
||||
|
171
Cargo.lock
generated
171
Cargo.lock
generated
@ -152,7 +152,7 @@ dependencies = [
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -269,14 +269,14 @@ dependencies = [
|
||||
"num-traits",
|
||||
"serde",
|
||||
"wasm-bindgen",
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.27"
|
||||
version = "4.5.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "769b0145982b4b48713e01ec42d61614425f27b7058bda7180a3a41f30104796"
|
||||
checksum = "9560b07a799281c7e0958b9296854d6fafd4c5f31444a7e5bb1ad6dde5ccf1bd"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@ -284,9 +284,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.27"
|
||||
version = "4.5.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7"
|
||||
checksum = "874e0dd3eb68bf99058751ac9712f622e61e6f393a94f7128fa26e3f02f5c7cd"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@ -490,11 +490,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "6.0.0"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"
|
||||
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||
dependencies = [
|
||||
"dirs-sys 0.5.0",
|
||||
"dirs-sys 0.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -504,20 +504,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users 0.4.6",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.5.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
|
||||
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users 0.5.0",
|
||||
"windows-sys 0.59.0",
|
||||
"redox_users",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -532,10 +532,10 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dotenvy"
|
||||
version = "0.15.7"
|
||||
name = "dotenv"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
|
||||
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
@ -565,7 +565,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -786,15 +786,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gitnow"
|
||||
version = "0.3.4"
|
||||
version = "0.3.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"clap",
|
||||
"crossterm",
|
||||
"dirs 6.0.0",
|
||||
"dotenvy",
|
||||
"dirs 5.0.1",
|
||||
"dotenv",
|
||||
"futures",
|
||||
"gitea-client",
|
||||
"nucleo-matcher",
|
||||
@ -1527,9 +1527,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "octocrab"
|
||||
version = "0.43.0"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27527d68322f4c603319f7958973db8f9fa4be62c0e3fafe084f5562cf6353df"
|
||||
checksum = "7b97f949a7cb04608441c2ddb28e15a377e8b5142c2d1835ad2686d434de8558"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"async-trait",
|
||||
@ -1656,7 +1656,7 @@ dependencies = [
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1939,17 +1939,6 @@ dependencies = [
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libredox",
|
||||
"thiserror 2.0.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.11.1"
|
||||
@ -2062,15 +2051,15 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.43"
|
||||
version = "0.38.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6"
|
||||
checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2548,7 +2537,7 @@ dependencies = [
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2710,9 +2699,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.43.0"
|
||||
version = "1.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e"
|
||||
checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
@ -2728,9 +2717,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.5.0"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
|
||||
checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3011,9 +3000,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.12.1"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3758f5e68192bb96cc8f9b7e2c2cfdabb435499a28499a42f8f984092adad4b"
|
||||
checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a"
|
||||
dependencies = [
|
||||
"atomic",
|
||||
"getrandom",
|
||||
@ -3250,7 +3239,7 @@ version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3261,7 +3250,7 @@ checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0"
|
||||
dependencies = [
|
||||
"windows-result",
|
||||
"windows-strings",
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3270,7 +3259,7 @@ version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3280,7 +3269,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
|
||||
dependencies = [
|
||||
"windows-result",
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3289,7 +3287,7 @@ version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3298,7 +3296,22 @@ version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.48.5",
|
||||
"windows_aarch64_msvc 0.48.5",
|
||||
"windows_i686_gnu 0.48.5",
|
||||
"windows_i686_msvc 0.48.5",
|
||||
"windows_x86_64_gnu 0.48.5",
|
||||
"windows_x86_64_gnullvm 0.48.5",
|
||||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3307,28 +3320,46 @@ version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_aarch64_gnullvm 0.52.6",
|
||||
"windows_aarch64_msvc 0.52.6",
|
||||
"windows_i686_gnu 0.52.6",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
"windows_i686_msvc 0.52.6",
|
||||
"windows_x86_64_gnu 0.52.6",
|
||||
"windows_x86_64_gnullvm 0.52.6",
|
||||
"windows_x86_64_msvc 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
@ -3341,24 +3372,48 @@ version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
|
@ -3,7 +3,7 @@ members = ["crates/*"]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.3.4"
|
||||
version = "0.3.2"
|
||||
|
||||
[workspace.dependencies]
|
||||
|
||||
@ -12,4 +12,4 @@ tokio = { version = "1", features = ["full"] }
|
||||
tracing = { version = "0.1", features = ["log"] }
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
||||
clap = { version = "4", features = ["derive", "env"] }
|
||||
dotenvy = { version = "0.15.7" }
|
||||
dotenv = { version = "0.15" }
|
||||
|
@ -17,7 +17,7 @@ tokio.workspace = true
|
||||
tracing.workspace = true
|
||||
tracing-subscriber.workspace = true
|
||||
clap.workspace = true
|
||||
dotenvy.workspace = true
|
||||
dotenv.workspace = true
|
||||
|
||||
serde = { version = "1.0.197", features = ["derive"] }
|
||||
uuid = { version = "1.7.0", features = ["v4"] }
|
||||
@ -26,8 +26,8 @@ toml = "0.8.19"
|
||||
|
||||
gitea-client = { version = "1.22.1" }
|
||||
url = "2.5.2"
|
||||
octocrab = "0.43.0"
|
||||
dirs = "6.0.0"
|
||||
octocrab = "0.42.0"
|
||||
dirs = "5.0.1"
|
||||
prost = "0.13.2"
|
||||
prost-types = "0.13.2"
|
||||
bytes = "1.7.1"
|
||||
|
@ -4,7 +4,6 @@ use crate::{
|
||||
app::App,
|
||||
cache::CacheApp,
|
||||
components::inline_command::InlineCommand,
|
||||
custom_command::CustomCommandApp,
|
||||
fuzzy_matcher::{FuzzyMatcher, FuzzyMatcherApp},
|
||||
git_clone::GitCloneApp,
|
||||
git_provider::Repository,
|
||||
@ -111,22 +110,12 @@ impl RootCommand {
|
||||
} else {
|
||||
eprintln!("cloning repository...");
|
||||
git_clone.clone_repo(&repo, force_refresh).await?;
|
||||
|
||||
self.app
|
||||
.custom_command()
|
||||
.execute_post_clone_command(&project_path)
|
||||
.await?;
|
||||
}
|
||||
} else {
|
||||
tracing::info!("skipping clone for repo: {}", &repo.to_rel_path().display());
|
||||
}
|
||||
} else {
|
||||
tracing::info!("repository already exists");
|
||||
|
||||
self.app
|
||||
.custom_command()
|
||||
.execute_post_update_command(&project_path)
|
||||
.await?;
|
||||
}
|
||||
|
||||
if shell {
|
||||
|
@ -23,7 +23,7 @@ impl<'a> Spinner<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl StatefulWidget for Spinner<'_> {
|
||||
impl<'a> StatefulWidget for Spinner<'a> {
|
||||
type State = SpinnerState;
|
||||
|
||||
fn render(
|
||||
|
@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
|
||||
use anyhow::Context;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Config {
|
||||
#[serde(default)]
|
||||
pub settings: Settings,
|
||||
@ -12,51 +12,16 @@ pub struct Config {
|
||||
pub providers: Providers,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Settings {
|
||||
#[serde(default)]
|
||||
pub projects: Projects,
|
||||
|
||||
#[serde(default)]
|
||||
pub cache: Cache,
|
||||
|
||||
pub post_clone_command: Option<PostCloneCommand>,
|
||||
pub post_update_command: Option<PostUpdateCommand>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[serde(untagged)]
|
||||
pub enum PostUpdateCommand {
|
||||
Single(String),
|
||||
Multiple(Vec<String>),
|
||||
}
|
||||
|
||||
impl PostUpdateCommand {
|
||||
pub fn get_commands(&self) -> Vec<String> {
|
||||
match self.clone() {
|
||||
PostUpdateCommand::Single(item) => vec![item],
|
||||
PostUpdateCommand::Multiple(items) => items,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[serde(untagged)]
|
||||
pub enum PostCloneCommand {
|
||||
Single(String),
|
||||
Multiple(Vec<String>),
|
||||
}
|
||||
|
||||
impl PostCloneCommand {
|
||||
pub fn get_commands(&self) -> Vec<String> {
|
||||
match self.clone() {
|
||||
PostCloneCommand::Single(item) => vec![item],
|
||||
PostCloneCommand::Multiple(items) => items,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Projects {
|
||||
pub directory: ProjectLocation,
|
||||
}
|
||||
@ -92,7 +57,7 @@ impl std::ops::Deref for ProjectLocation {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Cache {
|
||||
#[serde(default)]
|
||||
pub location: CacheLocation,
|
||||
@ -124,7 +89,7 @@ impl Default for CacheLocation {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(untagged)]
|
||||
pub enum CacheDuration {
|
||||
Enabled(bool),
|
||||
@ -166,7 +131,7 @@ impl Default for CacheDuration {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Default, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Providers {
|
||||
#[serde(default)]
|
||||
pub github: Vec<GitHub>,
|
||||
@ -174,7 +139,7 @@ pub struct Providers {
|
||||
pub gitea: Vec<Gitea>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub struct GitHub {
|
||||
#[serde(default)]
|
||||
pub url: Option<String>,
|
||||
@ -190,7 +155,7 @@ pub struct GitHub {
|
||||
pub organisations: Vec<GitHubOrganisation>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub struct GitHubUser(String);
|
||||
|
||||
impl From<GitHubUser> for String {
|
||||
@ -205,7 +170,7 @@ impl<'a> From<&'a GitHubUser> for &'a str {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub struct GitHubOrganisation(String);
|
||||
|
||||
impl From<GitHubOrganisation> for String {
|
||||
@ -220,7 +185,7 @@ impl<'a> From<&'a GitHubOrganisation> for &'a str {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Gitea {
|
||||
pub url: String,
|
||||
|
||||
@ -236,21 +201,21 @@ pub struct Gitea {
|
||||
pub organisations: Vec<GiteaOrganisation>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(untagged)]
|
||||
pub enum GiteaAccessToken {
|
||||
Direct(String),
|
||||
Env { env: String },
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(untagged)]
|
||||
pub enum GitHubAccessToken {
|
||||
Direct(String),
|
||||
Env { env: String },
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub struct GiteaUser(String);
|
||||
|
||||
impl From<GiteaUser> for String {
|
||||
@ -265,7 +230,7 @@ impl<'a> From<&'a GiteaUser> for &'a str {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub struct GiteaOrganisation(String);
|
||||
impl From<GiteaOrganisation> for String {
|
||||
fn from(value: GiteaOrganisation) -> Self {
|
||||
@ -396,9 +361,7 @@ mod test {
|
||||
},
|
||||
projects: Projects {
|
||||
directory: PathBuf::from("git").into()
|
||||
},
|
||||
post_update_command: None,
|
||||
post_clone_command: None
|
||||
}
|
||||
}
|
||||
},
|
||||
config
|
||||
@ -423,9 +386,7 @@ mod test {
|
||||
},
|
||||
settings: Settings {
|
||||
cache: Cache::default(),
|
||||
projects: Projects::default(),
|
||||
post_update_command: None,
|
||||
post_clone_command: None
|
||||
projects: Projects::default()
|
||||
}
|
||||
},
|
||||
config
|
||||
|
@ -1,83 +0,0 @@
|
||||
use std::path::Path;
|
||||
|
||||
use crate::{app::App, config::Config};
|
||||
|
||||
pub struct CustomCommand {
|
||||
config: Config,
|
||||
}
|
||||
|
||||
impl CustomCommand {
|
||||
pub fn new(config: Config) -> Self {
|
||||
Self { config }
|
||||
}
|
||||
|
||||
pub async fn execute_post_clone_command(&self, path: &Path) -> anyhow::Result<()> {
|
||||
if let Some(post_clone_command) = &self.config.settings.post_clone_command {
|
||||
for command in post_clone_command.get_commands() {
|
||||
let command_parts = command.split(' ').collect::<Vec<_>>();
|
||||
let Some((first, rest)) = command_parts.split_first() else {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
let mut cmd = tokio::process::Command::new(first);
|
||||
cmd.args(rest).current_dir(path);
|
||||
|
||||
eprintln!("running command: {}", command);
|
||||
|
||||
tracing::info!(
|
||||
path = path.display().to_string(),
|
||||
cmd = command,
|
||||
"running custom post clone command"
|
||||
);
|
||||
let output = cmd.output().await?;
|
||||
let stdout = std::str::from_utf8(&output.stdout)?;
|
||||
tracing::info!(
|
||||
stdout = stdout,
|
||||
"finished running custom post clone command"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn execute_post_update_command(&self, path: &Path) -> anyhow::Result<()> {
|
||||
if let Some(post_update_command) = &self.config.settings.post_update_command {
|
||||
for command in post_update_command.get_commands() {
|
||||
let command_parts = command.split(' ').collect::<Vec<_>>();
|
||||
let Some((first, rest)) = command_parts.split_first() else {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
let mut cmd = tokio::process::Command::new(first);
|
||||
cmd.args(rest).current_dir(path);
|
||||
|
||||
eprintln!("running command: {}", command);
|
||||
|
||||
tracing::info!(
|
||||
path = path.display().to_string(),
|
||||
cmd = command,
|
||||
"running custom post update command"
|
||||
);
|
||||
let output = cmd.output().await?;
|
||||
let stdout = std::str::from_utf8(&output.stdout)?;
|
||||
tracing::info!(
|
||||
stdout = stdout,
|
||||
"finished running custom post update command"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub trait CustomCommandApp {
|
||||
fn custom_command(&self) -> CustomCommand;
|
||||
}
|
||||
|
||||
impl CustomCommandApp for App {
|
||||
fn custom_command(&self) -> CustomCommand {
|
||||
CustomCommand::new(self.config.clone())
|
||||
}
|
||||
}
|
@ -15,7 +15,6 @@ mod cache_codec;
|
||||
mod commands;
|
||||
mod components;
|
||||
mod config;
|
||||
mod custom_command;
|
||||
mod fuzzy_matcher;
|
||||
mod git_clone;
|
||||
mod git_provider;
|
||||
@ -58,7 +57,7 @@ const DEFAULT_CONFIG_PATH: &str = ".config/gitnow/gitnow.toml";
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
dotenvy::dotenv().ok();
|
||||
dotenv::dotenv().ok();
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
EnvFilter::builder()
|
||||
|
@ -1,31 +1,7 @@
|
||||
[settings]
|
||||
# Runs after a project is fetched for the first time, either a single string, or multiple in an array
|
||||
post_clone_command = "jj git init --colocate"
|
||||
# Runs after a project is jumped to if it already exists.
|
||||
post_update_command = ["git pull", "jj git fetch"]
|
||||
|
||||
[[providers.github]]
|
||||
# Who is the user running the clone command
|
||||
current_user = "kjuulh"
|
||||
# How to authenticate to github
|
||||
access_token = { env = "GITHUB_ACCESS_TOKEN" }
|
||||
|
||||
# Which users to index
|
||||
users = ["kjuulh"]
|
||||
# Which organisations to index
|
||||
organisations = ["lunarway"]
|
||||
|
||||
[[providers.gitea]]
|
||||
# WHich gitea instance to authenticate against
|
||||
url = "https://git.front.kjuulh.io/api/v1"
|
||||
|
||||
# How to authenticate to gitea
|
||||
current_user = "kjuulh"
|
||||
|
||||
# WHich token to use to authenticate
|
||||
access_token = { env = "GITEA_ACCESS_TOKEN" }
|
||||
|
||||
# Which users to index
|
||||
users = ["kjuulh"]
|
||||
# Which organisations to index
|
||||
organisation = ["noorgplease"]
|
||||
|
Loading…
Reference in New Issue
Block a user