[chirp_devel] [PATCH 06/10] chirpc: add --list-mem (#2343)

Zachary T Welch
Fri Mar 6 01:16:04 PST 2015


# HG changeset patch
# User Zachary T Welch <zach at mandolincreekfarm.com>
# Fake Node ID 93489cb7cabf1b7aa312d2df0466991087ecce47

chirpc: add --list-mem (#2343)

This patch allows the CLI to print out the entire list of memories.
If --verbose is given, it displays empty slots too; otherwise, only
non-empty memories are displayed.

diff --git a/chirpc b/chirpc
index dadf8f2..a31a4ef 100755
--- a/chirpc
+++ b/chirpc
@@ -82,6 +82,9 @@ if __name__ == "__main__":
                         help="Request radio ID string")
 
     memarg = parser.add_argument_group("Memory/Channel Options")
+    memarg.add_argument("--list-mem", action="store_true",
+                        help="List all memory locations")
+
     memarg.add_argument("--raw", action="store_true",
                         help="Dump raw memory location")
 
@@ -195,6 +198,16 @@ if __name__ == "__main__":
         print radio.get_settings()
         sys.exit(0)
 
+    if options.list_mem:
+        rf = radio.get_features()
+        start, end = rf.memory_bounds
+        for i in range(start, end + 1):
+            mem = radio.get_memory(i)
+            if mem.empty and not logger.is_visible(logging.INFO):
+                continue
+            print mem
+        sys.exit(0)
+
     if options.raw:
         data = radio.get_raw_memory(int(args[0]))
         for i in data:




More information about the chirp_devel mailing list