git flow was a mistake #11

Merged
cafkafk merged 29 commits from dev into main 2023-08-09 16:27:57 +02:00
11 changed files with 171 additions and 364 deletions
Showing only changes of commit 8da774af66 - Show all commits

224
Cargo.lock generated
View file

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "aho-corasick"
version = "1.0.1"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04"
checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
dependencies = [
"memchr",
]
@ -34,15 +34,15 @@ dependencies = [
[[package]]
name = "anstyle"
version = "1.0.0"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd"
[[package]]
name = "anstyle-parse"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee"
checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333"
dependencies = [
"utf8parse",
]
@ -74,9 +74,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "1.3.2"
version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
[[package]]
name = "bumpalo"
@ -92,9 +92,12 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]]
name = "cc"
version = "1.0.79"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01"
dependencies = [
"libc",
]
[[package]]
name = "cfg-if"
@ -131,9 +134,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.3.2"
version = "4.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "401a4694d2bf92537b6867d94de48c4842089645fdcdf6c71865b175d836e9c2"
checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd"
dependencies = [
"clap_builder",
"clap_derive",
@ -142,13 +145,12 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.3.1"
version = "4.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72394f3339a76daf211e57d4bcb374410f3965dcc606dd0e03738c7888766980"
checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa"
dependencies = [
"anstream",
"anstyle",
"bitflags",
"clap_lex",
"once_cell",
"strsim",
@ -156,14 +158,14 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.3.2"
version = "4.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f"
checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.18",
"syn 2.0.28",
]
[[package]]
@ -269,9 +271,9 @@ dependencies = [
[[package]]
name = "either"
version = "1.8.1"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "env_logger"
@ -287,10 +289,16 @@ dependencies = [
]
[[package]]
name = "errno"
version = "0.3.1"
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f"
dependencies = [
"errno-dragonfly",
"libc",
@ -307,21 +315,6 @@ dependencies = [
"libc",
]
[[package]]
name = "gg"
version = "0.2.0"
dependencies = [
"clap",
"clap_mangen",
"criterion",
"log",
"pretty_env_logger",
"relative-path",
"serde",
"serde_yaml",
"spinners",
]
[[package]]
name = "half"
version = "1.8.2"
@ -330,9 +323,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
[[package]]
name = "hashbrown"
version = "0.12.3"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
[[package]]
name = "heck"
@ -342,9 +335,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
[[package]]
name = "humantime"
@ -354,33 +347,21 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "indexmap"
version = "1.9.3"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
dependencies = [
"autocfg",
"equivalent",
"hashbrown",
]
[[package]]
name = "io-lifetimes"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
dependencies = [
"hermit-abi",
"libc",
"windows-sys",
]
[[package]]
name = "is-terminal"
version = "0.4.7"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys",
]
@ -396,9 +377,9 @@ dependencies = [
[[package]]
name = "itoa"
version = "1.0.6"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
[[package]]
name = "js-sys"
@ -417,24 +398,21 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.144"
version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "linux-raw-sys"
version = "0.3.8"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
[[package]]
name = "log"
version = "0.4.17"
version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
]
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
[[package]]
name = "maplit"
@ -459,9 +437,9 @@ dependencies = [
[[package]]
name = "num-traits"
version = "0.2.15"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
dependencies = [
"autocfg",
]
@ -478,9 +456,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.17.1"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "oorandom"
@ -528,18 +506,18 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.59"
version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b"
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.28"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
dependencies = [
"proc-macro2",
]
@ -568,9 +546,21 @@ dependencies = [
[[package]]
name = "regex"
version = "1.8.3"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390"
checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69"
dependencies = [
"aho-corasick",
"memchr",
@ -579,9 +569,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.7.2"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
[[package]]
name = "relative-path"
@ -597,13 +587,12 @@ checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316"
[[package]]
name = "rustix"
version = "0.37.19"
version = "0.38.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d"
checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
@ -611,15 +600,15 @@ dependencies = [
[[package]]
name = "rustversion"
version = "1.0.12"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06"
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
[[package]]
name = "ryu"
version = "1.0.13"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
[[package]]
name = "same-file"
@ -632,35 +621,50 @@ dependencies = [
[[package]]
name = "scopeguard"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "seidr"
version = "0.2.0"
dependencies = [
"clap",
"clap_mangen",
"criterion",
"log",
"pretty_env_logger",
"relative-path",
"serde",
"serde_yaml",
"spinners",
]
[[package]]
name = "serde"
version = "1.0.163"
version = "1.0.183"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2"
checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.163"
version = "1.0.183"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e"
checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.18",
"syn 2.0.28",
]
[[package]]
name = "serde_json"
version = "1.0.99"
version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3"
checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c"
dependencies = [
"itoa",
"ryu",
@ -669,9 +673,9 @@ dependencies = [
[[package]]
name = "serde_yaml"
version = "0.9.21"
version = "0.9.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c"
checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574"
dependencies = [
"indexmap",
"itoa",
@ -732,9 +736,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.18"
version = "2.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
dependencies = [
"proc-macro2",
"quote",
@ -762,15 +766,15 @@ dependencies = [
[[package]]
name = "unicode-ident"
version = "1.0.9"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
[[package]]
name = "unsafe-libyaml"
version = "0.2.8"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6"
checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa"
[[package]]
name = "utf8parse"
@ -809,7 +813,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.18",
"syn 2.0.28",
"wasm-bindgen-shared",
]
@ -831,7 +835,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.18",
"syn 2.0.28",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -894,9 +898,9 @@ dependencies = [
[[package]]
name = "windows-targets"
version = "0.48.0"
version = "0.48.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",

View file

@ -1,14 +1,14 @@
[package]
name = "gg"
name = "seidr"
version = "0.2.0"
authors = ["Christina Sørensen"]
edition = "2021"
rust-version = "1.70.0"
description = "A Rust GitOps/symlinkfarm orchestrator inspired by GNU Stow."
documentation = "https://github.com/cafkafk/gg"
documentation = "https://github.com/cafkafk/seidr"
readme = "./README.org"
homepage = "https://github.com/cafkafk/gg"
repository = "https://github.com/cafkafk/gg"
homepage = "https://github.com/cafkafk/seidr"
repository = "https://github.com/cafkafk/seidr"
license = "GPL-3.0-only"
keywords = ["git", "declarative", "cli", "devops", "terminal"]
categories = ["command-line-interface", "command-line-utilities"]
@ -16,8 +16,8 @@ categories = ["command-line-interface", "command-line-utilities"]
# build = "build.rs"
# links = "git2"
# exclude = "./vacation_photos"
# include = "./gg_memes"
publish = false
# include = "./seidr_memes"
# publish = false
# metadata
# deafult-run
# autobins

View file

@ -1,5 +1,5 @@
#+options: toc:nil
* gg - git gut
* Seiðr
#+html: <img src="https://img.shields.io/badge/license-GPLv3-blue"><img src="https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg">
A Rust GitOps/symlinkfarm orchestrator inspired by GNU Stow. Useful for dealing
@ -19,16 +19,16 @@ commit).
** Installation
#+begin_src sh
$ git clone https://github.com/cafkafk/gg
$ cd gg
$ git clone https://github.com/cafkafk/seidr
$ cd seidr
$ cargo install --path .
#+end_src
** Configuration
If you want a template, you can copy the file from src/test/config.yaml:
#+begin_src sh
$ mkdir -p ~/.config/gg/
$ cp src/test/config.yaml ~/.config/gg/config.yaml
$ mkdir -p ~/.config/seidr/
$ cp src/test/config.yaml ~/.config/seidr/config.yaml
#+end_src
You should *seriously* change this file before running any commands.

View file

@ -1,5 +1,5 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use gg::git::Config;
use seidr::git::Config;
use relative_path::RelativePath;
pub fn criterion_benchmark(c: &mut Criterion) {

View file

@ -6,7 +6,7 @@
There were 3 major designs considered so far (here in chronological order).
**** Vec Based
Code sketch in https://github.com/cafkafk/gg/commit/3d3b6d6646bda84333018cd621cd8bd6348b9cef
Code sketch in https://github.com/cafkafk/seidr/commit/3d3b6d6646bda84333018cd621cd8bd6348b9cef
#+begin_src mermaid :file ./doc/img/config-struct-vec.png :width 4000px
flowchart LR

View file

@ -21,7 +21,7 @@ use crate::utils::strings::INTERACTIVE_NOTICE;
use clap::{ArgAction, CommandFactory, Parser, Subcommand};
const CONFIG_FILE: &str = "/.config/gg/config.yaml";
const CONFIG_FILE: &str = "/.config/seidr/config.yaml";
const HELP_TEMPLATE: &str = "\
{before-help}{name} {version}
@ -36,7 +36,7 @@ const HELP_TEMPLATE: &str = "\
//#[clap(author, version, about, long_about = None)]
#[derive(Parser, Debug)]
#[clap(
name="gg - git gut",
name="seidr - git gut",
author,
version,
long_version=env!("CARGO_PKG_VERSION"),

View file

@ -415,11 +415,11 @@ impl Repo {
///
///
/// ```
/// use gg::git;
/// use gg::git::Repo;
/// use gg::git::Config;
/// use seidr::git;
/// use seidr::git::Repo;
/// use seidr::git::Config;
/// use std::env::current_dir;
/// use gg::git::SeriesItem;
/// use seidr::git::SeriesItem;
/// use relative_path::RelativePath;
///
/// let root = current_dir().expect("failed to get current dir");
@ -589,8 +589,8 @@ impl Config {
/// Here is an example of how an associated method could use this function.
///
/// ```
/// # use gg::git::Repo;
/// # use gg::git::SeriesItem;
/// # use seidr::git::Repo;
/// # use seidr::git::SeriesItem;
///
/// let series: Vec<SeriesItem> = vec![
/// SeriesItem {

View file

@ -87,18 +87,18 @@ fn main() {
// TODO: generalize for reuse by all commands that operate on repo->name->msg
//
// What we want:
// - gg quick
// - gg quick category
// - gg quick category repository
// - gg quick -m "message"
// - gg quick category -m "message"
// - gg quick category repo -m "hi"
// - seidr quick
// - seidr quick category
// - seidr quick category repository
// - seidr quick -m "message"
// - seidr quick category -m "message"
// - seidr quick category repo -m "hi"
//
// What we are implementing:
// - [x] gg quick
// - [ ] gg quick category
// - [ ] gg quick category repository
// - [ ] gg quick category repository "stuff"
// - [x] seidr quick
// - [ ] seidr quick category
// - [ ] seidr quick category repository
// - [ ] seidr quick category repository "stuff"
//
// Roadmap:
// - [-] basic command parsing
@ -106,11 +106,11 @@ fn main() {
// - [ ] ability to run command on repos in category
// - [ ] ability to run command on single repo
Some(Commands::Quick { category, repo }) => match (&category, &repo) {
// - gg quick
// - seidr quick
(None, None) => {
config.quick(message);
}
// - [ ] gg quick category
// - [ ] seidr quick category
(category, None) => {
println!("{}", category.as_ref().unwrap());
todo!();
@ -118,7 +118,7 @@ fn main() {
(category, repo) => {
println!("{} {}", category.as_ref().unwrap(), repo.as_ref().unwrap());
todo!();
} // // - [ ] gg quick category categorysitory "stuff"
} // // - [ ] seidr quick category categorysitory "stuff"
// (category, repo) => {
// println!("{} {}", category.as_ref().unwrap(), repo.as_ref().unwrap(),);
// todo!();
@ -203,7 +203,7 @@ mod config {
Repo {
name: Some("test repo".to_string()),
path: Some("/tmp".to_string()),
url: Some("https://github.com/cafkafk/gg".to_string()),
url: Some("https://github.com/cafkafk/seidr".to_string()),
flags: Some(vec![Clone, Push]),
kind: None,
},
@ -268,10 +268,10 @@ mod config {
"git@github.com:cafkafk/qmk_firmware.git"
);
});
(&config).get_link("stuff", "gg", |link| {
assert_eq!(link.name, "gg");
assert_eq!(link.tx, "/home/ces/.dots/gg");
assert_eq!(link.rx, "/home/ces/.config/gg");
(&config).get_link("stuff", "seidr", |link| {
assert_eq!(link.name, "seidr");
assert_eq!(link.tx, "/home/ces/.dots/seidr");
assert_eq!(link.rx, "/home/ces/.config/seidr");
});
}
}
@ -321,7 +321,7 @@ mod config {
Repo {
name: None,
path: Some("/tmp".to_string()),
url: Some("https://github.com/cafkafk/gg".to_string()),
url: Some("https://github.com/cafkafk/seidr".to_string()),
flags: Some(vec![Clone, Push]),
kind: Some(crate::git::RepoKinds::GitRepo),
},

View file

@ -16,10 +16,10 @@ categories:
flags: [Clone, Push]
utils:
repos:
gg:
name: gg
seidr:
name: seidr
path: /home/ces/.dots/
url: git@github.com:cafkafk/gg.git
url: git@github.com:cafkafk/seidr.git
kind: GitRepo
flags: [Clone, Push]
li:
@ -32,21 +32,21 @@ categories:
stuff:
flags: []
repos:
gg:
name: gg
seidr:
name: seidr
path: /home/ces/.dots/
kind: GitRepo
url: git@github.com:cafkafk/gg.git
url: git@github.com:cafkafk/seidr.git
li:
name: li
path: /home/ces/org/src/git/
kind: GitRepo
url: git@github.com:cafkafk/li.git
links:
gg:
name: gg
rx: /home/ces/.config/gg
tx: /home/ces/.dots/gg
seidr:
name: seidr
rx: /home/ces/.config/seidr
tx: /home/ces/.dots/seidr
starship:
name: starship
rx: /home/ces/.config/starship.toml
@ -54,10 +54,10 @@ categories:
fluff:
flags: []
links:
gg:
name: gg
rx: /home/ces/.config/gg
tx: /home/ces/.dots/gg
seidr:
name: seidr
rx: /home/ces/.config/seidr
tx: /home/ces/.dots/seidr
starship:
name: starship
rx: /home/ces/.config/starship.toml

View file

@ -26,11 +26,11 @@ use crate::settings;
/// Contains the notice for interactive programs from the GPLv3's "How to Apply
/// These Terms to Your New Programs"
pub const INTERACTIVE_NOTICE: &str = "\
gg Copyright (C) 2023 Christina Sørensen <cafkafk.com>
seidr Copyright (C) 2023 Christina Sørensen <cafkafk.com>
This program comes with ABSOLUTELY NO WARRANTY; for details type `gg
This program comes with ABSOLUTELY NO WARRANTY; for details type `seidr
--warranty'. This is free software, and you are welcome to redistribute it under
certain conditions; type `gg --license' for details. ";
certain conditions; type `seidr --license' for details. ";
/// Contains the license part of the long notice for interactive programs from
/// the GPLv3's "How to Apply These Terms to Your New Programs"

View file

@ -2,200 +2,3 @@
fn main() {
assert!(true);
}
/*
#[cfg(test)]
mod config {
use gg::git::RepoFlags::{Clone, Push};
use gg::git::{Category, Config, GitRepo, Link};
use relative_path::RelativePath;
use std::collections::HashMap;
use std::env::current_dir;
use std::fs::File;
use std::io::prelude::*;
#[test]
fn init_config() {
let _config = Config {
categories: HashMap::new(),
};
}
#[test]
fn init_config_populate() {
let default_category = Category {
flags: Some(vec![]),
repos: Some(HashMap::new()),
links: Some(HashMap::new()),
};
let mut config = Config {
categories: HashMap::new(),
};
config
.categories
.insert(format!("{}", 0).to_string(), default_category);
for i in 0..=5 {
config
.categories
.get_mut(&format!("{}", 0).to_string())
.expect("category not found")
.repos
.as_mut()
.expect("failed to get repo")
.insert(
format!("{}", i).to_string(),
GitRepo {
name: "test repo".to_string(),
path: "/tmp".to_string(),
url: "https://github.com/cafkafk/gg".to_string(),
flags: Some(vec![Clone, Push]),
},
);
}
}
#[test]
fn read_config_populate() {
let _config = Config::new(&RelativePath::new("./src/test/config.yaml").to_string());
}
#[test]
fn write_config() {
let root = current_dir().expect("failed to get current dir");
let config = Config::new(
&RelativePath::new("./src/test/config.yaml")
.to_logical_path(&root)
.into_os_string()
.into_string()
.expect("failed to turn config into string"),
);
let mut test_file = File::create(
RelativePath::new("./src/test/test.yaml")
.to_logical_path(&root)
.into_os_string()
.into_string()
.expect("failed to turn config into string"),
)
.expect("failed to create test file");
let contents = serde_yaml::to_string(&config).expect("failed to turn config into string");
test_file
.write_all(contents.as_bytes())
.expect("failed to write contents of config into file");
let test_config = Config::new(&RelativePath::new("./src/test/test.yaml").to_string());
assert_eq!(config, test_config);
}
#[allow(dead_code)]
fn get_category<'cat>(config: &'cat Config, name: &'cat str) -> &'cat Category {
config.categories.get(name).expect("failed to get category")
}
fn get_repo<F>(config: &Config, cat_name: &str, repo_name: &str, f: F)
where
F: FnOnce(&GitRepo),
{
f(config
.categories
.get(cat_name)
.expect("failed to get category")
.repos
.as_ref()
.expect("failed to get repo")
.get(repo_name)
.expect("failed to get category"))
}
fn get_link<F>(config: &Config, cat_name: &str, link_name: &str, f: F)
where
F: FnOnce(&Link),
{
f(config
.categories
.get(cat_name)
.expect("failed to get category")
.links
.as_ref()
.expect("failed to get repo")
.get(link_name)
.expect("failed to get category"))
}
#[test]
fn is_config_readable() {
let root = current_dir().expect("failed to get current dir");
let config = Config::new(
&RelativePath::new("./src/test/config.yaml")
.to_logical_path(root)
.into_os_string()
.into_string()
.expect("failed to turnn config into string"),
);
let _flags = vec![Clone, Push];
// FIXME not very extensive
#[allow(clippy::bool_assert_comparison)]
{
get_repo(&config, "config", "qmk_firmware", |repo| {
assert_eq!(repo.name, "qmk_firmware");
assert_eq!(repo.path, "/home/ces/org/src/git/");
assert_eq!(repo.url, "git@github.com:cafkafk/qmk_firmware.git");
});
get_link(&config, "stuff", "gg", |link| {
assert_eq!(link.name, "gg");
assert_eq!(link.tx, "/home/ces/.dots/gg");
assert_eq!(link.rx, "/home/ces/.config/gg");
});
}
/*
{
assert_eq!(config.links[0].name, "gg");
assert_eq!(config.links[0].rx, "/home/ces/.config/gg");
assert_eq!(config.links[0].tx, "/home/ces/.dots/gg");
assert_eq!(config.links[1].name, "starship");
assert_eq!(config.links[1].rx, "/home/ces/.config/starship.toml");
assert_eq!(config.links[1].tx, "/home/ces/.dots/starship.toml");
// FIXME doesn't check repoflags
}*/
}
}*/
/*
#[cfg(test)]
mod repo_actions {
use gg::git::GitRepo;
use gg::relative_path::RelativePath;
use gg::std::env::current_dir;
use gg::std::process::Command;
#[test]
#[allow(clippy::redundant_clone)]
fn test_repo_actions() {
let test_repo_name: String = "test".to_string();
let root = current_dir().unwrap();
let test_repo_dir: String = RelativePath::new("./src/test")
.to_logical_path(&root)
.into_os_string()
.into_string()
.unwrap();
let test_repo_url: String = "git@github.com:cafkafk/test.git".to_string();
println!("{}", test_repo_dir);
let mut config = Config {
repos: vec![],
links: vec![],
};
let repo = GitRepo {
name: test_repo_name.to_owned(),
path: test_repo_dir.to_owned(),
url: test_repo_url.to_owned(),
clone: true,
};
config.repos.push(repo);
// BUG FIXME can't do this in flake
// should have a good alternative
// config.clone_all();
// config.pull_all();
for r in config.repos.iter() {
Command::new("touch")
.current_dir(&(r.path.to_owned() + &r.name))
.arg("test")
.status()
.expect("failed to create test file");
}
config.add_all();
config.commit_all_msg(&"test".to_string());
}
}
*/