chore(version): bump to 0.0.7 #7

Merged
cafkafk merged 7 commits from dev into main 2023-07-02 12:11:13 +02:00
4 changed files with 29 additions and 22 deletions
Showing only changes of commit 1c6793f8e4 - Show all commits

View file

@ -73,7 +73,8 @@ pub struct Category {
/// map of all categories /// map of all categories
/// ///
/// Key should conceptually be seen as the name of the category. /// Key should conceptually be seen as the name of the category.
pub repos: HashMap<String, GitRepo>, #[serde(skip_serializing_if = "Option::is_none")]
pub repos: Option<HashMap<String, GitRepo>>,
} }
/// Contain fields for a single link. /// Contain fields for a single link.
@ -311,7 +312,7 @@ impl Config {
F: Fn(&GitRepo), F: Fn(&GitRepo),
{ {
for (_, category) in self.categories.iter() { for (_, category) in self.categories.iter() {
for (_, repo) in category.repos.iter() { for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() {
f(repo); f(repo);
} }
} }
@ -326,7 +327,7 @@ impl Config {
F: Fn(&GitRepo) -> bool, F: Fn(&GitRepo) -> bool,
{ {
for (_, category) in self.categories.iter() { for (_, category) in self.categories.iter() {
for (_, repo) in category.repos.iter() { for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() {
let mut sp = let mut sp =
Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op).into()); Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op).into());
if f(repo) { if f(repo) {
@ -380,7 +381,7 @@ impl Config {
/// ``` /// ```
pub fn series_on_all(&self, closures: Vec<SeriesItem>) { pub fn series_on_all(&self, closures: Vec<SeriesItem>) {
for (_, category) in self.categories.iter() { for (_, category) in self.categories.iter() {
for (_, repo) in category.repos.iter() { for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() {
for instruction in closures.iter() { for instruction in closures.iter() {
let f = &instruction.closure; let f = &instruction.closure;
let op = instruction.operation; let op = instruction.operation;
@ -427,7 +428,7 @@ impl Config {
/// ``` /// ```
pub fn all_on_all(&self, closures: Vec<SeriesItem>) { pub fn all_on_all(&self, closures: Vec<SeriesItem>) {
for (_, category) in self.categories.iter() { for (_, category) in self.categories.iter() {
for (_, repo) in category.repos.iter() { for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() {
for instruction in closures.iter() { for instruction in closures.iter() {
let f = &instruction.closure; let f = &instruction.closure;
let op = instruction.operation; let op = instruction.operation;

View file

@ -127,7 +127,7 @@ mod config {
fn init_config_populate() { fn init_config_populate() {
let default_category = Category { let default_category = Category {
flags: Some(vec![]), flags: Some(vec![]),
repos: HashMap::new(), repos: Some(HashMap::new()),
}; };
let mut config = Config { let mut config = Config {
categories: HashMap::new(), categories: HashMap::new(),
@ -142,6 +142,8 @@ mod config {
.get_mut(&format!("{}", 0).to_string()) .get_mut(&format!("{}", 0).to_string())
.expect("category not found") .expect("category not found")
.repos .repos
.as_mut()
.expect("failed to get repo")
.insert( .insert(
format!("{}", i).to_string(), format!("{}", i).to_string(),
GitRepo { GitRepo {
@ -196,6 +198,8 @@ mod config {
.get(cat_name) .get(cat_name)
.expect("failed to get category") .expect("failed to get category")
.repos .repos
.as_ref()
.expect("failed to get repo")
.get(repo_name) .get(repo_name)
.expect("failed to get category")) .expect("failed to get category"))
} }

View file

@ -24,6 +24,7 @@ categories:
path: /home/ces/org/src/git/ path: /home/ces/org/src/git/
url: git@github.com:cafkafk/li.git url: git@github.com:cafkafk/li.git
flags: [Clone, Push] flags: [Clone, Push]
empty:
links: links:
- name: gg - name: gg
rx: /home/ces/.config/gg rx: /home/ces/.config/gg

View file

@ -1,20 +1,5 @@
categories: categories:
utils: empty: {}
repos:
gg:
name: gg
path: /home/ces/.dots/
url: git@github.com:cafkafk/gg.git
flags:
- Clone
- Push
li:
name: li
path: /home/ces/org/src/git/
url: git@github.com:cafkafk/li.git
flags:
- Clone
- Push
config: config:
flags: [] flags: []
repos: repos:
@ -32,6 +17,22 @@ categories:
flags: flags:
- Clone - Clone
- Push - Push
utils:
repos:
li:
name: li
path: /home/ces/org/src/git/
url: git@github.com:cafkafk/li.git
flags:
- Clone
- Push
gg:
name: gg
path: /home/ces/.dots/
url: git@github.com:cafkafk/gg.git
flags:
- Clone
- Push
links: links:
- name: gg - name: gg
rx: /home/ces/.config/gg rx: /home/ces/.config/gg