working on patching capabilities

This commit is contained in:
Pagwin 2024-09-11 15:07:39 -04:00
parent 5015de5c52
commit 5cd1c4c74b
No known key found for this signature in database
GPG key ID: 81137023740CA260
4 changed files with 29 additions and 4 deletions

View file

@ -3,3 +3,6 @@
[subcommands.scripts] [subcommands.scripts]
rs = "cargo-quick" rs = "cargo-quick"
js = "npm-quick" js = "npm-quick"
[patching]
prefix = "/home/pagwin/.local/share/patches/"

View file

@ -0,0 +1,10 @@
--- testing-testing.cabal.old 2024-09-11 14:05:37.254611228 -0400
+++ testing-testing.cabal 2024-09-11 14:07:06.045206895 -0400
@@ -21,6 +21,7 @@
main-is: Main.hs
-- other-modules:
-- other-extensions:
+ default-extensions: ApplicativeDo DataKinds NamedFieldPuns DerivingVia LambdaCase TypeApplications DeriveGeneric OverloadedStrings OverloadedLists
build-depends: base ^>=4.17.2.1
hs-source-dirs: app
default-language: Haskell2010

3
scripts/cabal-quick Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
cabal init "$@"

View file

@ -12,13 +12,20 @@ use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize,Default)] #[derive(Serialize, Deserialize,Default)]
struct Subcommands{ struct Subcommands{
//a hashmap of subcommands which can be created via cloning a skeleton repository //a hashmap of subcommands which can be created via cloning a skeleton repository
skeletons:HashMap<String, (String, String)>, skeletons:Option<HashMap<String, (String, String)>>,
// a hashmap of subcommands which can be created via running an external executable // a hashmap of subcommands which can be created via running an external executable
scripts: HashMap<String,PathBuf> scripts: Option<HashMap<String,PathBuf>>
}
#[derive(Serialize, Deserialize,Default)]
struct Patching{
// path to prefix to finding a patch (default is relative to pwd)
prefix: Option<PathBuf>,
cmd_patches: Option<HashMap<String, PathBuf>>
} }
#[derive(Serialize, Deserialize,Default)] #[derive(Serialize, Deserialize,Default)]
struct Config{ struct Config{
subcommands: Subcommands subcommands: Subcommands,
patching: Patching
} }
#[allow(dead_code)] #[allow(dead_code)]
@ -64,8 +71,10 @@ fn main() -> Result<(),Errors> {
}; };
buf buf
}.as_str()).unwrap_or_default(); }.as_str()).unwrap_or_default();
let Config {subcommands:Subcommands { skeletons, scripts }, patching:_patching} = config;
let Config {subcommands:Subcommands { skeletons, scripts }} = config; let skeletons = skeletons.unwrap_or_default();
let scripts = scripts.unwrap_or_default();
// Making sure the skeletons and scripts don't have overlap that will cause issue later // Making sure the skeletons and scripts don't have overlap that will cause issue later
{ {