Browse Source

Add list subcommands

Samuel W. Flint 3 years ago
parent
commit
c398135674
2 changed files with 28 additions and 0 deletions
  1. 8 0
      src/cli.yml
  2. 20 0
      src/main.rs

+ 8 - 0
src/cli.yml

@@ -36,6 +36,8 @@ subcommands:
         - repo
         - r
       subcommands:
+        - list:
+            about: List repositories
         - register:
             about: Register the current directory as a repository
             args:
@@ -164,6 +166,8 @@ subcommands:
                   value_name: NAME
                   help: The name of the group
                   required: true
+        - list:
+            about: List known groups
   - type:
       about: Create and manage repository types
       settings:
@@ -257,6 +261,8 @@ subcommands:
                   value_name: NAME
                   help: The name of the repository type
                   required: true
+        - list:
+            about: List known repository types
   - action:
       about: Create and manage actions
       settings:
@@ -312,3 +318,5 @@ subcommands:
                   value_name: NAME
                   help: The name of the repository type
                   required: true
+        - list:
+            about: List known actions

+ 20 - 0
src/main.rs

@@ -69,6 +69,11 @@ fn main() {
                         Some(repository) => println!("{}", repository),
                         None => eprintln!("No known repository named \"{}\".", name)
                     }
+                },
+                Some("list") => {
+                    for key in configuration.repositories.keys() {
+                        println!(" - {}", key);
+                    }
                 }
                 _ => panic!("Something has gone horribly wrong...")
             }
@@ -108,6 +113,11 @@ fn main() {
                         None => eprintln!("No known action named \"{}\".", name)
                     }
                 },
+                Some("list") => {
+                    for key in configuration.actions.keys() {
+                        println!(" - {}", key);
+                    }
+                }
                 _ => panic!("Something has gone horribly wrong...")
             }
         },
@@ -144,6 +154,11 @@ fn main() {
                         None => eprintln!("No known group named \"{}\".", name)
                     }
                 },
+                Some("list") => {
+                    for key in configuration.groups.keys() {
+                        println!(" - {}", key);
+                    }
+                },
                 _ => panic!("Something has gone horribly wrong...")
             }
         },
@@ -228,6 +243,11 @@ fn main() {
                         None => eprintln!("No known repo type named \"{}\".", name)
                     }
                 },
+                Some("list") => {
+                    for key in configuration.repo_types.keys() {
+                        println!(" - {}", key);
+                    }
+                },
                 _ => panic!("Something has gone horribly wrong...")
             }
         },