From 5cd1c4c74bac7cd34bbc383dc819ebe1f9bcac09 Mon Sep 17 00:00:00 2001 From: Pagwin Date: Wed, 11 Sep 2024 15:07:39 -0400 Subject: [PATCH] working on patching capabilities --- config.toml | 3 +++ patches/cabal-features.patch | 10 ++++++++++ scripts/cabal-quick | 3 +++ src/main.rs | 17 +++++++++++++---- 4 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 patches/cabal-features.patch create mode 100755 scripts/cabal-quick diff --git a/config.toml b/config.toml index 63e2732..5a48236 100644 --- a/config.toml +++ b/config.toml @@ -3,3 +3,6 @@ [subcommands.scripts] rs = "cargo-quick" js = "npm-quick" + +[patching] +prefix = "/home/pagwin/.local/share/patches/" diff --git a/patches/cabal-features.patch b/patches/cabal-features.patch new file mode 100644 index 0000000..5c4a6be --- /dev/null +++ b/patches/cabal-features.patch @@ -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 diff --git a/scripts/cabal-quick b/scripts/cabal-quick new file mode 100755 index 0000000..2f5601f --- /dev/null +++ b/scripts/cabal-quick @@ -0,0 +1,3 @@ +#!/bin/sh + +cabal init "$@" diff --git a/src/main.rs b/src/main.rs index a8470fe..9e07755 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,13 +12,20 @@ use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize,Default)] struct Subcommands{ //a hashmap of subcommands which can be created via cloning a skeleton repository - skeletons:HashMap, + skeletons:Option>, // a hashmap of subcommands which can be created via running an external executable - scripts: HashMap + scripts: Option> +} +#[derive(Serialize, Deserialize,Default)] +struct Patching{ + // path to prefix to finding a patch (default is relative to pwd) + prefix: Option, + cmd_patches: Option> } #[derive(Serialize, Deserialize,Default)] struct Config{ - subcommands: Subcommands + subcommands: Subcommands, + patching: Patching } #[allow(dead_code)] @@ -64,8 +71,10 @@ fn main() -> Result<(),Errors> { }; buf }.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 {