Browse Source

Update to allow "all" to run them all automatically

Samuel W. Flint 3 years ago
parent
commit
eb7fc432da
4 changed files with 12 additions and 4 deletions
  1. 1 1
      Cargo.lock
  2. 1 1
      Cargo.toml
  3. 2 2
      flake.nix
  4. 8 0
      src/lib/run.rs

+ 1 - 1
Cargo.lock

@@ -171,7 +171,7 @@ dependencies = [
 
 [[package]]
 name = "sync-it"
-version = "1.4.0"
+version = "1.5.0"
 dependencies = [
  "clap",
  "home",

+ 1 - 1
Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "sync-it"
-version = "1.4.0"
+version = "1.5.0"
 authors = ["Samuel W. Flint <swflint@flintfam.org>"]
 edition = "2018"
 

+ 2 - 2
flake.nix

@@ -17,11 +17,11 @@
 
           sync-it = pkgs.rustPlatform.buildRustPackage rec {
             name = "sync-it";
-            version = "1.4.0";
+            version = "1.5.0";
 
             src = ./.;
 
-            cargoSha256 = "q9r+qaLufPK8KNXBscfjJ++o/hgJ58bu9IyE/IaK9LM=";
+            cargoSha256 = "1/UpgXhwd+vVg4eUYCEokXSAPtdyJxZCSweCJf84uiU=";
 
             meta = with pkgs.stdenv.lib; {
               description = "A simple, customizable synchronization tool.";

+ 8 - 0
src/lib/run.rs

@@ -13,6 +13,10 @@ pub fn run(config: &Config, names: Values<'_>) {
             run_repository_sync(&config, name.to_string());
         } else if config.groups.contains_key(name) {
             run_group(&config, name.to_string());
+        } else if name == "all" {
+            for repo_name in config.repositories.keys() {
+                run_repository_sync(&config, repo_name.to_string());
+            }
         } else {
             println!("\"{}\" is neither a group nor a repository.", name);
         }
@@ -25,6 +29,10 @@ pub fn run_with_command(config: &Config, command: String, names: Values<'_>) {
             run_named_command(&config, name.to_string(), &command);
         } else if config.groups.contains_key(name) {
             run_group_with_command(&config, name.to_string(), &command);
+        } else if name == "all" {
+            for repo_name in config.repositories.keys() {
+                run_named_command(&config, repo_name.to_string(), &command);
+            }
         } else {
             println!("\"{}\" is neither a group nor a repository.", name);
         }