git.fiddlerwoaroof.com
Browse code

feature(aws-dispatcher): add slot printer

Ed Langley authored on 23/12/2019 20:57:07
Showing 1 changed files
... ...
@@ -1,6 +1,7 @@
1 1
 (defpackage :mfa-tool.aws-dispatcher
2 2
   (:use :cl)
3
-  (:export #:aws-dispatcher #:update-stacks #:select-stack #:stacks #:stack))
3
+  (:export #:aws-dispatcher #:update-stacks #:select-stack #:stacks #:stack
4
+           #:put-stack))
4 5
 (in-package :mfa-tool.aws-dispatcher)
5 6
 
6 7
 (defclass aws-dispatcher ()
... ...
@@ -12,6 +13,20 @@
12 13
    :region "us-east-1"
13 14
    :credentials (error "AWS-DISPATCHER requires a :CREDENTIALS initarg")))
14 15
 
16
+(defmacro defprint-slots (class slots)
17
+  `(defmethod print-object ((o ,class) s)
18
+     (with-slots ,slots o
19
+       (print-unreadable-object (o s :type t :identity t)
20
+         (format s "~@{~s~^, ~}"
21
+                 ,@slots)))))
22
+(defprint-slots daydreamer.aws-result:stack
23
+    (daydreamer.aws-result::%stack-name))
24
+
25
+(defclass put-stack ()
26
+  ((%stack :reader stack :initarg :stack)))
27
+(defun put-stack (stack)
28
+  (fw.lu:new 'put-stack stack))
29
+
15 30
 (defclass update-stacks ()
16 31
   ((%stacks :initarg :stacks :reader stacks)))
17 32
 (defun update-stacks (stacks)
... ...
@@ -19,6 +34,7 @@
19 34
 
20 35
 (defclass select-stack ()
21 36
   ((%stacks :initarg :stack :reader stack)))
37
+(defprint-slots select-stack (%stacks))
22 38
 
23 39
 (defun select-stack (stack)
24 40
   (fw.lu:new 'select-stack stack))