repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
6e77947
parent
62eeceb
author
Eric Bower
date
2024-10-08 01:54:36 +0000 UTC
chore(pubsub): print `-p` flag for pub and pipe stdout msg
1 files changed,  +8, -2
M pubsub/cli.go
+8, -2
 1@@ -256,6 +256,7 @@ func WishMiddleware(handler *CliHandler) wish.Middleware {
 2 				}
 3 
 4 				var name string
 5+				msgFlag := ""
 6 
 7 				if isAdmin && strings.HasPrefix(topic, "/") {
 8 					name = strings.TrimPrefix(topic, "/")
 9@@ -263,13 +264,15 @@ func WishMiddleware(handler *CliHandler) wish.Middleware {
10 					name = toTopic(user.Name, topic)
11 					if *public {
12 						name = toPublicTopic(topic)
13+						msgFlag = "-p "
14 					}
15 				}
16 
17 				wish.Printf(
18 					sesh,
19-					"subscribe to this channel:\n\tssh %s sub %s\n",
20+					"subscribe to this channel:\n\tssh %s sub %s%s\n",
21 					toSshCmd(handler.Cfg),
22+					msgFlag,
23 					topic,
24 				)
25 
26@@ -423,6 +426,7 @@ func WishMiddleware(handler *CliHandler) wish.Middleware {
27 				}
28 
29 				var name string
30+				flagMsg := ""
31 
32 				if isAdmin && strings.HasPrefix(topic, "/") {
33 					name = strings.TrimPrefix(topic, "/")
34@@ -430,14 +434,16 @@ func WishMiddleware(handler *CliHandler) wish.Middleware {
35 					name = toTopic(user.Name, topic)
36 					if *public {
37 						name = toPublicTopic(topic)
38+						flagMsg = "-p "
39 					}
40 				}
41 
42 				if isCreator {
43 					wish.Printf(
44 						sesh,
45-						"subscribe to this topic:\n\tssh %s sub %s\n",
46+						"subscribe to this topic:\n\tssh %s sub %s%s\n",
47 						toSshCmd(handler.Cfg),
48+						flagMsg,
49 						topic,
50 					)
51 				}